Package org.keycloak.representations
Class JsonWebToken
java.lang.Object
org.keycloak.representations.JsonWebToken
- All Implemented Interfaces:
Serializable,Token
- Direct Known Subclasses:
AuthorizationResponseToken,CIBAAuthenticationRequest,DefaultActionTokenKey,DockerResponseToken,DPoP,IDToken,InitialAccessToken,LogoutToken,PermissionTicketToken,RegistrationAccessToken,TokenIntrospectionResponse
- Version:
- $Revision: 1 $
- Author:
- Bill Burke
- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddAudience(String audience) String[]getExp()getIat()getId()OAuth client the token was issued for.getNbf()This is a map of any other claims and data that might be in the IDToken.getType()booleanhasAnyAudience(List<String> audiences) booleanhasAudience(String audience) booleanisActive()Tests that the token is not expired and is not-before.booleanisActive(int allowedTimeSkew) booleanbooleanisIssuedBeforeSessionStart(long sessionStarted) booleanisNotBefore(long allowedTimeSkew) Set issuedAt to the current timevoidsetOtherClaims(String name, Object value) voidsetSubject(String subject)
-
Field Details
-
AZP
- See Also:
-
SUBJECT
- See Also:
-
id
-
exp
-
nbf
-
iat
-
issuer
-
audience
-
subject
-
type
-
issuedFor
-
otherClaims
-
-
Constructor Details
-
JsonWebToken
public JsonWebToken()
-
-
Method Details
-
getId
-
id
-
getExp
-
exp
-
isExpired
public boolean isExpired() -
getNbf
-
nbf
-
isNotBefore
public boolean isNotBefore(long allowedTimeSkew) -
isActive
public boolean isActive()Tests that the token is not expired and is not-before.- Returns:
-
isActive
public boolean isActive(int allowedTimeSkew) -
isIssuedBeforeSessionStart
public boolean isIssuedBeforeSessionStart(long sessionStarted) - Parameters:
sessionStarted- Time in seconds- Returns:
- true if the particular token was issued before the given session start time. Which means that token cannot be issued by the particular session
-
getIat
-
issuedNow
Set issuedAt to the current time -
iat
-
getIssuer
-
issuer
-
getAudience
-
hasAudience
-
hasAnyAudience
-
audience
-
addAudience
-
getSubject
-
subject
-
setSubject
-
getType
-
type
-
getIssuedFor
OAuth client the token was issued for.- Returns:
-
issuedFor
-
getOtherClaims
This is a map of any other claims and data that might be in the IDToken. Could be custom claims set up by the auth server- Returns:
-
setOtherClaims
-
getCategory
- Specified by:
getCategoryin interfaceToken
-