Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix refresh token validity period issue #41

Merged
merged 1 commit into from
Nov 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading