This project has moved and is read-only. For the latest updates, please go here.

Add claims via Owin Middleware

Feb 18, 2015 at 6:43 AM
Using Owin (OAuthAuthorizationServerProvider) to grant credentials (i.e. the token) via the UserManager. I add basic claims like Role prior to validating the context. Is it possible then on requests to the Web API with authenticated tokens with the Owin Middleware to dynamically add claims prior to authorization? Idea is to add claims on particular requests (URIs) so the controller doesn't mess around with claims logic. Seems like the claims in the Owin Context in the Middleware is immutable.
Feb 19, 2015 at 7:22 AM
Got a tip from @PinPoint on Jabbr that the IAppBuilder offers nothing other entrypoint into authentication other than the UseOAuthBearerAuthentication and a custom Provider (IOAuthBearerAuthenticationProvider). Assuming the Owin Middleware is engaged only after the authentication and authorization providers whereby the claims are serialized (immutable).

Just wondering if there is another solution (obs: using the single IOAuthBearerAuthenticationProvider will probably meet my needs). Also wondering why the Owin flow and IAppBuilder don't jibe with the idea of propagating claim sets in WCF services?


thanks / Matthew