Giter Site home page Giter Site logo

Comments (6)

mariovalney avatar mariovalney commented on August 17, 2024

Hi. Would you please try to run php artisan route:clear ?

https://stackoverflow.com/a/37879020

from laravel-keycloak-web-guard.

thomas2312 avatar thomas2312 commented on August 17, 2024

It is not possible to do run php artisan route:clear, because I also get this Exception:

 Symfony\Component\Routing\Exception\RouteNotFoundException 

  Route [keycloak.callback] not defined.

  at C:\xampp\htdocs\laravel\vendor\laravel\framework\src\Illuminate\Routing\UrlGenerator.php:429

I can run the command, but I have to remove the following code from the AuthServiceProvider.php before:

 if (Gate::denies('keycloak-web', 'auth')) {
      return abort(403);
 }

But that was not the solution of my problem.

from laravel-keycloak-web-guard.

mariovalney avatar mariovalney commented on August 17, 2024

I was not able to reproduce the problem.
I have two routes to check just login and to check Gate in my example environment and everything is OK.

You are not required to use Gate to make sure a URL is private. Indeed you should use gate to check the user has a specific role. In your case, are you trying to check the user has the 'auth' role in Keycloak?

After 5 minutes:

Now I figured you are using Gate in boot method. Why?
I guess it's too early.

from laravel-keycloak-web-guard.

thomas2312 avatar thomas2312 commented on August 17, 2024

Yes, a login should be only possible, if the user has the 'auth' role.
I want to do this check as soon as possible.

from laravel-keycloak-web-guard.

mariovalney avatar mariovalney commented on August 17, 2024

Please. Try to do this in controller layer.

from laravel-keycloak-web-guard.

thomas2312 avatar thomas2312 commented on August 17, 2024

Thank you. I solved it with a custom Middleware.

from laravel-keycloak-web-guard.

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.