Interface ClaimAccessor
- All Known Subinterfaces:
IdTokenClaimAccessor
,JwtClaimAccessor
,OAuth2IntrospectionClaimAccessor
,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 Boolean
containsClaim
(String claim) Deprecated.default <T> T
Returns the claim value as aT
type.default Boolean
getClaimAsBoolean
(String claim) Returns the claim value as aBoolean
ornull
if the claim does not exist.default Instant
getClaimAsInstant
(String claim) Returns the claim value as anInstant
ornull
if it does not exist.getClaimAsMap
(String claim) Returns the claim value as aMap<String, Object>
ornull
if the claim does not exist.default String
getClaimAsString
(String claim) Returns the claim value as aString
ornull
if it does not exist or is equal tonull
.getClaimAsStringList
(String claim) Returns the claim value as aList<String>
ornull
if the claim does not exist.default URL
getClaimAsURL
(String claim) Returns the claim value as anURL
ornull
if 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
Map
of claims
-
getClaim
Returns the claim value as aT
type. 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:
true
if the claim exists, otherwisefalse
- Since:
- 5.5
-
containsClaim
Deprecated.UsehasClaim(java.lang.String)
instead.- Parameters:
claim
- the name of the claim- Returns:
true
if the claim exists, otherwisefalse
-
getClaimAsString
Returns the claim value as aString
ornull
if it does not exist or is equal tonull
.- Parameters:
claim
- the name of the claim- Returns:
- the claim value or
null
if it does not exist or is equal tonull
-
getClaimAsBoolean
Returns the claim value as aBoolean
ornull
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 aBoolean
NullPointerException
- if the claim value isnull
-
getClaimAsInstant
Returns the claim value as anInstant
ornull
if it does not exist.- Parameters:
claim
- the name of the claim- Returns:
- the claim value or
null
if it does not exist
-
getClaimAsURL
Returns the claim value as anURL
ornull
if it does not exist.- Parameters:
claim
- the name of the claim- Returns:
- the claim value or
null
if it does not exist
-
getClaimAsMap
Returns the claim value as aMap<String, Object>
ornull
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 aList
NullPointerException
- if the claim value isnull
-
getClaimAsStringList
Returns the claim value as aList<String>
ornull
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 aList
NullPointerException
- if the claim value isnull
-
hasClaim(java.lang.String)
instead.