DVSession class

A signed-in device.

A record of a device rather than a cookie with a friendly name. Nothing on it is the bearer token: id is a separate handle, safe to list and to pass to DVSessions.revoke, so showing a person their devices never hands out their other sessions.

Constructors

DVSession({required String id, required String userId, String tenant = DVTenants.defaultTenant, required DateTime createdAt, required DateTime lastSeenAt, String? device, String? location, Map<String, Object?> claims = const <String, Object?>{}, DateTime? mfaSatisfiedAt, DateTime? revokedAt, bool isCurrent = false})
const
DVSession.fromJson(Map<String, Object?> json)
A session a server described with toJson.
factory

Properties

claims → Map<String, Object?>
Server-issued claims. There is no way for a client to write one.
final
createdAt → DateTime
When the person signed in. Rotation does not change it.
final
device → String?
What the platform reported the device as. Never a derived fingerprint.
final
hashCode → int
The hash code for this object.
no setterinherited
id → String
Opaque handle for this session. Reissued with the token on rotation, and never a user identifier.
final
isCurrent → bool
Whether this is the session the listing was asked from.
final
lastSeenAt → DateTime
When this session last authenticated a request.
final
location → String?
Coarse location from the request, when the application configured one.
final
mfaPending → bool
Whether this session was issued by a password alone for an account that has a second factor, which has not been presented yet. Such a session authenticates nothing but the second factor and sign-out: DVSessions.completeMfa records the factor, and the token it rotates to is the first that carries the person's privilege.
no setter
mfaSatisfiedAt → DateTime?
When a second factor was last presented in this session, or null.
final
revokedAt → DateTime?
When the session was revoked, or null while it is live.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
tenant → String
The tenant the session was issued on. It authenticates requests on this tenant only, and rotation does not change it: moving to another tenant is a new sign-in.
final
userId → String
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() → Map<String, Object?>
The session as a client may see it: never the token, which is not on a DVSession at all.
toString() → String
A string representation of this object.
override

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Constants

mfaPendingClaim → const String
The claim a session issued at sign-in carries while the account's second factor has not been presented. Server-issued, like every claim.