AuthorizationService class
Server-side authorization manager that combines token validation with authorization checking
Constructors
- AuthorizationService(AuthValidator _authValidator, AuthorizationProvider _authzProvider)
- Creates an authorization service with token validator and authorization provider
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
- Validate token and get authorization data
-
checkAuthorization(
String token, {String? resource, String? action, List< String> ? requiredRoles, List<String> ? requiredPermissions, bool requireAllRoles = false, bool requireAllPermissions = false, Map<String, dynamic> ? context}) → Future<bool> - Comprehensive authorization check with multiple criteria
-
checkPermissions(
String token, List< String> permissions, {String? resource, Map<String, dynamic> ? context}) → Future<Map< String, bool> > - Batch check multiple permissions
-
checkRoles(
String token, List< String> roles, {String? resource, Map<String, dynamic> ? context}) → Future<Map< String, bool> > - Batch check multiple roles
-
getEffectivePermissions(
String token, String resource) → Future< List< String> > - Get user's effective permissions for a resource
-
getEffectiveRoles(
String token, String resource) → Future< List< String> > - Get user's effective roles for a resource
-
getUserId(
String token) → Future< String?> - Get user ID from token
-
hasAllPermissions(
String token, List< String> permissions, {String? resource, Map<String, dynamic> ? context}) → Future<bool> - Check if token holder has all of the specified permissions
-
hasAllRoles(
String token, List< String> roles, {String? resource, Map<String, dynamic> ? context}) → Future<bool> - Check if token holder has all of the specified roles
-
hasAnyPermission(
String token, List< String> permissions, {String? resource, Map<String, dynamic> ? context}) → Future<bool> - Check if token holder has any of the specified permissions
-
hasAnyRole(
String token, List< String> roles, {String? resource, Map<String, dynamic> ? context}) → Future<bool> - Check if token holder has any of the specified roles
-
hasPermission(
String token, String permission, {String? resource, Map< String, dynamic> ? context}) → Future<bool> - Check if token holder has specific permission
-
hasRole(
String token, String role, {String? resource, Map< String, dynamic> ? context}) → Future<bool> - Check if token holder has specific role
-
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