如何解决为什么在 KeyCloak 中考虑的是我的 OCT 密钥而不是 RSA 密钥?
我是 KeyCloak 的新手,我尝试在本地将 Java Spring Boot 项目绑定到它。
这是我的
应用程序.yml
server :
port: 8888
logging:
level:
org.spring.framework.web: DEBUG
keycloak:
auth-server-url: http://localhost:8080/auth
realm: jozinho
resource: brazil-demo-app
ssl-required: external
public-client: true
@Configuration
public class KeycloakSecurityConfiguration extends KeycloakWebSecurityConfigurerAdapter {
@Override
protected SessionAuthenticationStrategy sessionAuthenticationStrategy() {
return new RegisterSessionAuthenticationStrategy(new SessionRegistryImpl());
}
@Bean
public KeycloakConfigResolver keycloakConfigResolver() {
return new KeycloakSpringBootConfigResolver();
}
@Autowired
public void configureProvider(AuthenticationManagerBuilder amb) {
amb.authenticationProvider(keycloakAuthenticationProvider());
}
@Override
public void configure(HttpSecurity http) throws Exception {
super.configure(http);
http.authorizeRequests().antMatchers("/players").authenticated();
}
}
因此,当我尝试访问上面声明的“玩家”路径时,我被重定向到 KeyCloak 登录页面。 但是 Spring Boot 控制台告诉我:
o.k.a.rotation.AdapterTokenVerifier : 没有找到 publicKey 孩子:1dda3801-94f4-4f8e-80d4-ad7beef2b707 o.k.adapters.OAuthRequestAuthenticator : 验证失败 令牌:未找到指定孩子的公钥
此外,KeyCloak 控制台(standalone.bat)告诉:
14:45:48,534 警告 [org.keycloak.events](默认任务 42) type=CODE_TO_TOKEN_ERROR,realmId=jozinho,clientId=brazil-demo-app, userId=null,ipAddress=127.0.0.1,error=invalid_code, grant_type=authorization_code, code_id=3cb6c09c-cb88-4101-a93f-95e6072c443c, client_auth_method=client-secret
在我的 KeyCloak 管理控制台中,我只为其中一行生成了一个公钥。好吧,根据上面的日志,我需要这个。
这是我正在呼叫的客户的视图:
有人能告诉我如何指定我想要这个 RSA 而不是这个 OCT 密钥吗?
先谢谢你
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。