<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-oauth2</artifactId>
</dependency>
@Configuration
@EnableOAuth2Sso
public class SecurityConfig extends WebSecurityConfigurerAdapter {
/**
* Configure.
*
* @param http the http
*
* @throws Exception the exception
*/
@Override
protected void configure(HttpSecurity http) throws Exception {
//禁止CRRF攻击
http.csrf().disable();
//允许ifarme内嵌
http.headers().frameOptions().disable();
}
}
启动类
@EnableOAuth2Sso
public class GatewayApplication