Skip to content

Commit

Permalink
Merge pull request #2231 from thanujalk/master
Browse files Browse the repository at this point in the history
Fix SessionDataKeyConsent null issue
  • Loading branch information
thanujalk authored Oct 28, 2023
2 parents 9369b26 + 06852a8 commit a64fc95
Showing 1 changed file with 17 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ public List<String> validateScope(OAuthAuthzReqMessageContext authzReqMessageCon
}
List<String> authorizedScopes = getAuthorizedScopes(requestedScopes, authzReqMessageContext
.getAuthorizationReqDTO().getUser(), appId, null, tenantDomain);
handleInternalLoginScope(requestedScopes, authorizedScopes);
removeRegisteredScopes(authzReqMessageContext);
return authorizedScopes;
}
Expand Down Expand Up @@ -129,7 +130,8 @@ public List<String> validateScope(OAuthTokenReqMessageContext tokenReqMessageCon
List<String> authorizedScopes = getAuthorizedScopes(requestedScopes, tokenReqMessageContext
.getAuthorizedUser(), appId, grantType, tenantDomain);
removeRegisteredScopes(tokenReqMessageContext);
if (OAuthConstants.GrantTypes.CLIENT_CREDENTIALS.equals(grantType) && authorizedScopes.contains(SYSTEM_SCOPE)) {
handleInternalLoginScope(requestedScopes, authorizedScopes);
if (OAuthConstants.GrantTypes.CLIENT_CREDENTIALS.equals(grantType)) {
authorizedScopes.remove(INTERNAL_LOGIN_SCOPE);
}
return authorizedScopes;
Expand Down Expand Up @@ -413,4 +415,18 @@ private String resolveOrgIdByTenantDomain(String tenantDomain) throws IdentityOA
}
}

/**
* This is to persist the previous behaviour with the "internal_login" scope.
*
* @param requestedScopes requested scopes.
* @param authorizedScopes authorized scopes.
*/
private static void handleInternalLoginScope(List<String> requestedScopes, List<String> authorizedScopes) {

if ((requestedScopes.contains(SYSTEM_SCOPE) || requestedScopes.contains(INTERNAL_LOGIN_SCOPE))
&& !authorizedScopes.contains(INTERNAL_LOGIN_SCOPE)) {
authorizedScopes.add(INTERNAL_LOGIN_SCOPE);
}
}

}

0 comments on commit a64fc95

Please sign in to comment.