疯狂的狮子li
2021-10-20 aaa15b403a89490a33a45d68c8b7cfa34d87b175
ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java
@@ -21,7 +21,7 @@
/**
 * spring security配置
 *
 *
 * @author ruoyi
 */
@EnableGlobalMethodSecurity(prePostEnabled = true, securedEnabled = true)
@@ -32,7 +32,7 @@
     */
    @Autowired
    private UserDetailsService userDetailsService;
    /**
     * 认证失败处理类
     */
@@ -50,7 +50,7 @@
     */
    @Autowired
    private JwtAuthenticationTokenFilter authenticationTokenFilter;
    /**
     * 跨域过滤器
     */
@@ -109,11 +109,12 @@
                        "/**/*.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