Comments (2)
That should work - I've only used policy-based authorisation myself (which
seems to be the more recommended way of doing things for AST.NET 5 / MVC
6), but I don't know of any reason why roles-based authorisation would be a
problem.
On Mon, 28 Dec 2015 12:20 originalmoose [email protected] wrote:
Is it possible to use this method to authorize a route based on the users
role? I was able to put the roles into the claims just fine but when I
attempt to add the Authorize attribute with the roles property set I get an
unauthorized result back—
Reply to this email directly or view it on GitHub
#7.
from aspnetselfcreatedtokenauthexample.
@originalmoose did you sort this out? It sounds to me like you've confused claims and roles - they're not the same thing, I don't believe, so putting the roles into claims isn't the right thing to do. If the principal that you use to generate the token has the roles associated with it, it should probably "just work" - although as I say I haven't tested it.
The docs on this are pretty good - worth having a read if you're still having trouble.
Closing as this isn't really an issue with the token auth strategy, more a question about roles/claims authorisation in ASP.NET 5. Please re-open if there's something specific to the token-based auth that is causing trouble!
from aspnetselfcreatedtokenauthexample.
Related Issues (14)
- No SecurityTokenValidator available for token HOT 3
- Add a comment regarding middleware ordering HOT 2
- Running on CoreCLR on Linux HOT 2
- TokenController HOT 2
- User.GetUserId() doesn't work while using token authentication HOT 8
- Integrating with ASP Core Identity.. HOT 3
- Can't run HOT 1
- netcoreapp 1.0 HOT 2
- Update to core 1.1 HOT 3
- Sliding expiration for token HOT 2
- Add "refresh token" functionality to retrieve new tokens HOT 2
- Is RSAParametersWithPrivate really required? HOT 6
- HMAC-SHA signing with secret HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from aspnetselfcreatedtokenauthexample.