Skip to content

Commit

Permalink
Changes in this commit:
Browse files Browse the repository at this point in the history
  * Fixes for issue #1325
  • Loading branch information
uprightech committed Apr 26, 2020
1 parent 30b9c79 commit 6f67d9c
Showing 1 changed file with 8 additions and 3 deletions.
Expand Up @@ -364,7 +364,8 @@ public String getJSonResponse(User user, AuthorizationGrant authorizationGrant,
}
}

jsonWebResponse.getClaims().setSubjectIdentifier(authorizationGrant.getUser().getAttribute("inum"));
if(authorizationGrant.getAuthorizationGrantType()!=AuthorizationGrantType.RESOURCE_OWNER_PASSWORD_CREDENTIALS)
jsonWebResponse.getClaims().setSubjectIdentifier(authorizationGrant.getUser().getAttribute("inum"));
}

if (authorizationGrant.getClaims() != null) {
Expand Down Expand Up @@ -435,7 +436,8 @@ public String getJSonResponse(User user, AuthorizationGrant authorizationGrant,
}

// Check for Subject Identifier Type
if (authorizationGrant.getClient().getSubjectType() != null &&
if (authorizationGrant.getAuthorizationGrantType() != AuthorizationGrantType.RESOURCE_OWNER_PASSWORD_CREDENTIALS &&
authorizationGrant.getClient().getSubjectType() != null &&
SubjectType.fromString(authorizationGrant.getClient().getSubjectType()).equals(SubjectType.PAIRWISE) &&
(StringUtils.isNotBlank(authorizationGrant.getClient().getSectorIdentifierUri()) || authorizationGrant.getClient().getRedirectUris() != null)) {
String sectorIdentifierUri = null;
Expand All @@ -458,7 +460,7 @@ public String getJSonResponse(User user, AuthorizationGrant authorizationGrant,
pairwiseIdentifierService.addPairwiseIdentifier(userInum, pairwiseIdentifier);
}
jsonWebResponse.getClaims().setSubjectIdentifier(pairwiseIdentifier.getId());
} else {
} else if( authorizationGrant.getAuthorizationGrantType() != AuthorizationGrantType.RESOURCE_OWNER_PASSWORD_CREDENTIALS){
if (authorizationGrant.getClient().getSubjectType() != null && SubjectType.fromString(authorizationGrant.getClient().getSubjectType()).equals(SubjectType.PAIRWISE)) {
log.warn("Unable to calculate the pairwise subject identifier because the client hasn't a redirect uri. A public subject identifier will be used instead.");
}
Expand All @@ -468,6 +470,9 @@ public String getJSonResponse(User user, AuthorizationGrant authorizationGrant,
subValue = authorizationGrant.getUser().getUserId();
}
jsonWebResponse.getClaims().setSubjectIdentifier(subValue);
}else {
String userid = authorizationGrant.getUser().getUserId();
jsonWebResponse.getClaims().setSubjectIdentifier(userid);
}

if ((dynamicScopes.size() > 0) && externalDynamicScopeService.isEnabled()) {
Expand Down

0 comments on commit 6f67d9c

Please sign in to comment.