获取角色

This commit is contained in:
huangzj
2023-06-27 15:04:40 +08:00
parent cabede01e6
commit 916b68d307
3 changed files with 15 additions and 1 deletions

View File

@@ -217,6 +217,18 @@ public class RequestUtil {
}
return userIndex;
}
/**
* HttpServletRequest获取在网关中存储的用户角色
*/
public static String getUserRole() {
String userIndex = LogInfo.UNKNOWN_ROLE;
JSONObject jwtPayload = getJwtPayload();
if (Objects.nonNull(jwtPayload)) {
userIndex = jwtPayload.getString(SecurityConstants.JWT_AUTHORITIES_KEY);
}
return userIndex;
}
/**
* HttpServletRequest获取在网关中存储的部门索引