authenticate

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

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.

Report a problem

Parameters

configurations

names of authentication providers defined in the Authentication plugin configuration.

optional

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

See also

Throws

MissingApplicationPluginException

if no Authentication plugin installed first.

if there are no registered providers referred by configurations names.


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

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.

Report a problem

Parameters

configurations

names of authentication providers defined in the Authentication plugin configuration.

strategy

defines resolution strategy for nested authentication providers. AuthenticationStrategy.Optional - if the client provides no authentication, 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

MissingApplicationPluginException

if no Authentication plugin installed first.

if there are no registered providers referred by configurations names.