Class AspNetAnonymousEvaluator
- Namespace
- Cratis.Arc.Authorization
- Assembly
- Cratis.Arc.dll
Represents an implementation of IAnonymousEvaluator that checks for ASP.NET Core's AllowAnonymousAttribute.
public class AspNetAnonymousEvaluator : IAnonymousEvaluator
- Inheritance
-
AspNetAnonymousEvaluator
- Implements
- Inherited Members
- Extension Methods
Remarks
The ASP.NET Core attribute types are named in full on purpose. This file lives in the namespace that declares Arc's own attributes of the same names, and a type in the enclosing namespace takes precedence over one brought in by a using directive - so an unqualified name here silently means Arc's attribute, not ASP.NET Core's.
Constructors
AspNetAnonymousEvaluator()
public AspNetAnonymousEvaluator()
Methods
IsAnonymousAllowed(MethodInfo)
Checks if anonymous access is allowed for the specified method.
public bool? IsAnonymousAllowed(MethodInfo method)
Parameters
methodMethodInfoThe method to check.
Returns
- bool?
True if anonymous access is allowed, false otherwise, or null if this evaluator cannot determine.
Exceptions
- AmbiguousAuthorizationLevel
Thrown when the method carries both ASP.NET Core attributes.
IsAnonymousAllowed(Type)
Checks if anonymous access is allowed for the specified type.
public bool? IsAnonymousAllowed(Type type)
Parameters
typeTypeThe type to check.
Returns
- bool?
True if anonymous access is allowed, false otherwise, or null if this evaluator cannot determine.
Exceptions
- AmbiguousAuthorizationLevel
Thrown when the type carries both ASP.NET Core attributes.