Interface IAuthorizationPolicy
- Namespace
- Excalibur.A3.Authorization
- Assembly
- Excalibur.A3.Abstractions.dll
Represents an authorization policy for validating user access to activities and resources.
public interface IAuthorizationPolicy : IPolicy
- Extension Methods
Properties
TenantId
Gets the tenant identifier associated with the authorization policy.
string TenantId { get; }
Property Value
- string
The tenant identifier.
UserId
Gets the user identifier associated with the authorization policy.
string? UserId { get; }
Property Value
Methods
HasGrant(string)
Determines if the user has a grant for the specified activity.
bool HasGrant(string activityName)
Parameters
activityNamestringThe name of the activity to check for a grant.
Returns
- bool
trueif the user has a grant; otherwise,false.
HasGrant(string, string)
Determines if the user has a grant for a specific resource type and resource ID.
bool HasGrant(string resourceType, string resourceId)
Parameters
Returns
- bool
trueif the user has a grant; otherwise,false.
HasGrant<TActivity>()
Determines if the user has a grant for a specific activity type.
bool HasGrant<TActivity>()
Returns
- bool
trueif the user has a grant; otherwise,false.
Type Parameters
TActivityThe activity type to check for a grant.
HasGrant<TResourceType>(string)
Determines if the user has a grant for a specific resource type and resource ID.
bool HasGrant<TResourceType>(string resourceId)
Parameters
resourceIdstringThe identifier of the resource.
Returns
- bool
trueif the user has a grant; otherwise,false.
Type Parameters
TResourceTypeThe resource type to check.
IsAuthorized(string, string?)
Determines if the user is authorized to perform an activity on an optional resource.
bool IsAuthorized(string activityName, string? resourceId)
Parameters
activityNamestringThe name of the activity to authorize.
resourceIdstringThe identifier of the resource, or null if not applicable.
Returns
- bool
trueif the user is authorized; otherwise,false.