From 335916f1f15eb9d0b34dea38cacee2300eac0606 Mon Sep 17 00:00:00 2001
From: 李防 <liguofang0703@126.com>
Date: 星期一, 07 三月 2022 14:20:27 +0800
Subject: [PATCH] InviteRequestProcessor类中,channelid从invite消息的header subject获取,不再从第一行request line获取。原因是和第三方平台对接时,发送的invite消息第一行为国标平台编码而不是设备通道编码,导致报错通道不存在,返回404。

---
 src/main/java/com/genersoft/iot/vmp/conf/security/WebSecurityConfig.java |   24 ++++++++++++++++++++----
 1 files changed, 20 insertions(+), 4 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 aa642c6..f0eca85 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,7 +1,9 @@
 package com.genersoft.iot.vmp.conf.security;
 
+import com.genersoft.iot.vmp.conf.UserSetup;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
 import org.springframework.security.authentication.AuthenticationManager;
@@ -14,6 +16,8 @@
 import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
 import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
 
+import java.util.List;
+
 /**
  * 閰嶇疆Spring Security
  */
@@ -22,8 +26,10 @@
 @EnableGlobalMethodSecurity(prePostEnabled = true)
 public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
 
-    @Value("${userSettings.interfaceAuthentication}")
-    private boolean interfaceAuthentication;
+    private final static Logger logger = LoggerFactory.getLogger(WebSecurityConfig.class);
+
+    @Autowired
+    private UserSetup userSetup;
 
     @Autowired
     private DefaultUserDetailsServiceImpl userDetailsService;
@@ -71,12 +77,13 @@
     @Override
     public void configure(WebSecurity web) {
 
-        if (!interfaceAuthentication) {
+        if (!userSetup.isInterfaceAuthentication()) {
             web.ignoring().antMatchers("**");
         }else {
             // 鍙互鐩存帴璁块棶鐨勯潤鎬佹暟鎹�
             web.ignoring()
                     .antMatchers("/")
+                    .antMatchers("/#/**")
                     .antMatchers("/static/**")
                     .antMatchers("/index.html")
                     .antMatchers("/doc.html") // "/webjars/**", "/swagger-resources/**", "/v3/api-docs/**"
@@ -84,6 +91,15 @@
                     .antMatchers("/swagger-resources/**")
                     .antMatchers("/v3/api-docs/**")
                     .antMatchers("/js/**");
+            List<String> interfaceAuthenticationExcludes = userSetup.getInterfaceAuthenticationExcludes();
+            for (String interfaceAuthenticationExclude : interfaceAuthenticationExcludes) {
+                if (interfaceAuthenticationExclude.split("/").length < 4 ) {
+                    logger.warn("{}涓嶆弧瓒充袱绾х洰褰曪紝宸插拷鐣�", interfaceAuthenticationExclude);
+                }else {
+                    web.ignoring().antMatchers(interfaceAuthenticationExclude);
+                }
+
+            }
         }
     }
 

--
Gitblit v1.8.0