mirror of
				https://github.com/dromara/RuoYi-Vue-Plus.git
				synced 2025-11-04 16:23:42 +08:00 
			
		
		
		
	update 扩展 security 配置属性
This commit is contained in:
		@@ -108,6 +108,9 @@ token:
 | 
			
		||||
 | 
			
		||||
# security配置
 | 
			
		||||
security:
 | 
			
		||||
  # 登出路径
 | 
			
		||||
  logout-url: /logout
 | 
			
		||||
  # 匿名路径
 | 
			
		||||
  anonymous:
 | 
			
		||||
    - /login
 | 
			
		||||
    - /register
 | 
			
		||||
@@ -122,6 +125,8 @@ security:
 | 
			
		||||
    # actuator 监控配置
 | 
			
		||||
    - /actuator
 | 
			
		||||
    - /actuator/**
 | 
			
		||||
  # 用户放行
 | 
			
		||||
  permit-all:
 | 
			
		||||
 | 
			
		||||
# 重复提交
 | 
			
		||||
repeat-submit:
 | 
			
		||||
 
 | 
			
		||||
@@ -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