From ec90519c90925accf157434130bcf4ac7958c17d Mon Sep 17 00:00:00 2001 From: 648540858 <648540858@qq.com> Date: 星期三, 08 三月 2023 16:57:07 +0800 Subject: [PATCH] 添加设备离线原因 --- src/main/java/com/genersoft/iot/vmp/conf/security/WebSecurityConfig.java | 22 +++++++++++++++------- 1 files changed, 15 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/genersoft/iot/vmp/conf/security/WebSecurityConfig.java b/src/main/java/com/genersoft/iot/vmp/conf/security/WebSecurityConfig.java index 47cfdab..cce0d11 100644 --- a/src/main/java/com/genersoft/iot/vmp/conf/security/WebSecurityConfig.java +++ b/src/main/java/com/genersoft/iot/vmp/conf/security/WebSecurityConfig.java @@ -1,6 +1,7 @@ package com.genersoft.iot.vmp.conf.security; import com.genersoft.iot.vmp.conf.UserSetting; +import org.junit.jupiter.api.Order; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -20,10 +21,12 @@ /** * 閰嶇疆Spring Security + * @author lin */ @Configuration @EnableWebSecurity @EnableGlobalMethodSecurity(prePostEnabled = true) +@Order(1) public class WebSecurityConfig extends WebSecurityConfigurerAdapter { private final static Logger logger = LoggerFactory.getLogger(WebSecurityConfig.class); @@ -90,6 +93,7 @@ .antMatchers("/webjars/**") .antMatchers("/swagger-resources/**") .antMatchers("/v3/api-docs/**") + .antMatchers("/favicon.ico") .antMatchers("/js/**"); List<String> interfaceAuthenticationExcludes = userSetting.getInterfaceAuthenticationExcludes(); for (String interfaceAuthenticationExclude : interfaceAuthenticationExcludes) { @@ -132,15 +136,19 @@ .anyRequest().authenticated() // 寮傚父澶勭悊(鏉冮檺鎷掔粷銆佺櫥褰曞け鏁堢瓑) .and().exceptionHandling() - .authenticationEntryPoint(anonymousAuthenticationEntryPoint)//鍖垮悕鐢ㄦ埛璁块棶鏃犳潈闄愯祫婧愭椂鐨勫紓甯稿鐞� + //鍖垮悕鐢ㄦ埛璁块棶鏃犳潈闄愯祫婧愭椂鐨勫紓甯稿鐞� + .authenticationEntryPoint(anonymousAuthenticationEntryPoint) // .accessDeniedHandler(accessDeniedHandler)//鐧诲綍鐢ㄦ埛娌℃湁鏉冮檺璁块棶璧勬簮 - // 鐧诲叆 - .and().formLogin().permitAll()//鍏佽鎵�鏈夌敤鎴� - .successHandler(loginSuccessHandler)//鐧诲綍鎴愬姛澶勭悊閫昏緫 - .failureHandler(loginFailureHandler)//鐧诲綍澶辫触澶勭悊閫昏緫 + // 鐧诲叆 鍏佽鎵�鏈夌敤鎴� + .and().formLogin().permitAll() + //鐧诲綍鎴愬姛澶勭悊閫昏緫 + .successHandler(loginSuccessHandler) + //鐧诲綍澶辫触澶勭悊閫昏緫 + .failureHandler(loginFailureHandler) // 鐧诲嚭 - .and().logout().logoutUrl("/api/user/logout").permitAll()//鍏佽鎵�鏈夌敤鎴� - .logoutSuccessHandler(logoutHandler)//鐧诲嚭鎴愬姛澶勭悊閫昏緫 + .and().logout().logoutUrl("/api/user/logout").permitAll() + //鐧诲嚭鎴愬姛澶勭悊閫昏緫 + .logoutSuccessHandler(logoutHandler) .deleteCookies("JSESSIONID") // 浼氳瘽绠$悊 // .and().sessionManagement().invalidSessionStrategy(invalidSessionHandler) // 瓒呮椂澶勭悊 -- Gitblit v1.8.0