JWT

data class JWT(val issuer: String, val audience: String, val subject: String, val id: String? = null, val algorithm: String = DEFAULT_ALGORITHM, val keyId: String? = null, val expiry: Date = Date(Date().time + (DEFAULT_LIFETIME * 1000)), val issuedAt: Date = Date(), val notValidBefore: Date? = null, val payload: JSONObject = JSONObject())

Encapsulates a JSON Web Token.

Parameters

issuer

URL to token issuer.

audience

Intended audience of the token.

subject

Identity associated with the token.

id

unique ID of the token.

algorithm

signature algorithm used to sign the token.

expiry

date/time at which token will expire.

issuedAt

date/time at which the token was issued.

notValidBefore

token is not valid before this time.

Constructors

Link copied to clipboard
constructor(issuer: String, audience: String, subject: String, id: String? = null, algorithm: String = DEFAULT_ALGORITHM, keyId: String? = null, expiry: Date = Date(Date().time + (DEFAULT_LIFETIME * 1000)), issuedAt: Date = Date(), notValidBefore: Date? = null, payload: JSONObject = JSONObject())

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val id: String? = null
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val keyId: String? = null
Link copied to clipboard
val notValidBefore: Date? = null
Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard
fun signAndEncode(keyManager: KeyManagerInterface, keyId: String): String

Sign and encode the token. Mainly used for testing.