我的登录组件在被一个有关promise中未定义对象的错误消息删除之前会暂时显示.
这是承诺定义:
static init(): Promise<any> {
KeycloakClientService.auth.loggedIn = false;
return new Promise((resolve, reject) => {
const keycloakConfig = {
url: environment.KEYCLOAK_URL,
realm: environment.KEYCLOAK_REALM,
clientId: environment.KEYCLOAK_CLIENTID,
'ssl-required': 'external',
'public-client': true
};
const keycloakAuth: any = new Keycloak(keycloakConfig);
keycloakAuth.init({onLoad: 'check-sso'})
.success(() => {
KeycloakClientService.auth.loggedIn = true;
KeycloakClientService.auth.authz = keycloakAuth;
KeycloakClientService.auth.logoutUrl = environment.KEYCLOAK_URL
+ '/realms/' + environment.KEYCLOAK_REALM + '/protocol/openid-connect/logout?redirect_uri='
+ document.baseURI;
console.log('=======>> The keycloak client has been initiated successfully');
resolve('Succeeded in initiating the keycloak client');
})
.error(() => {
reject('Failed to initiate the …Run Code Online (Sandbox Code Playgroud) 我正在升级应用程序Spring Boot 2.0.3.
但我的登录请求是未经授权的:
curl -H "Accept:application/json" -H "Content-Type: application/json" "http://localhost:8080/api/users/login" -X POST -d "{ \"email\" : \"myemail@somedomain.com\", \"password\" : \"xxxxx\" }" -i
Run Code Online (Sandbox Code Playgroud)
回应是401 Unauthorized access. You failed to authenticate.
它由我的自定义入口点给出:
@Component
public final class RESTAuthenticationEntryPoint extends BasicAuthenticationEntryPoint {
private static Logger logger = LoggerFactory.getLogger(RESTAuthenticationEntryPoint.class);
@Override
public void commence(HttpServletRequest request, HttpServletResponse response, AuthenticationException authenticationException) throws IOException, ServletException {
logger.debug("Security - RESTAuthenticationEntryPoint - Entry point 401");
response.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
response.sendError(HttpServletResponse.SC_UNAUTHORIZED, "Unauthorized access. You failed to authenticate.");
}
@Override
public …Run Code Online (Sandbox Code Playgroud) 在Chrome浏览器中打开Web应用程序时,可以将VSCode调试器附加到该应用程序。
调试器配置为:
{
"name": "Attach to Chrome",
"type": "chrome",
"request": "attach",
"port": 9222,
"url": "http://localhost:4200/*",
"webRoot": "${workspaceFolder}",
},
Run Code Online (Sandbox Code Playgroud)
但是,当我在Brave浏览器中打开Web应用程序时,无法附加VSCode调试器。
Web应用程序是Angular在http://localhost:4200/users
我在跑:
Chrome Version 70.0.3538.102 (Build officiel) (64 bits)
Brave Version 0.56.12 Chromium: 70.0.3538.77 (Build officiel) (64 bits)
VSCode Version 1.23.0
Run Code Online (Sandbox Code Playgroud)
在一个Lubuntu 16.04盒子上。
是Brave浏览器还没有准备好进行调试?还是我应该删除一些端口限制?我已经将此Web应用程序放下了。但是VSCode仍然没有依附。
我正试图摆脱log4j.xml文件,只在Spring项目中使用JavaConfig方式.
原始记录器元素如下所示:
<appender name="consoleAppender" class="org.apache.log4j.ConsoleAppender">
<param name="Threshold" value="ALL" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d %-5p [%c{1}] %m %n" />
</layout>
</appender>
<appender name="fileAppender" class="org.apache.log4j.RollingFileAppender">
<param name="Threshold" value="ALL" />
<param name="File" value="build.log" />
<param name="maxFileSize" value="100KB" />
<param name="maxBackupIndex" value="1" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d %-5p [%c{1}] %m %n" />
</layout>
</appender>
<appender name="mailAppender" class="org.apache.log4j.net.SMTPAppender">
<param name="Threshold" value="ERROR" />
<param name='SMTPDebug' value='true' />
<param name="SMTPProtocol" value="smtps" />
<param name="SMTPHost" value="smtp.gmail.com" />
<param name='SMTPPort' value='465' />
<param name="SMTPUsername" value="learnintouch@gmail.com" />
<param …Run Code Online (Sandbox Code Playgroud) 我的 Spring Hibernate Web 应用程序在 MySQL 上运行,这给我带来了麻烦。
我四处搜索并尝试了不同的配置,在这个网站上阅读了很多线程,但它仍然会弹出它的笑脸。
错误信息是: Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: 从服务器成功接收的最后一个数据包是 63,313,144 毫秒前。最后一个成功发送到服务器的数据包是在 63,313,144 毫秒之前。比服务器配置的“wait_timeout”值长。您应该考虑在应用程序中使用之前使连接有效性过期和/或测试连接有效性,增加客户端超时的服务器配置值,或使用连接器/J 连接属性“autoReconnect=true”来避免此问题。
Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: The last packet successfully received from the server was 63,313,144 milliseconds ago. The last packet sent successfully to the server was 63,313,144 milliseconds ago. is longer than the server configured value of 'wait_timeout'. You should consider either expiring and/or testing connection validity before use in your application, increasing the server configured values for client timeouts, or using the Connector/J …Run Code Online (Sandbox Code Playgroud) 尝试配置 logback,但在运行应用程序时无法使用我的配置。
有很多控制台输出,即使我删除了所有配置,并且没有文件输出,所以我认为控制台输出是使用一些默认配置完成的。
到目前为止,这是我的配置:
@Configuration
public class Log4j {
private final static String PATTERN = "%date %-5level [%thread] %logger{36} %m%n %rEx";
@Bean
public static LoggerContext loggerContext() {
return (LoggerContext) LoggerFactory.getILoggerFactory();
}
@Bean (initMethod = "start", destroyMethod = "stop")
public static PatternLayoutEncoder encoder (LoggerContext ctx) {
PatternLayoutEncoder encoder = new PatternLayoutEncoder();
encoder.setContext(ctx);
encoder.setPattern(PATTERN);
return encoder;
}
@Bean (initMethod = "start", destroyMethod = "stop")
public static ConsoleAppender consoleAppender (LoggerContext context, PatternLayoutEncoder encoder) {
ConsoleAppender consoleAppender = new ConsoleAppender();
consoleAppender.setContext(context);
consoleAppender.setEncoder(encoder);
return consoleAppender; …Run Code Online (Sandbox Code Playgroud) 我正在尝试为Angular 6库配置路径(我已成功为以前的 Angular 项目配置了路径)
这是tsconfig.json文件中我以前的应用程序的工作:
"compilerOptions": {
[...]
"baseUrl": "src",
"paths": {
"@class/*": [ "app/class/*" ],
"@services/*": [ "app/services/*" ],
"@views/*": [ "app/views/*" ]
}
}
Run Code Online (Sandbox Code Playgroud)
然后使用它,例如:
Import { Item } form '@class/item';
Run Code Online (Sandbox Code Playgroud)
在我的新应用程序中,我在tsconfig.**lib**.json文件中尝试相同的方式:
"compilerOptions": {
[...]
"baseUrl": "src",
"paths": {
"@class/*": [ "lib/class/*" ],
"@services/*": [ "lib/services/*" ],
"@views/*": [ "lib/views/*" ]
}
}
Run Code Online (Sandbox Code Playgroud)
我试图像这样为我的库在组件中导入一个类,但它不起作用(VSCode 找不到该文件):
Import { Item } form '@class/item';
Run Code Online (Sandbox Code Playgroud)
请注意,import主项目中的语句正在起作用:
Import { Item } from 'myLibrary';
Run Code Online (Sandbox Code Playgroud)
知道我做得不好吗?
谢谢你的帮助。
我正在尝试让我的授权服务器生成一个带有一些自定义声明的JWT访问令牌.
以下是授权服务器/auth/token端点返回的承载令牌的样子:51aea31c-6b57-4c80-9d19-a72e15cb2bb7
我觉得这个令牌有点短,不能作为JWT令牌并包含我的自定义声明......
当在后续的资源服务器请求中使用它时,它会抱怨错误: Cannot convert access token to JSON
我正在使用以下依赖项:
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.1.RELEASE</version>
<relativePath/>
</parent>
<dependency>
<groupId>org.springframework.security.oauth.boot</groupId>
<artifactId>spring-security-oauth2-autoconfigure</artifactId>
<version>2.1.2.RELEASE</version>
</dependency>
Run Code Online (Sandbox Code Playgroud)
授权服务器以这种方式配置:
@Override
public void configure(AuthorizationServerEndpointsConfigurer endpoints) throws Exception {
endpoints
.tokenServices(defaultTokenServices())
.allowedTokenEndpointRequestMethods(HttpMethod.GET, HttpMethod.POST)
.accessTokenConverter(jwtAccessTokenConverter())
.userDetailsService(userDetailsService);
endpoints
.pathMapping("/oauth/token", RESTConstants.SLASH + DomainConstants.AUTH + RESTConstants.SLASH + DomainConstants.TOKEN);
TokenEnhancerChain tokenEnhancerChain = new TokenEnhancerChain();
tokenEnhancerChain.setTokenEnhancers(Arrays.asList(tokenEnhancer(), jwtAccessTokenConverter()));
endpoints
.tokenStore(tokenStore())
.tokenEnhancer(tokenEnhancerChain)
.authenticationManager(authenticationManager);
}
@Bean
@Primary
public DefaultTokenServices defaultTokenServices() {
DefaultTokenServices defaultTokenServices = new DefaultTokenServices();
defaultTokenServices.setTokenStore(tokenStore());
defaultTokenServices.setSupportRefreshToken(true);
return defaultTokenServices;
}
@Bean
public TokenStore …Run Code Online (Sandbox Code Playgroud) 我正在尝试在Spring 3 REST应用程序中处理区域设置更改.
但是语言环境没有改为fr.
控制台日志显示:2014-05-19 14:29:46,214 DEBUG [AbstractExceptionHandler] locale:en
这是我的配置:
@Bean
public MessageSource messageSource() {
ReloadableResourceBundleMessageSource messageSource = new ReloadableResourceBundleMessageSource();
messageSource.setBasenames("classpath:messages/messages", "classpath:messages/validation");
// If true, the key of the message will be displayed if the key is not found, instead of throwing an exception
messageSource.setUseCodeAsDefaultMessage(true);
messageSource.setDefaultEncoding("UTF-8");
// The value 0 means always reload the messages to be developer friendly
messageSource.setCacheSeconds(0);
return messageSource;
}
// The locale interceptor provides a way to switch the language in any page just by passing …Run Code Online (Sandbox Code Playgroud) 我正在尝试为应用程序配置DAP调试器。Neovimtypescript
我添加了DAP插件:
use "mfussenegger/nvim-dap"
Run Code Online (Sandbox Code Playgroud)
我还有一个config.lua包含适配器和配置的文件:
local status_ok, dap = pcall(require, "dap")
if not status_ok then
return
end
dap.adapters.chrome = {
type = "executable",
command = "node",
args = {os.getenv("HOME") .. "/dev/dap-debugger/vscode-js-debug/out/src/debugServerMain.js", "45635"}
}
dap.configurations.typescript = {
{
type = "chrome",
request = "attach",
program = "${file}",
debugServer = 45635,
cwd = vim.fn.getcwd(),
sourceMaps = true,
protocol = "inspector",
port = 9222,
webRoot = "${workspaceFolder}"
}
}
Run Code Online (Sandbox Code Playgroud)
当我在 typescript 应用程序项目中的 nvim 下尝试使用以下命令启动调试器时:lua require'dap'.continue(),出现错误: …