JWTPrincipal

class JWTPrincipal(payload: Payload) : JWTPayloadHolder, Principal

A JWT principal that consists of the specified payload.

See also

com.auth0.jwt.interfaces.Payload

Parameters

payload

JWT

Constructors

Link copied to clipboard
fun JWTPrincipal(payload: Payload)

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.

Properties

Link copied to clipboard
val audience: List<String>

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
val expiresAt: Date?

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
val issuedAt: Date?

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
val issuer: String?

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

Link copied to clipboard
val jwtId: String?

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
val notBefore: Date?

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
val subject: String?

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).