UserSecurityContext class
A security context capturing the claims, roles, and entitlements for a user.
Passed to ZenithRequirement.evaluate and ZenithAuthorizationService.evaluate to determine whether a policy grants access.
Constructors
-
UserSecurityContext({bool isAuthenticated = false, Map<
String, dynamic> claims = const {}, double consumedBandwidthGb = 0, List<String> roles = const []}) -
Creates a UserSecurityContext.
const
Properties
-
claims
→ Map<
String, dynamic> -
Arbitrary claim map. Typical keys:
'entitlement','subscription_tier'.final - consumedBandwidthGb → double
-
Monthly bandwidth consumed in gigabytes, for quota-based requirements.
final
-
entitlements
→ List<
String> -
Returns a flat list of entitlements from claims under the key
'entitlement', cast toList<String>.no setter - hashCode → int
-
The hash code for this object.
no setterinherited
- isAuthenticated → bool
-
Whether the user is currently authenticated (has a valid session).
final
-
roles
→ List<
String> -
Role strings (e.g.
'admin','viewer').final - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited