|
|
|
@ -52,9 +52,10 @@ public class BladeJwtTokenEnhancer implements TokenEnhancer {
|
|
|
|
|
|
|
|
|
|
BladeUserDetails principal = (BladeUserDetails) authentication.getUserAuthentication().getPrincipal(); |
|
|
|
|
|
|
|
|
|
String clientId = TokenUtil.getClientIdFromHeader(); |
|
|
|
|
//token参数增强
|
|
|
|
|
Map<String, Object> info = new HashMap<>(16); |
|
|
|
|
info.put(TokenUtil.CLIENT_ID, TokenUtil.getClientIdFromHeader()); |
|
|
|
|
info.put(TokenUtil.CLIENT_ID, clientId); |
|
|
|
|
info.put(TokenUtil.USER_ID, Func.toStr(principal.getUserId())); |
|
|
|
|
info.put(TokenUtil.DEPT_ID, Func.toStr(principal.getDeptId())); |
|
|
|
|
info.put(TokenUtil.POST_ID, Func.toStr(principal.getPostId())); |
|
|
|
@ -77,12 +78,12 @@ public class BladeJwtTokenEnhancer implements TokenEnhancer {
|
|
|
|
|
String accessTokenValue = oAuth2AccessToken.getValue(); |
|
|
|
|
String tenantId = principal.getTenantId(); |
|
|
|
|
String userId = Func.toStr(principal.getUserId()); |
|
|
|
|
JwtUtil.addAccessToken(tenantId, userId, accessTokenValue, accessToken.getExpiresIn()); |
|
|
|
|
JwtUtil.addAccessToken(tenantId, clientId, userId, accessTokenValue, accessToken.getExpiresIn()); |
|
|
|
|
|
|
|
|
|
if (jwtProperties.getSingle()) { |
|
|
|
|
OAuth2RefreshToken oAuth2RefreshToken = oAuth2AccessToken.getRefreshToken(); |
|
|
|
|
String refreshTokenValue = oAuth2RefreshToken.getValue(); |
|
|
|
|
JwtUtil.addRefreshToken(tenantId, userId, refreshTokenValue, accessToken.getExpiresIn() * 168); |
|
|
|
|
JwtUtil.addRefreshToken(tenantId, clientId, userId, refreshTokenValue, accessToken.getExpiresIn() * 168); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|