JWTPayloadHolder

abstract class JWTPayloadHolder(val payload: Payload)

Shortcut functions for standard registered JWT claims.

Inheritors

Constructors

Link copied to clipboard
constructor(payload: Payload)

Properties

Link copied to clipboard

Gets the value of the aud (audience) claim, or an empty list if it's not available. The aud claim specifies a recipient for which the JWT is intended.

Link copied to clipboard

Gets the value of the exp (expiration time) claim, or null if it's not available. This claim specifies a time after which the JWT expires.

Link copied to clipboard

Gets the value of the iat (issued at) claim, or null if it's not available. The iat claim specifies a time at which the JWT was issued. This claim can be used to determine the age of the JWT.

Link copied to clipboard

Gets a value of the iss (issuer) claim, which specifies the issuer of the JWT.

Link copied to clipboard

Gets the value of the jti (JWT ID) claim, or null if it's not available. The jti claim specifies provides a unique identifier for the JWT. This claim can be used to prevent the JWT from being replayed (allows a token to be used only once).

Link copied to clipboard

Gets the value of the nbf (not before time) claim, or null if it's not available. The nbf specifies a time before which the JWT must not be accepted for processing.

Link copied to clipboard
val payload: Payload

A JWT payload.

Link copied to clipboard

Gets a value of the sub (subject) claim, or null if it's not available. The sub claim specifies a subject of the JWT (the user).

Functions

Link copied to clipboard
operator fun get(name: String): String?

Gets a non-RFC JWT claim by its name.

Link copied to clipboard
fun <T : Any> getClaim(name: String, clazz: KClass<T>): T?

Gets a non-RFC JWT claim by its name and attempts to decode it as the specified type.

Link copied to clipboard
fun <T : Any> getListClaim(name: String, clazz: KClass<T>): List<T>

Retrieves a non-RFC JWT claim by its name and attempts to decode it as a list of the specified type.