优化配置文件
This commit is contained in:
parent
06a5136b1a
commit
3f632afe34
|
@ -0,0 +1,21 @@
|
||||||
|
package net.maku.framework.security.config;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 允许访问的资源
|
||||||
|
*
|
||||||
|
* @author 阿沐 babamu@126.com
|
||||||
|
*/
|
||||||
|
public class PermitResource {
|
||||||
|
/**
|
||||||
|
* 指定被 spring security oauth2.0 忽略的URL
|
||||||
|
*/
|
||||||
|
public static final String [] IGNORING_URLS = {
|
||||||
|
"/actuator/**",
|
||||||
|
"/v3/api-docs/**",
|
||||||
|
"/webjars/**",
|
||||||
|
"/swagger/**",
|
||||||
|
"/swagger-resources/**",
|
||||||
|
"/doc.html",
|
||||||
|
"/oauth/captcha"
|
||||||
|
};
|
||||||
|
}
|
|
@ -35,11 +35,8 @@ public class ResourceServerConfig extends ResourceServerConfigurerAdapter {
|
||||||
http
|
http
|
||||||
.sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS)
|
.sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS)
|
||||||
.and()
|
.and()
|
||||||
.requestMatchers()
|
|
||||||
// 被保护的资源
|
|
||||||
.antMatchers("/sys/**")
|
|
||||||
.and()
|
|
||||||
.authorizeRequests()
|
.authorizeRequests()
|
||||||
|
.antMatchers(PermitResource.IGNORING_URLS).permitAll()
|
||||||
.anyRequest().authenticated()
|
.anyRequest().authenticated()
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user