因为应用管理的认证也在网关做了,所以uaa不需要作为资源服务器了
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
package com.central.oauth.config;
|
package com.central.oauth.config;
|
||||||
|
|
||||||
import com.central.oauth.service.impl.RedisClientDetailsService;
|
import com.central.oauth.service.impl.RedisClientDetailsService;
|
||||||
|
import com.central.oauth2.common.annotation.EnableTokenStore;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
|
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
@@ -29,6 +30,7 @@ import java.util.Arrays;
|
|||||||
*/
|
*/
|
||||||
@Configuration
|
@Configuration
|
||||||
@EnableAuthorizationServer
|
@EnableAuthorizationServer
|
||||||
|
@EnableTokenStore
|
||||||
@AutoConfigureAfter(AuthorizationServerEndpointsConfigurer.class)
|
@AutoConfigureAfter(AuthorizationServerEndpointsConfigurer.class)
|
||||||
public class AuthorizationServerConfig extends AuthorizationServerConfigurerAdapter {
|
public class AuthorizationServerConfig extends AuthorizationServerConfigurerAdapter {
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,35 +0,0 @@
|
|||||||
package com.central.oauth.config;
|
|
||||||
|
|
||||||
import com.central.oauth2.common.annotation.EnableTokenStore;
|
|
||||||
import com.central.oauth2.common.properties.SecurityProperties;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.context.annotation.Configuration;
|
|
||||||
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
|
|
||||||
import org.springframework.security.oauth2.config.annotation.web.configuration.EnableResourceServer;
|
|
||||||
import org.springframework.security.oauth2.config.annotation.web.configuration.ResourceServerConfigurerAdapter;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 资源服务器配置
|
|
||||||
*
|
|
||||||
* @author zlt
|
|
||||||
* @date 2018/10/27
|
|
||||||
*/
|
|
||||||
@Configuration
|
|
||||||
@EnableResourceServer
|
|
||||||
@EnableTokenStore
|
|
||||||
public class ResourceServerConfiguration extends ResourceServerConfigurerAdapter {
|
|
||||||
@Autowired
|
|
||||||
private SecurityProperties securityProperties;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void configure(HttpSecurity http) throws Exception {
|
|
||||||
//允许使用iframe 嵌套,避免swagger-ui 不被加载的问题
|
|
||||||
http.headers().frameOptions().disable()
|
|
||||||
.and()
|
|
||||||
.requestMatcher(request -> false)
|
|
||||||
.authorizeRequests()
|
|
||||||
.antMatchers(securityProperties.getIgnore().getUrls()).permitAll()
|
|
||||||
.anyRequest()
|
|
||||||
.authenticated();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user