mirror of
https://gitee.com/fujieid/jap.git
synced 2024-11-30 02:27:34 +08:00
🐛 fix: cannot refresh token
This commit is contained in:
parent
d613fede17
commit
baee61242e
@ -193,7 +193,7 @@ public class IdsTokenProvider {
|
||||
|
||||
UserInfo user = JapIds.getContext().getUserService().getById(token.getUserId());
|
||||
|
||||
long expiresIn = OauthUtil.getRefreshTokenExpiresIn(clientDetail.getRefreshTokenExpiresIn());
|
||||
long expiresIn = OauthUtil.getAccessTokenExpiresIn(clientDetail.getAccessTokenExpiresIn());
|
||||
|
||||
AccessToken accessToken = TokenUtil.refreshAccessToken(user, clientDetail, token, param.getNonce(), EndpointUtil.getIssuer(request));
|
||||
return new IdsResponse<String, Object>()
|
||||
|
@ -109,7 +109,7 @@ public class TokenUtil {
|
||||
String clientId = clientDetail.getClientId();
|
||||
|
||||
long accessTokenExpiresIn = OauthUtil.getAccessTokenExpiresIn(clientDetail.getAccessTokenExpiresIn());
|
||||
long refreshTokenExpiresIn = OauthUtil.getAccessTokenExpiresIn(clientDetail.getRefreshTokenExpiresIn());
|
||||
long refreshTokenExpiresIn = OauthUtil.getRefreshTokenExpiresIn(clientDetail.getRefreshTokenExpiresIn());
|
||||
|
||||
String accessTokenStr = JwtUtil.createJwtToken(clientId, user, accessTokenExpiresIn, nonce, issuer);
|
||||
String refreshTokenStr = SecureUtil.sha256(clientId.concat(scope).concat(System.currentTimeMillis() + ""));
|
||||
@ -140,14 +140,15 @@ public class TokenUtil {
|
||||
|
||||
public static AccessToken refreshAccessToken(UserInfo user, ClientDetail clientDetail, AccessToken accessToken, String nonce, String issuer) {
|
||||
String rawToken = accessToken.getAccessToken();
|
||||
String accessTokenStr = JwtUtil.createJwtToken(clientDetail.getClientId(), user, clientDetail.getAccessTokenExpiresIn(), nonce, issuer);
|
||||
Long accessTokenExpiresIn = OauthUtil.getAccessTokenExpiresIn(clientDetail.getAccessTokenExpiresIn());
|
||||
String accessTokenStr = JwtUtil.createJwtToken(clientDetail.getClientId(), user, accessTokenExpiresIn, nonce, issuer);
|
||||
accessToken.setAccessToken(accessTokenStr);
|
||||
accessToken.setAccessTokenExpiresIn(clientDetail.getAccessTokenExpiresIn());
|
||||
accessToken.setAccessTokenExpiresIn(accessTokenExpiresIn);
|
||||
|
||||
accessToken.setAccessTokenExpiration(OauthUtil.getAccessTokenExpiresAt(clientDetail.getAccessTokenExpiresIn()));
|
||||
accessToken.setAccessTokenExpiration(OauthUtil.getAccessTokenExpiresAt(accessTokenExpiresIn));
|
||||
|
||||
String tokenCacheKey = IdsConsts.OAUTH_ACCESS_TOKEN_CACHE_KEY + accessTokenStr;
|
||||
JapIds.getContext().getCache().set(tokenCacheKey, accessTokenStr, clientDetail.getAccessTokenExpiresIn() * 1000);
|
||||
JapIds.getContext().getCache().set(tokenCacheKey, accessTokenStr, accessTokenExpiresIn * 1000);
|
||||
|
||||
String rawTokenCacheKey = IdsConsts.OAUTH_ACCESS_TOKEN_CACHE_KEY + rawToken;
|
||||
JapIds.getContext().getCache().removeKey(rawTokenCacheKey);
|
||||
|
Loading…
Reference in New Issue
Block a user