I have created a custom AuthorizeAttribute which verifies some OAuth credentials that are sent inside the HTTP header. I am using some of these credentials to identify who is making the request. Once I parse this information in the AuthorizeAttribute is there any way to pass it over so that the data can be assigned to an instance variable of the Controller? Then anywhere in my Controller I will have the ID of the requesting party.
I have created a custom AuthorizeAttribute which verifies some OAuth credentials that are sent
Share
Original answer
You should be able to do this in your filter
And then this in your action
You’d probably want to use a more unique key than
"test", but that’s the idea.EDIT There are two reasons we do this in the action rather than the constructor:
Alternative solution
OAuthController : ControllerOnAuthorizationOAuthController.OnAuthorizationprotectedfield (i.e.,protected object myAuthData) inOAuthControllerOAuthControllerinstead ofControllermyAuthData.