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,- IDToken,- InitialAccessToken,- LogoutToken,- PermissionTicketToken,- RegistrationAccessToken,- TokenIntrospectionResponse
 
 public class JsonWebToken extends Object implements Serializable, Token - Version:
- $Revision: 1 $
- Author:
- Bill Burke
- See Also:
- Serialized Form
 
- 
- 
Constructor SummaryConstructors Constructor Description JsonWebToken()
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description JsonWebTokenaddAudience(String audience)JsonWebTokenaudience(String... audience)JsonWebTokenexp(Long exp)JsonWebTokenexpiration(int expiration)Deprecated.int will overflow with values after 2038.String[]getAudience()TokenCategorygetCategory()LonggetExp()intgetExpiration()Deprecated.int will overflow with values after 2038.LonggetIat()StringgetId()intgetIssuedAt()Deprecated.int will overflow with values after 2038.StringgetIssuedFor()OAuth client the token was issued for.StringgetIssuer()LonggetNbf()intgetNotBefore()Deprecated.int will overflow with values after 2038.Map<String,Object>getOtherClaims()This is a map of any other claims and data that might be in the IDToken.StringgetSubject()StringgetType()booleanhasAnyAudience(List<String> audiences)booleanhasAudience(String audience)JsonWebTokeniat(Long iat)JsonWebTokenid(String id)booleanisActive()Tests that the token is not expired and is not-before.booleanisActive(int allowedTimeSkew)booleanisExpired()booleanisIssuedBeforeSessionStart(long sessionStarted)booleanisNotBefore(int allowedTimeSkew)JsonWebTokenissuedAt(int issuedAt)Deprecated.int will overflow with values after 2038.JsonWebTokenissuedFor(String issuedFor)JsonWebTokenissuedNow()Set issuedAt to the current timeJsonWebTokenissuer(String issuer)JsonWebTokennbf(Long nbf)JsonWebTokennotBefore(int notBefore)Deprecated.int will overflow with values after 2038.voidsetOtherClaims(String name, Object value)voidsetSubject(String subject)JsonWebTokensubject(String subject)JsonWebTokentype(String type)
 
- 
- 
- 
Method Detail- 
getIdpublic String getId() 
 - 
idpublic JsonWebToken id(String id) 
 - 
getExppublic Long getExp() 
 - 
getExpiration@Deprecated public int getExpiration() Deprecated.int will overflow with values after 2038. UsegetExp()instead.
 - 
exppublic JsonWebToken exp(Long exp) 
 - 
expirationpublic JsonWebToken expiration(int expiration) Deprecated.int will overflow with values after 2038. Useexp(Long)instead.
 - 
isExpiredpublic boolean isExpired() 
 - 
getNbfpublic Long getNbf() 
 - 
getNotBefore@Deprecated public int getNotBefore() Deprecated.int will overflow with values after 2038. UsegetNbf()instead.
 - 
nbfpublic JsonWebToken nbf(Long nbf) 
 - 
notBefore@Deprecated public JsonWebToken notBefore(int notBefore) Deprecated.int will overflow with values after 2038. Usenbf(Long)instead.
 - 
isNotBeforepublic boolean isNotBefore(int allowedTimeSkew) 
 - 
isActivepublic boolean isActive() Tests that the token is not expired and is not-before.- Returns:
 
 - 
isActivepublic boolean isActive(int allowedTimeSkew) 
 - 
isIssuedBeforeSessionStartpublic 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
 
 - 
getIatpublic Long getIat() 
 - 
getIssuedAt@Deprecated public int getIssuedAt() Deprecated.int will overflow with values after 2038. UsegetIat()instead.
 - 
issuedNowpublic JsonWebToken issuedNow() Set issuedAt to the current time
 - 
iatpublic JsonWebToken iat(Long iat) 
 - 
issuedAt@Deprecated public JsonWebToken issuedAt(int issuedAt) Deprecated.int will overflow with values after 2038. Useiat(Long)()} instead.
 - 
getIssuerpublic String getIssuer() 
 - 
issuerpublic JsonWebToken issuer(String issuer) 
 - 
getAudiencepublic String[] getAudience() 
 - 
hasAudiencepublic boolean hasAudience(String audience) 
 - 
audiencepublic JsonWebToken audience(String... audience) 
 - 
addAudiencepublic JsonWebToken addAudience(String audience) 
 - 
getSubjectpublic String getSubject() 
 - 
subjectpublic JsonWebToken subject(String subject) 
 - 
setSubjectpublic void setSubject(String subject) 
 - 
getTypepublic String getType() 
 - 
typepublic JsonWebToken type(String type) 
 - 
getIssuedForpublic String getIssuedFor() OAuth client the token was issued for.- Returns:
 
 - 
issuedForpublic JsonWebToken issuedFor(String issuedFor) 
 - 
getOtherClaimspublic Map<String,Object> 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:
 
 - 
getCategorypublic TokenCategory getCategory() - Specified by:
- getCategoryin interface- Token
 
 
- 
 
-