Class JsonWebToken

java.lang.Object
org.gcube.common.keycloak.model.JsonWebToken
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
IDToken, TokenIntrospectionResponse

public class JsonWebToken extends Object implements Serializable
Author:
Bill Burke
See Also:
  • Field Details

    • id

      protected String id
    • exp

      protected Long exp
    • nbf

      protected Long nbf
    • iat

      protected Long iat
    • issuer

      protected String issuer
    • audience

      protected String[] audience
    • subject

      protected String subject
    • type

      protected String type
    • issuedFor

      public String issuedFor
    • otherClaims

      protected Map<String,Object> otherClaims
  • Constructor Details

    • JsonWebToken

      public JsonWebToken()
  • Method Details

    • getId

      public String getId()
    • id

      public JsonWebToken id(String id)
    • getExp

      public Long getExp()
    • exp

      public JsonWebToken exp(Long exp)
    • isExpired

      public boolean isExpired()
    • getNbf

      public Long getNbf()
    • nbf

      public JsonWebToken nbf(Long nbf)
    • isNotBefore

      public boolean isNotBefore(int allowedTimeSkew)
    • isActive

      public boolean isActive()
      Tests that the token is not expired and is not-before.
      Returns:
      true if is not expired and is not-before
    • isActive

      public boolean isActive(int allowedTimeSkew)
    • getIat

      public Long getIat()
    • issuedNow

      public JsonWebToken issuedNow()
      Set issuedAt to the current time
      Returns:
      the token itself
    • iat

      public JsonWebToken iat(Long iat)
    • getIssuer

      public String getIssuer()
    • issuer

      public JsonWebToken issuer(String issuer)
    • getAudience

      public String[] getAudience()
    • hasAudience

      public boolean hasAudience(String audience)
    • audience

      public JsonWebToken audience(String... audience)
    • addAudience

      public JsonWebToken addAudience(String audience)
    • getSubject

      public String getSubject()
    • subject

      public JsonWebToken subject(String subject)
    • setSubject

      public void setSubject(String subject)
    • getType

      public String getType()
    • type

      public JsonWebToken type(String type)
    • getIssuedFor

      public String getIssuedFor()
      OAuth client the token was issued for.
      Returns:
      the issued for vale
    • issuedFor

      public JsonWebToken issuedFor(String issuedFor)
    • getOtherClaims

      public 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:
      the object's other claims
    • setOtherClaims

      public void setOtherClaims(String name, Object value)