WebAuthCookieBuilder extension
Builds the relic Set-Cookie headers for the web authentication cookie
described by a WebAuthCookieConfig.
The auth cookie is always HttpOnly (the token must never be readable by
JavaScript); secure, sameSite, domain and path come from the config.
Methods
-
buildClearCookieHeader(
) → SetCookie -
Available on WebAuthCookieConfig, provided by the WebAuthCookieBuilder extension
ASet-Cookiethat expires (removes) the auth cookie on the client. The attributes match those used to set it, which browsers require to remove a cookie. -
buildClearRefreshCookieHeader(
{String? path}) → SetCookie -
Available on WebAuthCookieConfig, provided by the WebAuthCookieBuilder extension
ASet-Cookiethat expires (removes) the JWT refresh cookie.pathmust match the path the cookie was set with. -
buildSetCookieHeader(
String token, {int? maxAgeSeconds}) → SetCookie -
Available on WebAuthCookieConfig, provided by the WebAuthCookieBuilder extension
ASet-Cookiethat storestokenas the auth cookie. WhenmaxAgeSecondsis given it sets the cookie lifetime; omit it for a session cookie (cleared when the browser closes). -
buildSetRefreshCookieHeader(
String refreshToken, {int? maxAgeSeconds, String? path}) → SetCookie -
Available on WebAuthCookieConfig, provided by the WebAuthCookieBuilder extension
ASet-Cookiethat storesrefreshTokenas the JWT refresh cookie.pathoverrides the configured cookie path (see WebAuthCookieSession.writeWebAuthRefreshCookie).