Browse Source

权限公共模块改造01

master
caojianbin 2 years ago
parent
commit
f92c362483
  1. 6
      ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/context/SecurityContextHolder.java
  2. 3
      ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/utils/JwtUtils.java

6
ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/context/SecurityContextHolder.java

@ -56,6 +56,12 @@ public class SecurityContextHolder
return Convert.toLong(get(SecurityConstants.DETAILS_USER_ID), 0L); return Convert.toLong(get(SecurityConstants.DETAILS_USER_ID), 0L);
} }
public static String getStringUserId()
{
return Convert.toStr(get(SecurityConstants.DETAILS_USER_ID),"");
}
public static void setUserId(String account) public static void setUserId(String account)
{ {
set(SecurityConstants.DETAILS_USER_ID, account); set(SecurityConstants.DETAILS_USER_ID, account);

3
ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/utils/JwtUtils.java

@ -15,7 +15,8 @@ import io.jsonwebtoken.SignatureAlgorithm;
*/ */
public class JwtUtils public class JwtUtils
{ {
public static String secret = TokenConstants.SECRET; // public static String secret = TokenConstants.SECRET;
public final static String secret ="yisaichangsha";//先写死,后面配置文件配置
/** /**
* 从数据声明生成令牌 * 从数据声明生成令牌

Loading…
Cancel
Save