JwtParserBuilder

class JwtParserBuilder(jsonInstance: Json)(source)

Configures and builds a JwtParser.

Example:

val signingKey = SigningAlgorithm.HS256.newKey()
val parser = Jwt.parser()
.verifyWith(signingKey)
.requireIssuer("myapp")
.clockSkew(30L)
.build()
val jws = parser.parse(token)

Constructors

Link copied to clipboard
constructor(jsonInstance: Json)

Properties

Link copied to clipboard

The processor registry used by the built JwtParser to look up signing and encryption keys.

Functions

Link copied to clipboard

Configures whether tokens with alg=none (unsecured JWTs) are accepted.

Link copied to clipboard

Builds the configured JwtParser.

Link copied to clipboard

Sets the acceptable clock skew when validating time-based claims (exp, nbf, iat).

Link copied to clipboard

Registers a JweProcessor to use for token decryption.

Link copied to clipboard

Disables signature verification entirely, accepting any token regardless of its signature.

Link copied to clipboard

Adds a validator that requires the aud claim to contain the given value.

Link copied to clipboard
inline fun <T> requireClaim(claimName: String, value: T): JwtParserBuilder

Adds a validator that requires the named claim to equal the given value.

Link copied to clipboard
fun requireIssuer(iss: String, ignoreCase: Boolean = false): JwtParserBuilder

Adds a validator that requires the iss claim to equal the given value.

Link copied to clipboard

Adds a validator that requires the sub claim to equal the given value.

Link copied to clipboard

Delegates key look-up to the given registry before consulting this parser's own keys.

Link copied to clipboard

Registers a JwsProcessor to use for signature verification.