I am using Visual Studio 2015 Enterprise and ASP.NET vNext Beta8 to build an endpoint that both issues and consumes JWT tokens as described in detail here.
I am at the phase in my project where I want to allow the JWT bearer authentication to proceed as discussed in the article mentioned above, but once the token has been authenticated I want to:
- Step in after successful JWT authentication and inspect its various claims.
- Hydrate a scoped instance of my own principal object (say IContosoPrincipal) based on what I find in the token.
- Ensure that the backing concrete for IContosoPrincipal is scoped to the current request.
- Dependency inject IContosoPrincipal later into one of my token-guarded controllers.
I'm sure this will involve a scoped IContosoPrincipal object and I can likely figure that part out, but I'm not sure how to intercept JWT authentication after the token is successfully authenticated but before controller/action invocation takes place.
Any advice on how to approach this would be much appreciated.