Interface IAuthorizationAttributeEvaluator

Namespace
Cratis.Arc.Authorization
Assembly
Cratis.Arc.Core.dll

Defines a system that can evaluate authorization attributes for a type or method.

public interface IAuthorizationAttributeEvaluator
Extension Methods

Methods

GetAuthorizationInfo(MethodInfo)

Checks if the method has an authorization attribute and retrieves role information.

(bool HasAuthorize, string? Roles)? GetAuthorizationInfo(MethodInfo method)

Parameters

method MethodInfo

The method to check.

Returns

(bool HasAuthorize, string Roles)?

Tuple with (hasAuthorize, roles) or null if this evaluator cannot determine.

GetAuthorizationInfo(Type)

Checks if the type has an authorization attribute and retrieves role information.

(bool HasAuthorize, string? Roles)? GetAuthorizationInfo(Type type)

Parameters

type Type

The type to check.

Returns

(bool HasAuthorize, string Roles)?

Tuple with (hasAuthorize, roles) or null if this evaluator cannot determine.

GetAuthorizationRequirements(MethodInfo)

Gets every authorization requirement declared on the method.

IEnumerable<AuthorizationRequirement> GetAuthorizationRequirements(MethodInfo method)

Parameters

method MethodInfo

The method to check.

Returns

IEnumerable<AuthorizationRequirement>

One AuthorizationRequirement per authorization attribute, all of which must be satisfied.

Remarks

The default derives a single requirement from GetAuthorizationInfo(MethodInfo). Override it to report every attribute, so that stacked attributes are all enforced rather than only the first one found.

GetAuthorizationRequirements(Type)

Gets every authorization requirement declared on the type.

IEnumerable<AuthorizationRequirement> GetAuthorizationRequirements(Type type)

Parameters

type Type

The type to check.

Returns

IEnumerable<AuthorizationRequirement>

One AuthorizationRequirement per authorization attribute, all of which must be satisfied.

Remarks

The default derives a single requirement from GetAuthorizationInfo(Type). Override it to report every attribute, so that stacked attributes are all enforced rather than only the first one found.