EnableOAuth2Client 已弃用
EnableOAuth2Client deprecated
目前,我正在使用 Spring Boot 2.2.5 版本。文档看起来不完整。 @EnableOAuth2Client
或 @EnableOAuth2Sso
.enter image description here
的替代品是什么
您可以通过 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();
}
目前,我正在使用 Spring Boot 2.2.5 版本。文档看起来不完整。 @EnableOAuth2Client
或 @EnableOAuth2Sso
.enter image description here
您可以通过 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(); }