Giter Club home page Giter Club logo

Comments (7)

hsluoyz avatar hsluoyz commented on May 27, 2024

@sagilio

from casbin-aspnetcore.

thoraj avatar thoraj commented on May 27, 2024

The redirect is because of config issues in my Startup.cs

But it would be good to know whether you believe the Middleware and CasbinAuthorize attribute should work OK when using bearer token authentication.

from casbin-aspnetcore.

thoraj avatar thoraj commented on May 27, 2024

Seems to be working with bearer token , but I have to use both standard and casbin attribute:

[Authorize]
[CasbinAuthorize]
public IActionResult MyAction(...)

Is this intended?

from casbin-aspnetcore.

sagilio avatar sagilio commented on May 27, 2024

Is this code work? :

[CasbinAuthorize(AuthenticationSchemes = JwtBearerDefaults.AuthenticationScheme)]
public IActionResult MyAction(...)

from casbin-aspnetcore.

sagilio avatar sagilio commented on May 27, 2024

Seems to be working with bearer token , but I have to use both standard and casbin attribute:

[Authorize]
[CasbinAuthorize]
public IActionResult MyAction(...)

Is this intended?

No.
Now, casbin middleware does not read the default policy or fallback policy in AuthorizationOptions, So it will not use the AuthenticationSchemes in the default policy.
But, I think we should not read those policies, we will provide AuthenticationSchemes options for this case.

from casbin-aspnetcore.

thoraj avatar thoraj commented on May 27, 2024

I tried [CasbinAuthorize(AuthenticationSchemes = JwtBearerDefaults.AuthenticationScheme)]

And it works. I don't need the extra [Authorize] attribute, and I get 401 when token is missing as expected.

Then I removed AuthenticationSchemes = JwtBearerDefaults.AuthenticationScheme And it still works. Now I'm not able reprodue the issue.

from casbin-aspnetcore.

github-actions avatar github-actions commented on May 27, 2024

:tada: This issue has been resolved in version 0.2.0 :tada:

The release is available on GitHub release

Your semantic-release bot 📦🚀

from casbin-aspnetcore.

Related Issues (20)

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.