authenticate

fun Route.authenticate(vararg configurations: String? = arrayOf<String?>(null), optional: Boolean = false, build: Route.() -> Unit): Route

Creates a route that allows you to define authorization scope for application resources. This function accepts names of authentication providers defined in the Authentication plugin configuration.

Parameters

configurations

names of authentication providers defined in the Authentication plugin configuration.

optional

when set, if no authentication is provided by the client, a call continues but with a null Principal.

See also

Throws

if there are no registered providers referred by configurations names.


fun Route.authenticate(vararg configurations: String? = arrayOf<String?>(null), strategy: AuthenticationStrategy, build: Route.() -> Unit): Route

Creates a route that allows you to define authorization scope for application resources. This function accepts names of authentication providers defined in the Authentication plugin configuration.

Parameters

configurations

names of authentication providers defined in the Authentication plugin configuration.

strategy

defines resolution strategy for nested authentication providers. AuthenticationStrategy.Optional - if no authentication is provided by the client, a call continues but with a null Principal. AuthenticationStrategy.FirstSuccessful - client must provide authentication data for at least one provider registered for this route AuthenticationStrategy.Required - client must provide authentication data for all providers registered for this route with this strategy

See also

Throws

if there are no registered providers referred by configurations names.