从1.x迁移到Spring Boot(安全)2
在当前将项目从SpringBoot1.X迁移到2.0.9的过程中,我面临着使用SpringSecurity模块的困难时期。在第一步中,我必须更改属性以访问数据源(到JDBCURL),现在该部分似乎工作正常,但现在安全模块似乎没有正确连接 因此,在属性中,我尝试添加以下内容:从1.x迁移到Spring Boot(安全)2,spring,spring-boot,oauth-2.0,spring-security-oauth2,Spring,Spring Boot,Oauth 2.0,Spring Security Oauth2,在当前将项目从SpringBoot1.X迁移到2.0.9的过程中,我面临着使用SpringSecurity模块的困难时期。在第一步中,我必须更改属性以访问数据源(到JDBCURL),现在该部分似乎工作正常,但现在安全模块似乎没有正确连接 因此,在属性中,我尝试添加以下内容: spring.security.user.name=admin spring.security.user.password=secret 但是,即使我对其进行了注释或取消注释,我也会面临相同的结果,当我调用webservic
spring.security.user.name=admin
spring.security.user.password=secret
但是,即使我对其进行了注释或取消注释,我也会面临相同的结果,当我调用webservices时,对话框会提示询问凭据:
身份验证的配置如下所示:
class OAuth2Configuration extends AuthorizationServerConfigurerAdapter {
@Configuration
@EnableAuthorizationServer // [1]
@EnableGlobalMethodSecurity(prePostEnabled = true)
@EnableWebSecurity
protected static class OAuth2Config extends AuthorizationServerConfigurerAdapter {
@Autowired
private TokenStore tokenStore;
@Autowired
private DataSource oauthDataSource;
@Autowired
private PhrqlAuthenticationManager phrqlAuthenticationManager;
/**
* Config clientDetail storage
* @param endpoints
* @throws Exception
*/
@Override
public void configure(AuthorizationServerEndpointsConfigurer endpoints)
throws Exception {
endpoints.authenticationManager(phrqlAuthenticationManager);
endpoints.tokenStore(tokenStore);
// endpoints.tokenStore(tokenStore).pathMapping("/oauth/token", "/p/oauth/token");
}
@Override // [3]
public void configure(ClientDetailsServiceConfigurer clients) throws Exception {
clients.jdbc(oauthDataSource);
}
}
出于某种原因,我认为自动配置没有访问name pass,因此客户端要求提供凭据。任何帮助都将不胜感激。提前谢谢