AuthPrincipal class

Represents an authenticated user or entity.

Constructors

AuthPrincipal({required String id, List<String> roles = const <String>[], Map<String, dynamic>? attributes})
Creates a principal with an identifier, roles, and public attributes.
AuthPrincipal.fromJson(Map<String, dynamic> json)
Creates a principal from a JSON payload.
factory

Properties

attributes → Map<String, dynamic>
Public attributes associated with the principal.
final
hashCode → int
The hash code for this object.
no setterinherited
id → String
Stable identifier for the authenticated principal.
final
roles → List<String>
Role labels associated with the principal.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

hasRole(String role) → bool
Returns whether role is assigned to this principal.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() → Map<String, dynamic>
Serializes this principal after removing sensitive attributes.
toString() → String
A string representation of this object.
inherited

Operators

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