Browse Source

change auth

tycoding 1 year ago
parent
commit
456e9dfe09

+ 6 - 4
langchat-auth/src/main/java/cn/tycoding/langchat/auth/config/AuthConfiguration.java

@@ -9,9 +9,11 @@ import cn.dev33.satoken.stp.StpUtil;
 import cn.tycoding.langchat.auth.event.LogEvent;
 import cn.tycoding.langchat.auth.utils.SysLogUtil;
 import cn.tycoding.langchat.common.component.SpringContextHolder;
+import cn.tycoding.langchat.common.exception.ServiceException;
 import cn.tycoding.langchat.common.properties.AuthProps;
 import cn.tycoding.langchat.common.utils.R;
 import cn.tycoding.langchat.upms.entity.SysLog;
+import cn.tycoding.langchat.upms.utils.AuthUtil;
 import com.alibaba.fastjson.JSON;
 import lombok.AllArgsConstructor;
 import org.springframework.context.annotation.Bean;
@@ -71,9 +73,9 @@ public class AuthConfiguration {
     private void hasAuth() {
         StpUtil.checkLogin();
 
-//        // 演示环境禁用操作
-//        if (authProps.getIsDemoEnv() && AuthUtil.getRoleNames().contains(AuthUtil.DEMO_ENV)) {
-//            throw new ServiceException("演示环境,请勿操作");
-//        }
+        // 演示环境禁用操作
+        if (authProps.getIsDemoEnv() && AuthUtil.getRoleNames().contains(AuthUtil.DEMO_ENV)) {
+            throw new ServiceException("演示环境,请勿操作");
+        }
     }
 }

+ 0 - 10
langchat-common/src/main/java/cn/tycoding/langchat/common/constant/AuthConst.java

@@ -6,16 +6,6 @@ package cn.tycoding.langchat.common.constant;
  */
 public interface AuthConst {
 
-    /**
-     * 角色前缀名
-     */
-    String ROLE_PREFIX = "ROLE_PREFIX_";
-
-    /**
-     * 角色后缀名
-     */
-    String ROLE_SUFFIX = "_ROLE_SUFFIX_";
-
     /**
      * 默认密码(重置密码)
      */

+ 3 - 0
langchat-common/src/main/java/cn/tycoding/langchat/common/constant/CacheConst.java

@@ -26,6 +26,9 @@ public interface CacheConst {
      */
     String AUTH_USER_INFO_KEY = "USER_INFO";
 
+    /**
+     * Auth Token缓存变量前缀
+     */
     String AUTH_TOKEN_INFO_KEY = "TOKEN_INFO";
 
     /**

+ 0 - 5
langchat-common/src/main/java/cn/tycoding/langchat/common/constant/CommonConst.java

@@ -11,11 +11,6 @@ public interface CommonConst {
      */
     String UTF_8 = "utf-8";
 
-    /**
-     * JSON 请求响应格式
-     */
-    String CONTENT_TYPE = "application/json; charset=utf-8";
-
     /**
      * 菜单类型:menu
      */

+ 1 - 2
langchat-server/src/main/resources/application-dev.yml

@@ -27,6 +27,5 @@ langchat:
   auth:
     admin-name: administrator
     admin-pass: 123456
-  log:
-    api-enable: false
+    is-demo-env: true
 

File diff suppressed because it is too large
+ 58 - 38
langchat.sql


Some files were not shown because too many files changed in this diff