AuthPrincipal class

Represents an authenticated user or entity.

This class encapsulates the user's unique identifier, roles, and additional attributes that may be associated with the user.

Constructors

AuthPrincipal({required String id, List<String> roles = const <String>[], Map<String, dynamic>? attributes})
Creates an instance of AuthPrincipal.
AuthPrincipal.fromJson(Map<String, dynamic> json)
Creates an AuthPrincipal instance from a JSON map.
factory

Properties

attributes Map<String, dynamic>
Additional attributes associated with the principal.
final
hashCode int
The hash code for this object.
no setterinherited
id String
The unique identifier for the principal.
final
roles List<String>
A list of roles assigned to the principal.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

hasRole(String role) bool
Checks if the principal has the specified role.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() Map<String, dynamic>
Converts the principal to a JSON-serializable map.
toString() String
A string representation of this object.
inherited

Operators

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