Interface ClaimAccessor
- All Known Subinterfaces:
IdTokenClaimAccessor,JwtClaimAccessor,OAuth2TokenIntrospectionClaimAccessor,OidcUser,StandardClaimAccessor
- All Known Implementing Classes:
DefaultOidcUser,Jwt,JwtClaimsSet,OAuth2IntrospectionAuthenticatedPrincipal,OidcIdToken,OidcUserInfo
public interface ClaimAccessor
An "accessor" for a set of claims that may be used for assertions.
- Since:
- 5.0
-
Method Summary
Modifier and TypeMethodDescriptiondefault <T> TReturns the claim value as aTtype.default BooleangetClaimAsBoolean(String claim) Returns the claim value as aBooleanornullif the claim does not exist.default InstantgetClaimAsInstant(String claim) Returns the claim value as anInstantornullif it does not exist.getClaimAsMap(String claim) Returns the claim value as aMap<String, Object>ornullif the claim does not exist.default StringgetClaimAsString(String claim) Returns the claim value as aStringornullif it does not exist or is equal tonull.getClaimAsStringList(String claim) Returns the claim value as aList<String>ornullif the claim does not exist.default URLgetClaimAsURL(String claim) Returns the claim value as anURLornullif it does not exist.Returns a set of claims that may be used for assertions.default boolean
-
Method Details
-
getClaims
Returns a set of claims that may be used for assertions.- Returns:
- a
Mapof claims
-
getClaim
Returns the claim value as aTtype. The claim value is expected to be of typeT.- Type Parameters:
T- the type of the claim value- Parameters:
claim- the name of the claim- Returns:
- the claim value
- Since:
- 5.2
-
hasClaim
- Parameters:
claim- the name of the claim- Returns:
trueif the claim exists, otherwisefalse- Since:
- 5.5
-
getClaimAsString
Returns the claim value as aStringornullif it does not exist or is equal tonull.- Parameters:
claim- the name of the claim- Returns:
- the claim value or
nullif it does not exist or is equal tonull
-
getClaimAsBoolean
Returns the claim value as aBooleanornullif the claim does not exist.- Parameters:
claim- the name of the claim- Returns:
- the claim value or
nullif the claim does not exist - Throws:
IllegalArgumentException- if the claim value cannot be converted to aBooleanNullPointerException- if the claim value isnull
-
getClaimAsInstant
Returns the claim value as anInstantornullif it does not exist.- Parameters:
claim- the name of the claim- Returns:
- the claim value or
nullif it does not exist
-
getClaimAsURL
Returns the claim value as anURLornullif it does not exist.- Parameters:
claim- the name of the claim- Returns:
- the claim value or
nullif it does not exist
-
getClaimAsMap
Returns the claim value as aMap<String, Object>ornullif the claim does not exist.- Parameters:
claim- the name of the claim- Returns:
- the claim value or
nullif the claim does not exist - Throws:
IllegalArgumentException- if the claim value cannot be converted to aListNullPointerException- if the claim value isnull
-
getClaimAsStringList
Returns the claim value as aList<String>ornullif the claim does not exist.- Parameters:
claim- the name of the claim- Returns:
- the claim value or
nullif the claim does not exist - Throws:
IllegalArgumentException- if the claim value cannot be converted to aListNullPointerException- if the claim value isnull
-