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
All Methods Instance Methods Abstract Methods Default Methods Deprecated Methods Modifier and Type Method Description default java.lang.Boolean
containsClaim(java.lang.String claim)
Deprecated.UsehasClaim(java.lang.String)
instead.default <T> T
getClaim(java.lang.String claim)
Returns the claim value as aT
type.default java.lang.Boolean
getClaimAsBoolean(java.lang.String claim)
Returns the claim value as aBoolean
ornull
if the claim does not exist.default java.time.Instant
getClaimAsInstant(java.lang.String claim)
Returns the claim value as anInstant
ornull
if it does not exist.default java.util.Map<java.lang.String,java.lang.Object>
getClaimAsMap(java.lang.String claim)
Returns the claim value as aMap<String, Object>
ornull
if the claim does not exist.default java.lang.String
getClaimAsString(java.lang.String claim)
Returns the claim value as aString
ornull
if it does not exist or is equal tonull
.default java.util.List<java.lang.String>
getClaimAsStringList(java.lang.String claim)
Returns the claim value as aList<String>
ornull
if the claim does not exist.default java.net.URL
getClaimAsURL(java.lang.String claim)
Returns the claim value as anURL
ornull
if it does not exist.java.util.Map<java.lang.String,java.lang.Object>
getClaims()
Returns a set of claims that may be used for assertions.default boolean
hasClaim(java.lang.String claim)
-
-
-
Method Detail
-
getClaims
java.util.Map<java.lang.String,java.lang.Object> getClaims()
Returns a set of claims that may be used for assertions.- Returns:
- a
Map
of claims
-
getClaim
default <T> T getClaim(java.lang.String claim)
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
default boolean hasClaim(java.lang.String claim)
- Parameters:
claim
- the name of the claim- Returns:
true
if the claim exists, otherwisefalse
- Since:
- 5.5
-
containsClaim
@Deprecated default java.lang.Boolean containsClaim(java.lang.String claim)
Deprecated.UsehasClaim(java.lang.String)
instead.- Parameters:
claim
- the name of the claim- Returns:
true
if the claim exists, otherwisefalse
-
getClaimAsString
default java.lang.String getClaimAsString(java.lang.String claim)
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
default java.lang.Boolean getClaimAsBoolean(java.lang.String claim)
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:
java.lang.IllegalArgumentException
- if the claim value cannot be converted to aBoolean
java.lang.NullPointerException
- if the claim value isnull
-
getClaimAsInstant
default java.time.Instant getClaimAsInstant(java.lang.String claim)
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
default java.net.URL getClaimAsURL(java.lang.String claim)
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
default java.util.Map<java.lang.String,java.lang.Object> getClaimAsMap(java.lang.String claim)
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:
java.lang.IllegalArgumentException
- if the claim value cannot be converted to aList
java.lang.NullPointerException
- if the claim value isnull
-
getClaimAsStringList
default java.util.List<java.lang.String> getClaimAsStringList(java.lang.String claim)
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:
java.lang.IllegalArgumentException
- if the claim value cannot be converted to aList
java.lang.NullPointerException
- if the claim value isnull
-
-