Adding additional policies to authorization allows the subsequent policies to return 403 instead of 401 which works out for what I want to do.
However when I have something like:
protected override Task HandleRequirementAsync(AuthorizationHandlerContext context, MustHaveResourceAccessRequirement requirement)
{
if (context.Resource is AuthorizationFilterContext filterContext)
{
var request = filterContext.RouteData.Values["request"];
...
}
}
I cannot access request
since it's not part of the actual Route itself...
The controller action is:
public ActionResult GetResource([FromBody] GetResourceRequest request)
Since it's [FromBody]
and not [FromRoute]
it's not available.
Is it possible to get the bound model within a AuthorizationHandler
without needing to manually figure out if it's from Query/Route/Body as I want to use this on many different requests, I cannot have every request needing to specify another argument on every route.