I am using 5.1.0 not 5.2.2. I had rolledback to 5.1.0 around this time.
The problem still exists in the 5.1.0 code. I resolved by modified the OidcIdTokenGeneratorService to pull the CLAIM_PREFERRED_USERNAME from the TGT:
if (!claims.hasClaim(OidcConstants.CLAIM_PREFERRED_USERNAME)) {
String username = accessTokenId.getGrantingTicket().getAuthentication().getCredentials().get(0).getId();
claims.setClaim(OidcConstants.CLAIM_PREFERRED_USERNAME, username);
}
vs
if (!claims.hasClaim(OidcConstants.CLAIM_PREFERRED_USERNAME)) {
claims.setClaim(OidcConstants.CLAIM_PREFERRED_USERNAME, profile.getId());
}
There were some other calls upstream in the OAuth20AccessTokenEndpointController to get the CLIENT_ID via pac4j. The CLIENT_ID is also available as a request param. Changed calls similar to:
final String clientId = uProfile.getId();
to
final String clientId = request.getParameter(OAuth20Constants.CLIENT_ID);