直接在ResourceServerSecurityConfigurer配置tokenServices的区别
来源:4-6 搭建OAuth2资源服务器
用银河口袋的露娜
2019-09-22
@EnableResourceServer
@Configuration
public class OAuth2ResourceServerConfig extends ResourceServerConfigurerAdapter {
@Bean
public ResourceServerTokenServices tokenServices(){
RemoteTokenServices tokenServices = new RemoteTokenServices();
tokenServices.setClientId("order-app");
tokenServices.setClientSecret("123456");
tokenServices.setCheckTokenEndpointUrl("http://localhost:9091/oauth/check_token");
return tokenServices;
}
@Override
public void configure(ResourceServerSecurityConfigurer resources) throws Exception {
resources.resourceId("order-app").tokenServices(tokenServices());
}
}
我直接这样配置也能达到效果。。但是听老师说是要用OAuth2AuthenticationManager替换默认的OAuth2AuthenticationManager,这样他验证才会走oauth2的验证方式
问:我这样配,是系统就默认给我用OAuth2AuthenticationManager替换默认的吗?
写回答
1回答
-
JoJo
2019-09-23
嗯,是的,spring boot自动做了配置。
022019-11-17
相似问题