AuthorizationData class

Represents authorization data for a user

Constructors

AuthorizationData({required String userId, required List<String> roles, required List<String> permissions, Map<String, dynamic> attributes = const {}, DateTime? expiresAt, String? resource, String? action})
Creates authorization data for a user
const

Properties

action String?
Optional action context for the authorization
final
attributes Map<String, dynamic>
Additional attributes associated with the authorization
final
expiresAt DateTime?
Optional expiration time for the authorization
final
hashCode int
The hash code for this object.
no setterinherited
isExpired bool
Check if authorization has expired
no setter
isValid bool
Check if this authorization is valid (not expired)
no setter
permissions List<String>
List of permissions granted to the user
final
resource String?
Optional resource context for the authorization
final
roles List<String>
List of roles assigned to the user
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
userId String
User identifier
final

Methods

copyWith({String? userId, List<String>? roles, List<String>? permissions, Map<String, dynamic>? attributes, DateTime? expiresAt, String? resource, String? action}) AuthorizationData
Create a copy with updated values
getAttribute<T>(String key) → T?
Get attribute value by key
hasAllPermissions(List<String> permissions) bool
Check if user has all of the specified permissions
hasAllRoles(List<String> roles) bool
Check if user has all of the specified roles
hasAnyPermission(List<String> permissions) bool
Check if user has any of the specified permissions
hasAnyRole(List<String> roles) bool
Check if user has any of the specified roles
hasPermission(String permission) bool
Check if user has a specific permission
hasRole(String role) bool
Check if user has a specific role
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
override

Operators

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