use of io.jans.as.server.model.authorize.JwtAuthorizationRequest in project jans by JanssenProject.
the class IdTokenFactory method setClaimsFromJwtAuthorizationRequest.
private void setClaimsFromJwtAuthorizationRequest(JsonWebResponse jwr, IAuthorizationGrant authorizationGrant, Set<String> scopes) throws InvalidClaimException {
final JwtAuthorizationRequest requestObject = authorizationGrant.getJwtAuthorizationRequest();
if (requestObject == null || requestObject.getIdTokenMember() == null) {
return;
}
for (Claim claim : requestObject.getIdTokenMember().getClaims()) {
// ClaimValueType.OPTIONAL.equals(claim.getClaimValue().getClaimValueType());
boolean optional = true;
GluuAttribute gluuAttribute = attributeService.getByClaimName(claim.getName());
if (gluuAttribute == null) {
continue;
}
Client client = authorizationGrant.getClient();
if (validateRequesteClaim(gluuAttribute, client.getClaims(), scopes)) {
String ldapClaimName = gluuAttribute.getName();
Object attribute = authorizationGrant.getUser().getAttribute(ldapClaimName, optional, gluuAttribute.getOxMultiValuedAttribute());
jwr.getClaims().setClaimFromJsonObject(claim.getName(), attribute);
}
}
}
Aggregations