I want to write something like the following for my controller methods:
[DeviceAccessAuthorisation(Permission="SetDoorProfile")]
public ActionResult SetDoorProfile(string deviceId, int doorProfileId)
{...}
I could probably do this in the custom authoriseattribute, but it feels like setting requirements (class DeviceAccessRequirements:IAuthorizationRequirement
) with the Permission and having that be passed to an AuthorizationHandler<DeviceAccessRequirements>
I know I can read the deviceId controller param from HttpRequest.RouteValues, in either the custom AuthoriseAttribute or in the AuthorizationHandler.
I think this would be the ideal architecture.
but I cant figure out how to get the populated requirement to the AuthorizationHandler
Note that I have many permissions, and dont want to create a policy for each, especially as I’m likely to want other parameters.