ktor-auth-jwt / io.ktor.auth.jwt / JWTPayloadHolder

JWTPayloadHolder

abstract class JWTPayloadHolder

Shortcut functions for standard registered JWT Claims

Constructors

<init>

JWTPayloadHolder(payload: Payload)

Shortcut functions for standard registered JWT Claims

Properties

audience

val audience: List<String>

Get the value of the "aud" claim, or an empty list if it's not available.

expiresAt

val expiresAt: Date?

Get the value of the "exp" claim, or null if it's not available.

issuedAt

val issuedAt: Date?

Get the value of the "iat" claim, or null if it's not available.

issuer

val issuer: String?

Get the value of the "iss" claim, or null if it's not available.

jwtId

val jwtId: String?

Get the value of the "jti" claim, or null if it's not available.

notBefore

val notBefore: Date?

Get the value of the "nbf" claim, or null if it's not available.

payload

val payload: Payload

The JWT payload

subject

val subject: String?

Get the value of the "sub" claim, or null if it's not available.

Functions

get

operator fun get(name: String): String?

Retrieve a non-RFC JWT string Claim by its name

getClaim

fun <T : Any> getClaim(name: String, clazz: KClass<T>): T?

Retrieve a non-RFC JWT Claim by its name and attempt to decode as the supplied type

getListClaim

fun <T : Any> getListClaim(name: String, clazz: KClass<T>): List<T>

Retrieve a non-RFC JWT Claim by its name and attempt to decode as a list of the supplied type

Inheritors

JWTCredential

class JWTCredential : Credential, JWTPayloadHolder

Represents a JWT credential consist of the specified payload

JWTPrincipal

class JWTPrincipal : Principal, JWTPayloadHolder

Represents a JWT principal consist of the specified payload