From da63ef5b1988c85675d62e853dbce78c163d3736 Mon Sep 17 00:00:00 2001
From: che_shuai <che_shuai@massclouds.com>
Date: 星期五, 22 九月 2023 11:34:10 +0800
Subject: [PATCH] 推流列表-->添加通道 补充播放需要的默认参数  媒体服务器ID,是否本平台推送,是否正在推送(影响播放按钮是否显示)

---
 src/main/java/com/genersoft/iot/vmp/conf/security/JwtAuthenticationFilter.java |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/src/main/java/com/genersoft/iot/vmp/conf/security/JwtAuthenticationFilter.java b/src/main/java/com/genersoft/iot/vmp/conf/security/JwtAuthenticationFilter.java
index 27151ee..f35b5bd 100644
--- a/src/main/java/com/genersoft/iot/vmp/conf/security/JwtAuthenticationFilter.java
+++ b/src/main/java/com/genersoft/iot/vmp/conf/security/JwtAuthenticationFilter.java
@@ -2,6 +2,8 @@
 
 import com.genersoft.iot.vmp.conf.UserSetting;
 import com.genersoft.iot.vmp.conf.security.dto.JwtUser;
+import com.genersoft.iot.vmp.storager.dao.dto.Role;
+import com.genersoft.iot.vmp.storager.dao.dto.User;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
@@ -75,7 +77,13 @@
         }
 
         // 鏋勫缓UsernamePasswordAuthenticationToken,杩欓噷瀵嗙爜涓簄ull锛屾槸鍥犱负鎻愪緵浜嗘纭殑JWT,瀹炵幇鑷姩鐧诲綍
-        UsernamePasswordAuthenticationToken token = new UsernamePasswordAuthenticationToken(username, jwtUser.getPassword(), new ArrayList<>() );
+        User user = new User();
+        user.setUsername(jwtUser.getUserName());
+        user.setPassword(jwtUser.getPassword());
+        Role role = new Role();
+        role.setId(jwtUser.getRoleId());
+        user.setRole(role);
+        UsernamePasswordAuthenticationToken token = new UsernamePasswordAuthenticationToken(user, jwtUser.getPassword(), new ArrayList<>() );
         SecurityContextHolder.getContext().setAuthentication(token);
         chain.doFilter(request, response);
     }

--
Gitblit v1.8.0