public abstract class AbstractToken extends Object implements Token
| Modifier and Type | Field and Description |
|---|---|
protected String |
jwtToken |
protected DefaultJsonObject |
tokenBody |
protected DefaultJsonObject |
tokenHeader |
| Constructor and Description |
|---|
AbstractToken(DecodedJwt decodedJwt) |
AbstractToken(String jwtToken)
Creates a Token object for simple access to the header parameters and its
claims.
|
| Modifier and Type | Method and Description |
|---|---|
protected Principal |
createPrincipalByName(String name) |
boolean |
equals(Object o) |
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.
|
String |
getTokenValue()
Get the encoded jwt token, e.g.
|
boolean |
hasClaim(String claimName)
Checks whether the token contains a given claim.
|
int |
hashCode() |
boolean |
hasHeaderParameter(String parameterName)
Checks whether the token contains a given header parameter.
|
boolean |
isExpired()
Returns true if the token is expired.
|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitgetPrincipal, getServiceprotected final DefaultJsonObject tokenHeader
protected final DefaultJsonObject tokenBody
protected final String jwtToken
public AbstractToken(@Nonnull DecodedJwt decodedJwt)
@Nullable public String getHeaderParameterAsString(@Nonnull String headerName)
TokengetHeaderParameterAsString in interface TokenheaderName - the name of the header parameter as defined here
TokenHeaderpublic boolean hasClaim(@Nonnull String claimName)
TokenhasClaim in interface TokenclaimName - the name of the claim as defined here TokenClaims.public boolean hasHeaderParameter(@Nonnull String parameterName)
TokenhasHeaderParameter in interface TokenparameterName - the name of the header parameter as defined here
TokenHeader@Nullable public String getClaimAsString(@Nonnull String claimName)
TokenJsonParsingException.getClaimAsString in interface TokenclaimName - the name of the claim as defined here TokenClaims.@Nullable public List<String> getClaimAsStringList(@Nonnull String claimName)
TokenJsonParsingException.getClaimAsStringList in interface TokenclaimName - the name of the claim as defined here TokenClaims.@Nullable public JsonObject getClaimAsJsonObject(String claimName)
TokenJsonParsingException.getClaimAsJsonObject in interface TokenclaimName - the name of the claim for which the object should be extracted.JsonObject for the given claim.@Nullable public java.time.Instant getExpiration()
TokengetExpiration in interface Tokenpublic boolean isExpired()
Token@Nullable public java.time.Instant getNotBefore()
TokengetNotBefore in interface Tokenpublic String getTokenValue()
TokenNever expose this token via log or via HTTP.
getTokenValue in interface Tokenpublic Set<String> getAudiences()
TokengetAudiences in interface TokenCopyright © 2020. All rights reserved.