获取角色
This commit is contained in:
@@ -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获取在网关中存储的部门索引
|
||||
|
||||
Reference in New Issue
Block a user