AuthSessionInfo class
Safe public projection of a persisted server-side session.
The token digest is intentionally excluded. Applications can use this model to build a session/security-management screen without exposing a credential that could authenticate a request.
Constructors
- AuthSessionInfo({required String id, required String userId, required DateTime createdAt, required DateTime expiresAt, required DateTime lastUsedAt, required String authenticationMethod, required bool isCurrent, DateTime? revokedAt, String? ipAddress, String? userAgent})
-
Creates a redacted projection from persisted session fields.
const
- AuthSessionInfo.fromRecord(AuthSessionRecord record, {bool isCurrent = false})
-
Creates a safe projection from
record.factory
Properties
- authenticationMethod → String
-
Authentication mechanism that created the session.
final
- createdAt → DateTime
-
Time at which the session was created.
final
- expiresAt → DateTime
-
Time at which the session expires.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- id → String
-
Persisted session record identifier.
final
- ipAddress → String?
-
Optional source IP address recorded for the session.
final
- isCurrent → bool
-
Whether this record matches the caller's current session.
final
- lastUsedAt → DateTime
-
Most recent time at which the session was used.
final
- revokedAt → DateTime?
-
Revocation time, or null when the session has not been revoked.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- userAgent → String?
-
Optional user-agent string recorded for the session.
final
- userId → String
-
Identifier of the user who owns the session.
final
Methods
-
isActive(
{DateTime? now}) → bool - Returns whether this session is not revoked and has not expired.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toJson(
) → Map< String, dynamic> - Converts this projection to a JSON-compatible map.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited