Skip to content

Commit

Permalink
Merge pull request #41 from Akila94/refresh-token-validity-period-issue
Browse files Browse the repository at this point in the history
Fix refresh token validity period issue
  • Loading branch information
imesh94 authored Nov 8, 2024
2 parents e4d3d74 + f88861c commit 052671c
Showing 1 changed file with 16 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ public void publishUserAccessTokenData(OAuth2AccessTokenRespDTO oAuth2AccessToke
* @return
*/
@Override
public boolean issueRefreshToken() throws IdentityOAuth2Exception {
public OAuth2AccessTokenRespDTO issue(OAuthTokenReqMessageContext tokReqMsgCtx) throws IdentityOAuth2Exception {

OAuthTokenReqMessageContext tokenReqMessageContext = getTokenMessageContext();

Expand All @@ -124,10 +124,21 @@ public boolean issueRefreshToken() throws IdentityOAuth2Exception {
if (log.isDebugEnabled()) {
log.debug("Refresh token validity period is set to: " + sharingDuration);
}
// do not issue refresh token if sharing duration value equals to zero
if (sharingDuration == 0) {
return false;
}

}
return super.issue(tokReqMsgCtx);
}

@Override
public boolean issueRefreshToken() throws IdentityOAuth2Exception {

OAuthTokenReqMessageContext tokenReqMessageContext = getTokenMessageContext();
if (isRegulatory(tokenReqMessageContext)) {
long sharingDuration;
String[] scopes = tokenReqMessageContext.getScope();
String consentId = CDSIdentityUtil.getConsentId(scopes);
sharingDuration = CDSIdentityUtil.getRefreshTokenValidityPeriod(consentId);
return sharingDuration != 0;
}
return true;
}
Expand Down

0 comments on commit 052671c

Please sign in to comment.