api

http4k / org.http4k.security / InsecureCookieBasedOAuthPersistence

InsecureCookieBasedOAuthPersistence

class InsecureCookieBasedOAuthPersistence : 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!

Constructors

Name Summary
<init> 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!InsecureCookieBasedOAuthPersistence(cookieNamePrefix: String, cookieValidity: Duration = Duration.ofHours(3), clock: Clock = Clock.systemDefaultZone())

Functions

Name Summary
assignCsrf Assign a CSRF token to this OAuth auth redirection (to the end-service) response. Opportunity here to modify the response returned to the user when the redirection happens.fun assignCsrf(redirect: Response, csrf: CrossSiteRequestForgeryToken): Response
assignNonce Assign a nonce to this OIDC auth redirection (to the end-service) response. Opportunity here to modify the response returned to the user when the redirection happens.fun assignNonce(redirect: Response, nonce: Nonce): Response
assignOriginalUri opportunity to store the uri that the request was made before authentication this will then be redirected back to after authfun assignOriginalUri(redirect: Response, originalUri: Uri): Response
assignToken Assign the swapped AccessToken (and optional IdToken) returned by the end-service. Opportunity here to modify the response returned to the user when the redirection happens.fun assignToken(request: Request, redirect: Response, accessToken: AccessToken, idToken: IdToken?): Response
authFailureResponse Build the default failure response which occurs when a failure occurs during the callback process (eg. a mismatch/missing CSRF or failure occurring when calling into the end-service for the access-token.fun authFailureResponse(): Response
retrieveCsrf Retrieve the stored CSRF token for this user requestfun retrieveCsrf(request: Request): CrossSiteRequestForgeryToken?
retrieveNonce Retrieve the stored nonce token for this user requestfun retrieveNonce(request: Request): Nonce?
retrieveOriginalUri Retrieve the stored original uri for this user requestfun retrieveOriginalUri(request: Request): Uri?
retrieveToken Retrieve the stored AccessToken token for this user requestfun retrieveToken(request: Request): AccessToken?