NameAuthorizationRequirement Class¶
Implements an Microsoft.AspNetCore.Authorization.IAuthorizationHandler
and Microsoft.AspNetCore.Authorization.IAuthorizationRequirement
which requires the current user name must match the specified value.
- Namespace
Microsoft.AspNetCore.Authorization.Infrastructure
- Assemblies
- Microsoft.AspNetCore.Authorization
Inheritance Hierarchy¶
System.Object
Microsoft.AspNetCore.Authorization.AuthorizationHandler{Microsoft.AspNetCore.Authorization.Infrastructure.NameAuthorizationRequirement}
Microsoft.AspNetCore.Authorization.Infrastructure.NameAuthorizationRequirement
Syntax¶
public class NameAuthorizationRequirement : AuthorizationHandler<NameAuthorizationRequirement>, IAuthorizationHandler, IAuthorizationRequirement
-
class
Microsoft.AspNetCore.Authorization.Infrastructure.
NameAuthorizationRequirement
Constructors¶
-
NameAuthorizationRequirement
(System.String)¶ Constructs a new instance of
Microsoft.AspNetCore.Authorization.Infrastructure.NameAuthorizationRequirement
.Arguments: requiredName (System.String) – The required name that the current user must have. public NameAuthorizationRequirement(string requiredName)
-
Methods¶
-
HandleRequirementAsync
(Microsoft.AspNetCore.Authorization.AuthorizationHandlerContext, Microsoft.AspNetCore.Authorization.Infrastructure.NameAuthorizationRequirement)¶ Makes a decision if authorization is allowed based on a specific requirement.
Arguments: - context (Microsoft.AspNetCore.Authorization.AuthorizationHandlerContext) – The authorization context.
- requirement (Microsoft.AspNetCore.Authorization.Infrastructure.NameAuthorizationRequirement) – The requirement to evaluate.
Return type: System.Threading.Tasks.Task
protected override Task HandleRequirementAsync(AuthorizationHandlerContext context, NameAuthorizationRequirement requirement)
-
Properties¶
-
Microsoft.AspNetCore.Authorization.Infrastructure.NameAuthorizationRequirement.
RequiredName
¶ Gets the required name that the current user must have.
Return type: System.String public string RequiredName { get; }
-