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

LPD-33798 Remove 'emails' from the Claims because it does not arrive at all #153915 #6048

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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 @@ -143,8 +143,7 @@ public void processAuthenticationResponse(

if (oidcProviderMetadata.getUserInfoEndpointURI() == null) {
UserInfo userInfo = new UserInfo(
JWTClaimsSet.parse(
_getUserInfoClaims(oidcTokens.getIDToken())));
JWTClaimsSet.parse(getUserInfoClaims(oidcTokens.getIDToken())));

userInfoJSON = userInfo.toJSONString();
}
Expand Down Expand Up @@ -262,6 +261,20 @@ public void requestAuthentication(
httpServletRequest, httpServletResponse);
}

protected Map<String, Object> getUserInfoClaims(JWT jwt)
throws java.text.ParseException {

JWTClaimsSet jwtClaimsSet = jwt.getJWTClaimsSet();

Map<String, Object> claims = jwtClaimsSet.toJSONObject();

claims.put("email", jwtClaimsSet.getStringClaim("email"));
claims.put("family_name", jwtClaimsSet.getStringClaim("family_name"));
claims.put("given_name", jwtClaimsSet.getStringClaim("given_name"));

return claims;
}

private URI _getAuthenticationRequestURI(
URI authenticationEndpointURI,
String authenticationRequestParametersJSON, String clientId,
Expand Down Expand Up @@ -384,20 +397,6 @@ private URI _getLoginRedirectURI(HttpServletRequest httpServletRequest) {
}
}

private Map<String, Object> _getUserInfoClaims(JWT jwt)
throws java.text.ParseException {

JWTClaimsSet jwtClaimsSet = jwt.getJWTClaimsSet();

Map<String, Object> claims = jwtClaimsSet.toJSONObject();

claims.put("email", jwtClaimsSet.getStringClaim("email"));
claims.put("family_name", jwtClaimsSet.getStringClaim("family_name"));
claims.put("given_name", jwtClaimsSet.getStringClaim("given_name"));

return claims;
}

private String _requestUserInfoJSON(
AccessToken accessToken, OIDCProviderMetadata oidcProviderMetadata)
throws OpenIdConnectServiceException.UserInfoException {
Expand Down