claim

fun claim(name: String, value: JsonElement?)(source)

Sets a raw claim using a pre-built JsonElement, or removes it if value is null.

Parameters

name

the claim name

value

the claim value, or null to remove the claim


fun <T> claim(name: String, serializer: SerializationStrategy<T>, value: T?, jsonInstance: Json = Jwt.defaultJsonParser)(source)

Sets a typed claim using an explicit SerializationStrategy.

Parameters

name

the claim name

serializer

the serialization strategy for T

value

the claim value, or null to remove the claim

jsonInstance

the Json instance to use for serialization; defaults to the library's Jwt.defaultJsonParser configuration (ignoreUnknownKeys = true, explicitNulls = false)


inline fun <T> claim(name: String, value: T)(source)

Sets a typed claim, inferring the serializer from the reified type T.

Parameters

name

the claim name

value

the claim value