Package-level declarations
Types
A predicate function that accepts an application call and returns true or false.
A plugin that handles authentication and authorization. Typical usage scenarios include logging in users, granting access to specific resources, and securely transmitting information between parties.
A hook that is executed after authentication was checked. Note that this hook is also executed for optional authentication or for routes without any authentication, resulting in ApplicationCall.principal being null.
A configuration for the Authentication plugin.
An authentication context for a call.
Represents a cause for an authentication challenge request.
An authentication function that accepts and verifies credentials and returns a principal when verification is successful.
Represents an authentication challenging procedure requested by authentication mechanism.
An authentication provider with the specified name.
Represents a role that can be required by a typed authentication route.
An authentication route node that is used by Authentication plugin and usually created by the Route.authenticate DSL function, so generally there is no need to instantiate it directly unless you are writing an extension.
The provider is registered lazily when the scheme is first used by authenticateWith. Reusing the same provider object, including through mapPrincipal or orAnonymous, reuses the existing application registration. Creating a different provider with the same name fails fast because provider names are application-wide identifiers.
Typed authentication scheme that checks resolved roles after authentication succeeds.
A 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
A basic Authentication provider.
A Bearer Authentication provider.
A marker interface indicating that a class represents credentials for authentication.
A digest Authentication provider.
Digest credentials.
Provides a message digest for the specified username and realm or returns null if a user is missing. This function could fetch digest from a database or compute it instead.
Provides a message digest for the specified username, realm, and algorithm or returns null if a user is missing. This function could fetch digest from a database or compute it instead.
A configuration that creates a provider based on the AuthenticationConfig.provider block.
Handles authorization failure for a role-protected typed route.
Response content with the 403 Forbidden status code and the WWW-Authenticate header of supplied challenges
A context for FormAuthChallengeFunction.
Specifies what to send back if form-based authentication fails.
A form-based authentication provider.
Handles authentication failure for routes protected by authenticateWithAnyOf.
An OAuth1a server error.
Represents an error during communicating to OAuth2 server.
Typed OAuth 2.0 authorization-code flow.
Configures a typed OAuth 2.0 authorization-code flow.
Error container for when the token endpoint responds with an invalid_grant error.
Error container for when the upstream identity provider does not respond with the token credentials and instead responds with error query parameters.
List of OAuth2 request parameters for both peers.
List of OAuth2 server response parameters.
Typed OAuth 2.0 authentication scheme that exposes OAuthAccessTokenResponse.OAuth2.
Typed OAuth 2.0 flow with session-backed route authentication.
Configures session storage and principal resolution for an OAuth2SessionFlow.
An OAuth access token acquired from the server.
An OAuth Authentication provider.
OAuth callback parameters.
Configures the OAuth 2.0 authentication provider used by a typed OAuth2Flow.
OAuth grant types constants.
OAuth server settings.
Configures a typed OAuth 2.0 flow with session-backed route authentication.
OAuth versions used in configuration.
Typed authentication context that exposes an optional route principal.
Typed authentication context that exposes a required route principal.
Typed authentication context that exposes both the authenticated principal and resolved roles.
A configuration for the AuthenticationInterceptors plugin.
Specifies what to send back if session authentication fails.
A session-based Authentication provider.
A typed Session authentication scheme.
A context for SessionAuthChallengeFunction.
Typed authentication context used by Session authentication.
Resolves a route principal from a stored session value.
Transforms a session value before principal resolution.
Configures how the authentication scheme transports session data.
Typed authentication scheme with no additional context.
Configures a typed Basic authentication scheme with principal type P.
Configures a typed Bearer authentication scheme with principal type P.
Configures a typed Digest authentication scheme with principal type P.
Configures a typed Form authentication scheme.
Handles an authentication failure for a typed authentication scheme.
Response content with the 401 Unauthorized status code and the WWW-Authenticate header of supplied challenges.
Resolves a userhash to the actual username for userhash support.
A user's principal identified by name.
Properties
Retrieves an AuthenticationContext for this call.
A plugin that authenticates calls. Usually used via the authenticate function inside routing.
Authenticated principal captured for the current typed route.
Authenticated principal for the current typed route, or null when authentication is optional and no principal was resolved.
val <P : Any, R : AuthenticationRole> P.roles: Set<R>
Roles resolved for the current role-protected typed route.
Authenticated session captured for the current session-protected typed route.
A key used to register authentication challenge.
val <S : Any> ApplicationCall.sessionOrNull: S?
Authenticated session for the current session-protected typed route, or null when no session was resolved.
Functions
fun <S : Any> SessionAuthenticationScheme<S, *>.applyTransport()
Applies this scheme's configured TypedSessionAuthConfig.transport to a SessionsConfig.
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.
Creates a child route protected by scheme.
Creates a child route that accepts any of the provided typed authentication schemes.
Creates a child route where authentication is optional.
Creates a child route where role-based authentication is optional.
Installs the Authentication plugin if not yet installed and invokes block on its config. You can modify the existing authentication configuration only in the authentication's block or using the Authentication.configure function. Changing captured instance of configuration outside of block may have no effect or damage application's state.
Creates a typed Basic authentication scheme with a principal type P.
Installs the basic Authentication provider. You can use basic authentication for logging in users and protecting specific routes. To learn how to configure it, see Basic authentication.
Installs the basic Authentication provider with description. You can use basic authentication for logging in users and protecting specific routes. To learn how to configure it, see Basic authentication.
Retrieves basic authentication credentials for this ApplicationRequest.
Creates a typed Bearer authentication scheme with a principal type P.
Installs the Bearer Authentication provider. Bearer auth requires the developer to provide a custom 'authenticate' function to authorize the token and return the associated principal.
Installs the Bearer Authentication provider with description. Bearer auth requires the developer to provide a custom 'authenticate' function to authorize the token and return the associated principal.
Clears the authenticated session for the current session-protected typed route.
fun <S : Any, P : Any> SessionAuthenticationScheme<S, P>.clearSession()
Clears a session for this scheme.
Creates a typed Digest authentication scheme.
Installs the digest Authentication provider. To learn how to configure it, see Digest authentication.
Installs the digest Authentication provider with description. To learn how to configure it, see Digest authentication.
Retrieves DigestCredential for this call.
Calculates the expected digest bytes for this DigestCredential.
Calculates the expected digest bytes for this DigestCredential per RFC 7616.
Creates a typed Form authentication scheme.
Installs the form-based Authentication provider. Form-based authentication uses a web form to collect credential information and authenticate a user. To learn how to configure it, see Form-based authentication.
Installs the form-based Authentication provider with description. Form-based authentication uses a web form to collect credential information and authenticate a user. To learn how to configure it, see Form-based authentication.
Installs an OAuth2Flow at the application routing root.
Installs an OAuth2SessionFlow at the application routing root.
Installs an OAuth2Flow into the routing tree.
Installs an OAuth2SessionFlow into the routing tree.
Installs the OAuth Authentication provider. OAuth can be used to authorize users of your application by using external providers, such as Google, Facebook, Twitter, and so on. To learn how to configure it, see OAuth.
Installs the OAuth Authentication provider with description. OAuth can be used to authorize users of your application by using external providers, such as Google, Facebook, Twitter, and so on. To learn how to configure it, see OAuth.
Creates a typed OAuth 2.0 authorization-code flow.
Creates a typed OAuth 2.0 authorization-code flow with session-backed route authentication.
Returns a scheme that accepts anonymous requests when no credentials are provided.
Parses an authorization header from a ApplicationRequest returning a HttpAuthHeader.
Installs the session Authentication provider. This provider provides the ability to authenticate a user that already has an associated session.
Installs the session Authentication provider with description. This provider provides the ability to authenticate a user that already has an associated session.
fun <S : Any, P : Any> SessionAuthenticationScheme<S, P>.setSession(value: S)
Sets a session value for this scheme.
Converts HttpAuthHeader to DigestCredential.
fun <S : Any> ApplicationCall.updateSession(transform: (S) -> S): S
Replaces the authenticated session with the value returned by transform.
Verifies that credentials are valid for a given method, and userNameRealmPasswordDigest. The algorithm from DigestCredential.algorithm is used to compute the HA1 value.
Verifies that credentials are valid for a given method, digester, and userNameRealmPasswordDigest.
Implements Resource Owner Password Credentials Grant.
Creates a role-based scheme from this typed authentication scheme.