Got help from this article:
https://docs.microsoft.com/en-us/aspnet/core/security/authorization/policies
I tried to create some policies for my actions, but in some actions I want to have several policies, and if the user has any of them, they can have access to the Controller Actions:
[Authorize(Policy = "CanAccessMenu1")]
[Authorize(Policy = "CanAccessMenu2")]
public async Task<IActionResult> ActionFroMultiplePolicies([FromBody] ActionRequest request)
{
}
How can I combine these policies? can i use something like this?
[Authorize (Policy = "CanAccessMenu1, CanAccessMenu2")]
In this case, perhaps I need to make some changes to these override functions. But I do not know about this:
Protected override async Task HandleRequirementAsync(AuthorizationHandlerContext context, CanAccessRequirement requirement)
{
}
Thanks for any help
source
share