update 扩展 security 配置属性
This commit is contained in:
parent
369438a46d
commit
bcac70b2ab
@ -108,6 +108,9 @@ token:
|
|||||||
|
|
||||||
# security配置
|
# security配置
|
||||||
security:
|
security:
|
||||||
|
# 登出路径
|
||||||
|
logout-url: /logout
|
||||||
|
# 匿名路径
|
||||||
anonymous:
|
anonymous:
|
||||||
- /login
|
- /login
|
||||||
- /register
|
- /register
|
||||||
@ -122,6 +125,8 @@ security:
|
|||||||
# actuator 监控配置
|
# actuator 监控配置
|
||||||
- /actuator
|
- /actuator
|
||||||
- /actuator/**
|
- /actuator/**
|
||||||
|
# 用户放行
|
||||||
|
permit-all:
|
||||||
|
|
||||||
# 重复提交
|
# 重复提交
|
||||||
repeat-submit:
|
repeat-submit:
|
||||||
|
@ -109,11 +109,12 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter
|
|||||||
"/**/*.js"
|
"/**/*.js"
|
||||||
).permitAll()
|
).permitAll()
|
||||||
.antMatchers(securityProperties.getAnonymous()).anonymous()
|
.antMatchers(securityProperties.getAnonymous()).anonymous()
|
||||||
|
.antMatchers(securityProperties.getPermitAll()).permitAll()
|
||||||
// 除上面外的所有请求全部需要鉴权认证
|
// 除上面外的所有请求全部需要鉴权认证
|
||||||
.anyRequest().authenticated()
|
.anyRequest().authenticated()
|
||||||
.and()
|
.and()
|
||||||
.headers().frameOptions().disable();
|
.headers().frameOptions().disable();
|
||||||
httpSecurity.logout().logoutUrl("/logout").logoutSuccessHandler(logoutSuccessHandler);
|
httpSecurity.logout().logoutUrl(securityProperties.getLogoutUrl()).logoutSuccessHandler(logoutSuccessHandler);
|
||||||
// 添加JWT filter
|
// 添加JWT filter
|
||||||
httpSecurity.addFilterBefore(authenticationTokenFilter, UsernamePasswordAuthenticationFilter.class);
|
httpSecurity.addFilterBefore(authenticationTokenFilter, UsernamePasswordAuthenticationFilter.class);
|
||||||
// 添加CORS filter
|
// 添加CORS filter
|
||||||
|
@ -14,9 +14,19 @@ import org.springframework.stereotype.Component;
|
|||||||
@ConfigurationProperties(prefix = "security")
|
@ConfigurationProperties(prefix = "security")
|
||||||
public class SecurityProperties {
|
public class SecurityProperties {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 退出登录url
|
||||||
|
*/
|
||||||
|
private String logoutUrl;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 匿名放行路径
|
* 匿名放行路径
|
||||||
*/
|
*/
|
||||||
private String[] anonymous;
|
private String[] anonymous;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户任意访问放行路径
|
||||||
|
*/
|
||||||
|
private String[] permitAll;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user