Source:
<code>public OAuth2AccessToken enhance(OAuth2AccessToken accessToken, OAuth2Authentication authentication) { Map<String, String> params = authentication.getOAuth2Request().getRequestParameters(); String scopes = params.get(OrcidOauth2Constants.SCOPE_PARAM); if (PojoUtil.isEmpty(scopes) || !ScopePathType.getScopesFromSpaceSeparatedString(scopes).contains(ScopePathType.OPENID)) { return accessToken; } try { String orcid = authentication.getName(); Builder claims = new JWTClaimsSet.Builder(); claims.audience(params.get(OrcidOauth2Constants.CLIENT_ID_PARAM)); claims.issuer(path); <START> claims.subject(orcid); <END> claims.claim("at_hash", createAccessTokenHash(accessToken.getValue())); Date now = new Date(); claims.expirationTime(new Date(now.getTime() + 600000)); claims.issueTime(now); claims.jwtID(UUID.randomUUID().toString()); if (params.get(OrcidOauth2Constants.NONCE) != null) claims.claim(OrcidOauth2Constants.NONCE, params.get(OrcidOauth2Constants.NONCE)); claims.claim(OrcidOauth2Constants.AUTH_TIME, profileEntityManager.getLastLogin(orcid)); Person person = personDetailsManagerReadOnly.getPublicPersonDetails(orcid); if (person.getName() != null) { if (person.getName().getCreditName() != null) { claims.claim("name", person.getName().getCreditName().getContent()); } if (person.getName().getFamilyName() != null) { claims.claim("family_name", person.getName().getFamilyName().getContent()); } if (person.getName().getGivenNames() != null) { claims.claim("given_name", person.getName().getGivenNames().getContent()); } } SignedJWT signedJWT = keyManager.sign(claims.build()); String idTok = signedJWT.serialize(); accessToken.getAdditionalInformation().put(OrcidOauth2Constants.ID_TOKEN, idTok); } catch (JOSEException e) { e.printStackTrace(); } catch (Exception e) { e.printStackTrace(); } return accessToken; }</code><technical_language>needs a togglz</technical_language>

Target:
public OAuth2AccessToken enhance(OAuth2AccessToken accessToken, OAuth2Authentication authentication) { Map<String, String> params = authentication.getOAuth2Request().getRequestParameters(); String scopes = params.get(OrcidOauth2Constants.SCOPE_PARAM); if (PojoUtil.isEmpty(scopes) || !ScopePathType.getScopesFromSpaceSeparatedString(scopes).contains(ScopePathType.OPENID)) { return accessToken; } try { String orcid = authentication.getName(); Builder claims = new JWTClaimsSet.Builder(); claims.audience(params.get(OrcidOauth2Constants.CLIENT_ID_PARAM)); if (Features.OPENID_SIMPLE_SUBJECT.isActive()){ claims.subject(orcid); }else{ claims.subject("<LINK_0>"+"/"+orcid); claims.claim("id_path", orcid); } claims.issuer(path); claims.claim("at_hash", createAccessTokenHash(accessToken.getValue())); Date now = new Date(); claims.expirationTime(new Date(now.getTime() + 600000)); claims.issueTime(now); claims.jwtID(UUID.randomUUID().toString()); if (params.get(OrcidOauth2Constants.NONCE) != null) claims.claim(OrcidOauth2Constants.NONCE, params.get(OrcidOauth2Constants.NONCE)); claims.claim(OrcidOauth2Constants.AUTH_TIME, profileEntityManager.getLastLogin(orcid)); Person person = personDetailsManagerReadOnly.getPublicPersonDetails(orcid); if (person.getName() != null) { if (person.getName().getCreditName() != null) { claims.claim("name", person.getName().getCreditName().getContent()); } if (person.getName().getFamilyName() != null) { claims.claim("family_name", person.getName().getFamilyName().getContent()); } if (person.getName().getGivenNames() != null) { claims.claim("given_name", person.getName().getGivenNames().getContent()); } } SignedJWT signedJWT = keyManager.sign(claims.build()); String idTok = signedJWT.serialize(); accessToken.getAdditionalInformation().put(OrcidOauth2Constants.ID_TOKEN, idTok); } catch (JOSEException e) { e.printStackTrace(); } catch (Exception e) { e.printStackTrace(); } return accessToken; }