【发布时间】:2020-03-27 09:30:46
【问题描述】:
目前,我正在使用 Spring Boot 2.2.5 版本。文档看起来不完整。 @EnableOAuth2Client 或 @EnableOAuth2Sso.enter image description here 的替代品是什么
【问题讨论】:
标签: java spring spring-boot spring-security-oauth2
目前,我正在使用 Spring Boot 2.2.5 版本。文档看起来不完整。 @EnableOAuth2Client 或 @EnableOAuth2Sso.enter image description here 的替代品是什么
【问题讨论】:
标签: java spring spring-boot spring-security-oauth2
您可以通过 WebSecurityConfigurerAdapter 的 配置方法而不是注释来完成。
EnableOAuth2Sso 现在是这样的:
@Override
protected void configure(HttpSecurity http) throws Exception {
http.authorizeRequests()
.anyRequest().authenticated()
.and()
.oauth2Login(); // sso
}
@EnableOAuth2Client 现在是这个(完整示例和配置选项,请参阅Spring's migration guide):
@Override
protected void configure(HttpSecurity http) throws Exception {
http
.oauth2Client();
}
【讨论】: