Interface ClaimAccessor

All Known Subinterfaces:
IdTokenClaimAccessor, JwtClaimAccessor, LogoutTokenClaimAccessor, OAuth2TokenIntrospectionClaimAccessor, OidcUser, StandardClaimAccessor
All Known Implementing Classes:
DefaultOidcUser, Jwt, JwtClaimsSet, OAuth2IntrospectionAuthenticatedPrincipal, OidcIdToken, OidcLogoutToken, OidcUserInfo

public interface ClaimAccessor
An "accessor" for a set of claims that may be used for assertions.
Since:
5.0
  • Method Details

    • getClaims

      Map<String,Object> getClaims()
      Returns a set of claims that may be used for assertions.
      Returns:
      a Map of claims
    • getClaim

      default <T> T getClaim(String claim)
      Returns the claim value as a T type. The claim value is expected to be of type T.
      Type Parameters:
      T - the type of the claim value
      Parameters:
      claim - the name of the claim
      Returns:
      the claim value
      Since:
      5.2
    • hasClaim

      default boolean hasClaim(String claim)
      Returns true if the claim exists in getClaims(), otherwise false.
      Parameters:
      claim - the name of the claim
      Returns:
      true if the claim exists, otherwise false
      Since:
      5.5
    • getClaimAsString

      default String getClaimAsString(String claim)
      Returns the claim value as a String or null if it does not exist or is equal to null.
      Parameters:
      claim - the name of the claim
      Returns:
      the claim value or null if it does not exist or is equal to null
    • getClaimAsBoolean

      default Boolean getClaimAsBoolean(String claim)
      Returns the claim value as a Boolean or null if the claim does not exist.
      Parameters:
      claim - the name of the claim
      Returns:
      the claim value or null if the claim does not exist
      Throws:
      IllegalArgumentException - if the claim value cannot be converted to a Boolean
      NullPointerException - if the claim value is null
    • getClaimAsInstant

      default Instant getClaimAsInstant(String claim)
      Returns the claim value as an Instant or null if it does not exist.
      Parameters:
      claim - the name of the claim
      Returns:
      the claim value or null if it does not exist
    • getClaimAsURL

      default URL getClaimAsURL(String claim)
      Returns the claim value as an URL or null if it does not exist.
      Parameters:
      claim - the name of the claim
      Returns:
      the claim value or null if it does not exist
    • getClaimAsMap

      default Map<String,Object> getClaimAsMap(String claim)
      Returns the claim value as a Map<String, Object> or null if the claim does not exist.
      Parameters:
      claim - the name of the claim
      Returns:
      the claim value or null if the claim does not exist
      Throws:
      IllegalArgumentException - if the claim value cannot be converted to a Map
      NullPointerException - if the claim value is null
    • getClaimAsStringList

      default List<String> getClaimAsStringList(String claim)
      Returns the claim value as a List<String> or null if the claim does not exist.
      Parameters:
      claim - the name of the claim
      Returns:
      the claim value or null if the claim does not exist
      Throws:
      IllegalArgumentException - if the claim value cannot be converted to a List
      NullPointerException - if the claim value is null