Interface ClaimAccessor
-
- All Known Subinterfaces:
IdTokenClaimAccessor,JwtClaimAccessor,OAuth2IntrospectionClaimAccessor,OidcUser,StandardClaimAccessor
- All Known Implementing Classes:
DefaultOidcUser,Jwt,OAuth2IntrospectionAuthenticatedPrincipal,OidcIdToken,OidcUserInfo
public interface ClaimAccessorAn "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.BooleancontainsClaim(java.lang.String claim)Deprecated.UsehasClaim(java.lang.String)instead.default <T> TgetClaim(java.lang.String claim)Returns the claim value as aTtype.default java.lang.BooleangetClaimAsBoolean(java.lang.String claim)Returns the claim value as aBooleanornullif it does not exist.default java.time.InstantgetClaimAsInstant(java.lang.String claim)Returns the claim value as anInstantornullif 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>ornullif the claim does not exist.default java.lang.StringgetClaimAsString(java.lang.String claim)Returns the claim value as aStringornullif 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>ornullif the claim does not exist.default java.net.URLgetClaimAsURL(java.lang.String claim)Returns the claim value as anURLornullif 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 booleanhasClaim(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
Mapof claims
-
getClaim
default <T> T getClaim(java.lang.String claim)
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
default boolean hasClaim(java.lang.String claim)
- Parameters:
claim- the name of the claim- Returns:
trueif 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:
trueif the claim exists, otherwisefalse
-
getClaimAsString
default java.lang.String getClaimAsString(java.lang.String claim)
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
default java.lang.Boolean getClaimAsBoolean(java.lang.String claim)
Returns the claim value as aBooleanornullif it does not exist.- Parameters:
claim- the name of the claim- Returns:
- the claim value or
nullif it does not exist
-
getClaimAsInstant
default java.time.Instant getClaimAsInstant(java.lang.String claim)
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
default java.net.URL getClaimAsURL(java.lang.String claim)
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
default java.util.Map<java.lang.String,java.lang.Object> getClaimAsMap(java.lang.String claim)
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:
java.lang.IllegalArgumentException- if the claim value cannot be converted to aListjava.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>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:
java.lang.IllegalArgumentException- if the claim value cannot be converted to aListjava.lang.NullPointerException- if the claim value isnull
-
-