This ticket is created based on this comment.

Expected Behavior ClaimAccessor#getClaim() and ClaimAccessor#getClaimAsString() should behave the same way as other ClaimAccessor#getClaimAsXXX methods.

There are few options to consider: - all ClaimAccessor#getClaimAsXXX methods will throw NullPointerException if claim value is null and claim value is converted to null. I suppose, this is a preferred way. - all ClaimAccessor#getClaimAsXXX methods will throw IllegalArgumentException without claim value class, if claim value is null and claim value is converted to null (no NullPointerException) - null will be valid return value even if converter converts claim value to null (no assertion). This was discussed here - ...

Current Behavior All ClaimAccessor#getClaimAsXXX methods (except ClaimAccessor#getClaim() and ClaimAccessor#getClaimAsString()) throw NullPointerException if claim value is null and claim value is converted to null.

Exception is thrown when message for IllegalArgumentException is evaluated:

Assert.isTrue(convertedValue != null,
                () -> "Unable to convert claim '" + claim + "' of type '" + claimValue.getClass() + "' to XXX.");

On the other side, - ClaimAccessor#getClaim() returns null if claim value is null. - ClaimAccessor#getClaimAsString() returns null if claim value is converted to null.