Owin-Authorization | Net core 's policy based authorization | Authorization library
kandi X-RAY | Owin-Authorization Summary
kandi X-RAY | Owin-Authorization Summary
Backport of Asp.Net core's policy based authorization to Asp.Net 4
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of Owin-Authorization
Owin-Authorization Key Features
Owin-Authorization Examples and Code Snippets
Community Discussions
Trending Discussions on Owin-Authorization
QUESTION
I have separated the Authorisation server and the resource sever. I'm able to validate the client and the resource owner in the Authorisation and server and generate an access token. But how do I pass it resource sever, I passed in the header but I still get the "Authorization has been denied for this request".
I followed this http://bitoftech.net/2014/09/24/decouple-owin-authorization-server-resource-server-oauth-2-0-web-api/
and gave the same MachineKey for both servers but no luck. Does anyone know how this works? how the Auth server and the resource sever communicate with each other?
...ANSWER
Answered 2017-Apr-11 at 15:44I found what was wrong. Securiry.OAuth NuGet package has to match on both projects. ie the version number. So installed the same version for both projects
QUESTION
I followed this article to get JWTs issued from .Net Web API http://bitoftech.net/2014/10/27/json-web-token-asp-net-web-api-2-jwt-owin-authorization-server/
TL;DR
How can I add additional logic to the Authorize attribute to check a database table against a specific claim within the JWT, perhaps within JwtBearerAuthenticationOptions?
Longer version...
It's working fine for generating the JWT and also validating it when firing a request against a controller including the Authorization header...
Basically, what the article doesn't go into is Revocation...
After a lot of googling I see there are several ways of handling Revocation with JWTs.
I have chosen the 'Whitelist' route and so have created a table to store the UserId, ClientId (Audience) and a column containing a JTI value (GUID).
Basically, I want to add additional logic to the [Authorize] attribute to also check this table for a matching JTI for the given User and ClientId...
Is this doable without having to write a custom 'JWTAuthorize' Attribute as I would quite like to use the default...
I suspect it's something that needs specifying within JwtBearerAuthenticationOptions?
Cheers!
...ANSWER
Answered 2018-Sep-04 at 09:25I've managed to get this working using a custom provider on the JwtBearerAuthenticationOptions.
The provider inherits from IOAuthBearerAuthenticationProvider and then I specifically use the ValidateIdentity method to handle the additional logic.
QUESTION
I tried to implement OAuth2 authentication and authorization. I have an authorization server and a resource server. The client logs in to the authorization server (sends the username and password to the authorization server) and the authorization server returns an access_token. The client uses the access_token in order to ask for any resource with an [Authorize] tag from the resource_server.
The authentication part (sending credentials to the authorization server and getting back an access_token) works fine. I get a valid JWT token. The problem is that the resource server does not recognize the access_token. Everytime the client sends a request to get a resource that has an [Authorize] tag I get : '401 Unauthorized Authorization has been denied for this request'.
This is a list of things I tried/verified:
- I checked for Microsoft.Owin.Security.OAuth to be the exact same version on both resource and authorization server (version 2.1.0)
- I checked for the client_id and secret to be the exact same version on both resource and authorization server
- I made sure that there is the exact same machine key on both resource and authorization server (same values in web.config files and in iis)
- I checked for iis to have anonymous authentication enabled (and any other form of authentication disabled)
- I have CORS enabled everywhere
- The both servers are on the same machine.
- I verified the request to the resource server and the token is sent in the Authorization header like this:
Authorization:JWT eyJ0eXAiO.......JuRpuf6yWg
- I sent the same request with postman, but I get the same response
My implementation is based on these two tutorials:
- http://bitoftech.net/2014/09/24/decouple-owin-authorization-server-resource-server-oauth-2-0-web-api/
- http://bitoftech.net/2014/10/27/json-web-token-asp-net-web-api-2-jwt-owin-authorization-server/
This is the Startup.cs class in my resource server:
...ANSWER
Answered 2017-Jun-11 at 15:40[SOLVED]: It should be Authorization:Bearer eyJ0eXAiO.......JuRpuf6yWg
(Bearer NOT JWT!)
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install Owin-Authorization
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page