34 lines
1.1 KiB
Java
34 lines
1.1 KiB
Java
|
package com.cm.inspection.config;
|
||
|
|
||
|
import org.springframework.context.annotation.Configuration;
|
||
|
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
|
||
|
import org.springframework.security.config.http.SessionCreationPolicy;
|
||
|
import org.springframework.security.oauth2.config.annotation.web.configuration.EnableResourceServer;
|
||
|
import org.springframework.security.oauth2.config.annotation.web.configuration.ResourceServerConfigurerAdapter;
|
||
|
|
||
|
/**
|
||
|
* @ClassName: ResourceConfig
|
||
|
* @Description: 资源服务器
|
||
|
* @Author: WangGeng
|
||
|
* @Date: 2019/2/27 11:33 AM
|
||
|
* @Version: 1.0
|
||
|
**/
|
||
|
@Configuration
|
||
|
@EnableResourceServer
|
||
|
public class ResourceConfig extends ResourceServerConfigurerAdapter {
|
||
|
|
||
|
@Override
|
||
|
public void configure(HttpSecurity http) throws Exception {
|
||
|
http
|
||
|
.sessionManagement().sessionCreationPolicy(SessionCreationPolicy.IF_REQUIRED)
|
||
|
.and()
|
||
|
.requestMatchers()
|
||
|
.antMatchers("/resource/**", "/client/**")
|
||
|
.and()
|
||
|
.authorizeRequests()
|
||
|
.antMatchers("/resource/**", "/client/**")
|
||
|
.authenticated();
|
||
|
}
|
||
|
|
||
|
}
|