Hard to get IDTokenClaimsSet from JWT

Issue #99 resolved
Pétur Runólfsson created an issue

The OIDCAccessTokenResponse.getIDToken() and AuthenticationRequest.getIDTokenHint() methods both return an ID token as a JWT. The best way to read the claims from an ID token seems to be to convert it to an IDTokenClaimsSet, but the code to do this is rather obtuse:

      JWT jwt = foo();
      IDTokenClaimsSet claims = new IDTokenClaimsSet(new JWTClaimsSet(jwt.getJWTClaimsSet()));

The new JWTClaimsSet is needed because getJWTClaimsSet() returns a ReadOnlyJWTClaimsSet, while the IDTokenClaimsSet constructor requires an JWTClaimsSet.

The constructor IDTokenClaimsSet(final JWTClaimsSet jwtClaimsSet) simply invokes the toJSONObject() method, which is declared in ReadOnlyJWTClaimsSet. Could this constructor be modified to accept a ReadOnlyJWTClaimsSet instead?

Comments (3)

  1. Log in to comment