Giter VIP home page Giter VIP logo

Comments (2)

mrsheepuk avatar mrsheepuk commented on September 3, 2024

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.

mrsheepuk avatar mrsheepuk commented on September 3, 2024

@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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.