JWT Class

Generates the JSON Claims Set in a JSON Web Token (JWT). The resulting Base64-encoded payload can be passed as an argument to create an instance of the Auth.JWS class.

Namespace

Auth

Usage

Use the methods in this class to generate the payload in a JWT bearer token.

JWT Methods

The following are methods for JWT. All are instance methods.

  • clone()
    Makes a duplicate copy of the JWT object.
  • getAdditionalClaims()
    Returns a map of additional claims in the JWT, where the key string contains the name of the claim, and the value contains the value of the claim.
  • getAud()
    Returns the audience claim that identifies the intended recipients of the JWT.
  • getIss()
    Returns the issuer claim that identifies the issuer of the JWT.
  • getNbfClockSkew()
    Returns the not before claim that identifies the time before which the JWT must not be accepted for processing, while allowing some leeway for clock skew.
  • getSub()
    Returns the subject claim that identifies the current user of the JWT.
  • getValidityLength()
    Returns the length of time that the JWT is valid, which affects the expiration claim.
  • setAdditionalClaims(additionalClaims)
    Sets the additional claims in the JWT. Returned by the getAdditionalClaims() method.
  • setAud(aud)
    Sets the audience claim in the JWT. Returned by the getAud() method.
  • setIss(iss)
    Sets the issuer claim in the JWT. Returned by the getIss() method.
  • setNbfClockSkew(nbfClockSkew)
    Sets the not before claim in the JWT. Returned by the getNbfClockSkew() method.
  • setSub(sub)
    Sets the subject claim in the JWT. Returned by the getSub() method.
  • setValidityLength(validityLength)
    Sets the length of time that the JWT is valid, which affects the expiration claim. Returned by the getValidityLength() method.
  • toJSONString()
    Generates the JSON object representation of the Claims Set as an encoded JWT payload.

clone()

Makes a duplicate copy of the JWT object.

Signature

public Object clone()

Return Value

Type: JWT

getAdditionalClaims()

Returns a map of additional claims in the JWT, where the key string contains the name of the claim, and the value contains the value of the claim.

Signature

public Map<String,ANY> getAdditionalClaims()

Return Value

Type: Map<String,ANY>

getAud()

Returns the audience claim that identifies the intended recipients of the JWT.

Signature

public String getAud()

Return Value

Type: String

getIss()

Returns the issuer claim that identifies the issuer of the JWT.

Signature

public String getIss()

Return Value

Type: String

getNbfClockSkew()

Returns the not before claim that identifies the time before which the JWT must not be accepted for processing, while allowing some leeway for clock skew.

Signature

public Integer getNbfClockSkew()

Return Value

Type: Integer

getSub()

Returns the subject claim that identifies the current user of the JWT.

Signature

public String getSub()

Return Value

Type: String

getValidityLength()

Returns the length of time that the JWT is valid, which affects the expiration claim.

Signature

public Integer getValidityLength()

Return Value

Type: Integer

setAdditionalClaims(additionalClaims)

Sets the additional claims in the JWT. Returned by the getAdditionalClaims() method.

Signature

public void setAdditionalClaims(Map<String,ANY> additionalClaims)

Parameters

additionalClaims
Type: Map<String,ANY>

Return Value

Type: void

Usage

Additional claims must not include any standard claims.

setAud(aud)

Sets the audience claim in the JWT. Returned by the getAud() method.

Signature

public void setAud(String aud)

Parameters

aud
Type: String

Return Value

Type: void

setIss(iss)

Sets the issuer claim in the JWT. Returned by the getIss() method.

Signature

public void setIss(String iss)

Parameters

iss
Type: String

Return Value

Type: void

setNbfClockSkew(nbfClockSkew)

Sets the not before claim in the JWT. Returned by the getNbfClockSkew() method.

Signature

public void setNbfClockSkew(Integer nbfClockSkew)

Parameters

nbfClockSkew
Type: Integer

Return Value

Type: void

setSub(sub)

Sets the subject claim in the JWT. Returned by the getSub() method.

Signature

public void setSub(String sub)

Parameters

sub
Type: String

Return Value

Type: void

setValidityLength(validityLength)

Sets the length of time that the JWT is valid, which affects the expiration claim. Returned by the getValidityLength() method.

Signature

public void setValidityLength(Integer validityLength)

Parameters

validityLength
Type: Integer

Return Value

Type: void

toJSONString()

Generates the JSON object representation of the Claims Set as an encoded JWT payload.

Signature

public String toJSONString()

Return Value

Type: String