Package-level declarations

Types

Link copied to clipboard
interface AccessToken

Base interface for AccessToken. Implement this in concert with AccessTokenExtractor to provide a custom implementation

Link copied to clipboard
data class AccessTokenDetails(val accessToken: AccessToken, val idToken: IdToken? = null)
Link copied to clipboard
class AccessTokenFetcher(api: HttpHandler, callbackUri: Uri, providerConfig: OAuthProviderConfig, accessTokenFetcherAuthenticator: AccessTokenFetcherAuthenticator, accessTokenExtractor: AccessTokenExtractor = ContentTypeJsonOrForm())
Link copied to clipboard
Link copied to clipboard
data class AccessTokenResponse(val access_token: String, val token_type: String? = null, val expires_in: Long? = null, val id_token: String? = null, val scope: String? = null, val refresh_token: String? = null)
Link copied to clipboard
class ContentTypeJsonOrForm(autoMarshallingJson: AutoMarshallingJson<*> = OAuthMoshi) : AccessTokenExtractor

Extracts a standard OAuth access token from JSON or Form encoded response.

Link copied to clipboard
data class CrossSiteRequestForgeryToken(val value: String)
Link copied to clipboard
Link copied to clipboard
class InsecureCookieBasedOAuthPersistence(cookieNamePrefix: String, cookieValidity: Duration = Duration.ofDays(1), clock: Clock = Clock.systemUTC()) : OAuthPersistence

This is an example implementation which stores CSRF and AccessToken values in an INSECURE client-side cookie. Access-tokens for end-services are fully available to the browser so do not use this in production!

Link copied to clipboard
class OAuthCallback(oAuthPersistence: OAuthPersistence, idTokenConsumer: IdTokenConsumer, accessTokenFetcher: AccessTokenFetcher) : Function1<request: Request, Response>
Link copied to clipboard
sealed class OAuthCallbackError
Link copied to clipboard

Provides persistence for OAuth lifecycle values:

Link copied to clipboard
class OAuthProvider(val providerConfig: OAuthProviderConfig, client: HttpHandler, callbackUri: Uri, val scopes: List<String>, oAuthPersistence: OAuthPersistence, modifyAuthState: (Uri) -> Uri = { it }, generateCrsf: CsrfGenerator = SECURE_CSRF, nonceGenerator: NonceGenerator = SECURE_NONCE, pkceGenerator: PkceGenerator? = null, responseType: ResponseType = Code, idTokenConsumer: IdTokenConsumer = NoOp, accessTokenFetcherAuthenticator: AccessTokenFetcherAuthenticator = ClientSecretAccessTokenFetcherAuthenticator(providerConfig), jwtRedirectionUriBuilder: (RequestJwts) -> RedirectionUriBuilder = ::uriBuilderWithRequestJwt, redirectionUrlBuilder: RedirectionUriBuilder = defaultUriBuilder, accessTokenExtractor: AccessTokenExtractor = ContentTypeJsonOrForm(), responseMode: ResponseMode? = null, originalUri: (Request) -> Uri = Request::uri)

Provides a configured set of objects for use with an OAuth2 provider.

Link copied to clipboard
data class OAuthProviderConfig(authBase: Uri, val authPath: String, val tokenPath: String, val credentials: Credentials, val apiBase: Uri = authBase, val authUri: Uri = authBase.extend(Uri.of(authPath)), val tokenUri: Uri = authBase.extend(Uri.of(tokenPath)))
Link copied to clipboard
class OAuthRedirectionFilter(providerConfig: OAuthProviderConfig, callbackUri: Uri, scopes: List<String>, generateCrsf: CsrfGenerator = SECURE_CSRF, nonceGenerator: NonceGenerator = SECURE_NONCE, pkceGenerator: PkceGenerator? = null, modifyState: (Uri) -> Uri, oAuthPersistence: OAuthPersistence, responseType: ResponseType, redirectionBuilder: RedirectionUriBuilder = defaultUriBuilder, originalUri: (Request) -> Uri = Request::uri, responseMode: ResponseMode? = null) : Filter
Link copied to clipboard
Link copied to clipboard
data class PkceChallengeAndVerifier(val challenge: String, val verifier: String)
Link copied to clipboard
Link copied to clipboard
typealias RedirectionUriBuilder = (Uri, AuthRequest, state: State, nonce: Nonce?) -> Uri
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
data class State(val value: String)

Functions

Link copied to clipboard
fun OAuthProvider.Companion.auth0(auth0Uri: Uri, client: HttpHandler, credentials: Credentials, callbackUri: Uri, oAuthPersistence: OAuthPersistence): OAuthProvider

Preconfigured OAuthProviders go here...

Link copied to clipboard
fun OAuthProvider.Companion.discord(client: HttpHandler, credentials: Credentials, callbackUri: Uri, oAuthPersistence: OAuthPersistence, scopes: List<String> = listOf()): OAuthProvider
Link copied to clipboard
fun OAuthProvider.Companion.dropbox(client: HttpHandler, credentials: Credentials, callbackUri: Uri, oAuthPersistence: OAuthPersistence): OAuthProvider
Link copied to clipboard
fun OAuthProvider.Companion.facebook(client: HttpHandler, credentials: Credentials, callbackUri: Uri, oAuthPersistence: OAuthPersistence, scopes: List<String> = listOf("email")): OAuthProvider
Link copied to clipboard

Retrieves the first fragment parameter value with this name.

(Copy &) Adds a query value with this name.

fun Uri.fragmentParameter(name: String, value: String?): Uri
Link copied to clipboard

Retrieves all fragment parameters with this name.

Link copied to clipboard
fun OAuthProvider.Companion.gitHub(client: HttpHandler, credentials: Credentials, callbackUri: Uri, oAuthPersistence: OAuthPersistence, scopes: List<String> = listOf()): OAuthProvider
Link copied to clipboard
fun OAuthProvider.Companion.gitLab(client: HttpHandler, credentials: Credentials, callbackUri: Uri, oAuthPersistence: OAuthPersistence, scopes: List<String> = listOf()): OAuthProvider
Link copied to clipboard
fun OAuthProvider.Companion.google(client: HttpHandler, credentials: Credentials, callbackUri: Uri, oAuthPersistence: OAuthPersistence, scopes: List<String> = listOf("openid")): OAuthProvider
Link copied to clipboard
Link copied to clipboard
fun OAuthProvider.Companion.soundCloud(client: HttpHandler, credentials: Credentials, callbackUri: Uri, oAuthPersistence: OAuthPersistence): OAuthProvider