public interface Token
| Modifier and Type | Method and Description |
|---|---|
Set<String> |
getAudiences()
Returns the (empty) list of audiences the token is issued for.
|
JsonObject |
getClaimAsJsonObject(String claimName)
Extracts the value of the given as a JsonObject.
|
String |
getClaimAsString(String claimName)
Extracts the value as string for the given claim.
|
List<String> |
getClaimAsStringList(String claimName)
Extracts the value as a list of strings for the given claim.
|
java.time.Instant |
getExpiration()
Returns the moment in time when the token will be expired.
|
String |
getHeaderParameterAsString(String headerName)
Returns the header parameter value as string for the given header parameter
name.
|
java.time.Instant |
getNotBefore()
Returns the moment in time before which the token must not be accepted.
|
Principal |
getPrincipal()
Returns a principal, which can be used to represent any entity, such as an
individual, a corporation, and a login id.
|
Service |
getService()
Returns the identity service, the token is issued by.
|
String |
getTokenValue()
Get the encoded jwt token, e.g.
|
boolean |
hasClaim(String claimName)
Checks whether the token contains a given claim.
|
boolean |
hasHeaderParameter(String headerName)
Checks whether the token contains a given header parameter.
|
boolean |
isExpired()
Returns true if the token is expired.
|
@Nullable String getHeaderParameterAsString(@Nonnull String headerName)
headerName - the name of the header parameter as defined here
TokenHeaderboolean hasHeaderParameter(@Nonnull String headerName)
headerName - the name of the header parameter as defined here
TokenHeaderboolean hasClaim(@Nonnull String claimName)
claimName - the name of the claim as defined here TokenClaims.@Nullable String getClaimAsString(@Nonnull String claimName)
JsonParsingException.claimName - the name of the claim as defined here TokenClaims.JsonParsingException - if the json object identified by the given claim is not a string.List<String> getClaimAsStringList(@Nonnull String claimName)
JsonParsingException.claimName - the name of the claim as defined here TokenClaims.@Nullable JsonObject getClaimAsJsonObject(@Nonnull String claimName)
JsonParsingException.claimName - the name of the claim for which the object should be extracted.JsonObject for the given claim.@Nullable java.time.Instant getExpiration()
boolean isExpired()
@Nullable java.time.Instant getNotBefore()
String getTokenValue()
Never expose this token via log or via HTTP.
Principal getPrincipal()
Service getService()
Copyright © 2020. All rights reserved.