RememberSessionAuthRuntime<TContext> class
Framework-agnostic remember-me and session-principal runtime.
Framework adapters are responsible for providing a concrete AuthSessionRuntimeAdapter that maps framework request/session/cookie semantics to this runtime.
Constructors
-
RememberSessionAuthRuntime({required AuthSessionRuntimeAdapter<
TContext> adapter, RememberTokenStore? rememberStore, String rememberCookieName = 'remember_token', Duration defaultRememberDuration = const Duration(days: 30), String sessionPrincipalKey = '__auth.principal', String principalAttributeKey = authPrincipalAttribute, String tokenGenerator() = secureRandomToken, void regenerateSession(TContext context)?, DateTime clock()?}) -
Creates a runtime with framework
adapterand remember-token settings.
Properties
-
adapter
→ AuthSessionRuntimeAdapter<
TContext> -
Adapter that maps framework request, session, and response state.
final
- defaultRememberDuration → Duration
-
Lifetime assigned to rotated remember tokens during hydration.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- principalAttributeKey → String
-
Request attribute key containing the cached principal.
final
- regenerateSession → void Function(TContext context)?
-
Optional callback that rotates the framework session before login.
final
- rememberCookieName → String
-
Name of the remember-me cookie.
final
- rememberStore → RememberTokenStore
-
Store used for hashed remember-me tokens.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- sessionPrincipalKey → String
-
Session key containing the serialized principal.
final
- tokenGenerator → String Function()
-
Generates raw remember tokens before they are persisted by the store.
final
Methods
-
current(
TContext context) → AuthPrincipal? -
Returns the cached or session-backed principal for
context. -
hydrate(
TContext context) → Future< void> - Hydrates the auth principal from session or remember-token state.
-
login(
TContext context, AuthPrincipal principal, {bool rememberMe = false, Duration? rememberDuration, bool rotateSession = true}) → Future< void> -
Logs in
principaland stores it in the session and request context. -
logout(
TContext context) → Future< void> - Clears session and request principal state and expires the remember cookie.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited