I am creating a Web Api 2 application using Thinktecture.IdentityModel.Owin.ResourceAuthorization
, I was taking a look at the source code and I realized I wanted to change the properties available on my ResourceAuthorizationContext
, I would like to create a custom Context
and use it for everything related to ResourceAuthorization
. That way I could add custom properties to be available for my CheckAccessAsync
method.
My goal is to have something like this:
public class CustomAuthorizationManager : ResourceAuthorizationManager
{
public override Task<bool> CheckAccessAsync(CustomResourceAuthorizationContext context)
{
// Access my custom properties coming directly from the context
}
}
So I could use a CustomAttribute like this:
[CustomResourceAuthorize("CustomValue", "MoreCustomValues")]
public class ValuesController : ApiController
{
}
I couldn't figure out a way to customize the Context
, like I do with the ResourceAuthorizationManager
, at the startup.
The problem seems to be these extension methods, they reference the ResourceAuthorizationContext
class directly.
Am I missing something or you really can't do this?