mirror of
https://github.com/dromara/RuoYi-Vue-Plus.git
synced 2025-09-24 07:19:46 +08:00
update 扩展 security 配置属性
This commit is contained in:
@ -109,11 +109,12 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter
|
||||
"/**/*.js"
|
||||
).permitAll()
|
||||
.antMatchers(securityProperties.getAnonymous()).anonymous()
|
||||
.antMatchers(securityProperties.getPermitAll()).permitAll()
|
||||
// 除上面外的所有请求全部需要鉴权认证
|
||||
.anyRequest().authenticated()
|
||||
.and()
|
||||
.headers().frameOptions().disable();
|
||||
httpSecurity.logout().logoutUrl("/logout").logoutSuccessHandler(logoutSuccessHandler);
|
||||
httpSecurity.logout().logoutUrl(securityProperties.getLogoutUrl()).logoutSuccessHandler(logoutSuccessHandler);
|
||||
// 添加JWT filter
|
||||
httpSecurity.addFilterBefore(authenticationTokenFilter, UsernamePasswordAuthenticationFilter.class);
|
||||
// 添加CORS filter
|
||||
|
@ -14,9 +14,19 @@ import org.springframework.stereotype.Component;
|
||||
@ConfigurationProperties(prefix = "security")
|
||||
public class SecurityProperties {
|
||||
|
||||
/**
|
||||
* 退出登录url
|
||||
*/
|
||||
private String logoutUrl;
|
||||
|
||||
/**
|
||||
* 匿名放行路径
|
||||
*/
|
||||
private String[] anonymous;
|
||||
|
||||
/**
|
||||
* 用户任意访问放行路径
|
||||
*/
|
||||
private String[] permitAll;
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user