AuthorizationLayer class

LAYER 6 — Enforces authorization rules on top of authenticated, validated, and risk-scored requests.

Rules enforced:

  • The user must exist (be a known/registered user).
  • The user must not attempt a restricted action.
  • The user must not exceed their configured per-user transaction limit.
Implemented types

Constructors

AuthorizationLayer({required Set<String> knownUserIds, Set<String> restrictedActions = const {'admin_override', 'delete_ledger'}, Map<String, double>? userLimits, double defaultUserLimit = 2000})
Creates an authorization layer for the given knownUserIds.

Properties

defaultUserLimit → double
Transaction ceiling applied when a user has no entry in userLimits.
final
hashCode → int
The hash code for this object.
no setterinherited
knownUserIds → Set<String>
The set of user IDs known to the system. In a real deployment this would be a lookup against a user store; kept in-memory here to stay dependency-free.
final
name → String
A short, stable, human-readable name used in logs and results.
no setteroverride
restrictedActions → Set<String>
Actions that no user is permitted to perform through this pipeline (e.g. administrative operations that must go through a separate, more privileged flow).
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
userLimits → Map<String, double>
Per-user transaction ceilings. Falls back to defaultUserLimit when a user has no specific override.
final

Methods

check(RequestContext context) → Future<SecurityResult>
Inspects context and returns a SecurityResult.
override
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