我试着重复以下教程:
http://www.baeldung.com/sso-spring-security-oauth2
我有以下依赖关系:
dependencies {
compile('org.springframework.boot:spring-boot-starter-web')
testCompile('org.springframework.boot:spring-boot-starter-test')
compile('org.springframework.boot:spring-boot-starter-security')
compile("org.springframework.security.oauth:spring-security-oauth2:2.3.2.RELEASE")
compile('org.springframework.boot:spring-boot-starter-thymeleaf')
compile('org.thymeleaf.extras:thymeleaf-extras-springsecurity4:2.1.2.RELEASE')
}
我有一节课:
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
@Configuration
@EnableOAuth2Sso
public class UiSecurityConfig extends WebSecurityConfigurerAdapter {
@Override
public void configure(HttpSecurity http) throws Exception {
http.antMatcher("/**")
.authorizeRequests()
.antMatchers("/", "/login**")
.permitAll()
.anyRequest()
.authenticated();
}
}
正如您所看到的,我没有导入@EnableOAuth2Sso
注释。这并不意味着我会自动完成导入。
我做错什么了?
发布于 2018-04-12 13:52:13
我代替了
compile("org.springframework.security.oauth:spring-security-oauth2:2.3.2.RELEASE")
使用
compile ("org.springframework.security.oauth.boot:spring-security-oauth2-autoconfigure:2.0.0.RELEASE")
和想法发现的重要性
https://stackoverflow.com/questions/49798251
复制相似问题