Authenticator
See Security — Core concepts for an overview.
Authenticator
Functional interface implemented by the application to map an HTTP request to an authentication outcome.
- Declaration
fun interface Authenticator {
fun authenticate(request: Request): AuthenticationResponse
}
AuthenticationResponse
Sealed result type returned by an Authenticator.
- Declaration
sealed class AuthenticationResponse {
data object Unauthenticated : AuthenticationResponse()
data class Authenticated<P : Principal>(
val principal: P,
val newCookies: List<Cookie> = emptyList()
) : AuthenticationResponse()
}
newCookies are set on the response after the request completes — useful for setting login cookies
or refreshing rolling JWT tokens.