mariovalney / laravel-keycloak-web-guard

Simple Keycloak Guard to Laravel Web Routes - https://packagist.org/packages/vizir/laravel-keycloak-web-guard
146 stars 80 forks source link

Target [GuzzleHttp\ClientInterface] is not instantiable while building [Vizir\KeycloakWebGuard\Services\KeycloakService]. #1

Closed ghost closed 5 years ago

ghost commented 5 years ago

Hello,

I'm facing this error when trying to use the library.

Any Idea ?

git repo : https://github.com/Jenkiiz/web_guard.git

mariovalney commented 5 years ago

Hey Jenkiiz! How are you?

I guess we missed to add the Guzzle in AppProvider.

Can you retry? I added it to repo code.

ghost commented 5 years ago

Hey ! Tried with the new version, Auth login form is still here and getting another error now : Call to undefined method Vizir\KeycloakWebGuard\Auth\Guard\KeycloakWebGuard::attempt()

The rep is up to date : https://github.com/Jenkiiz/web_guard.git I forgot a line somewhere I think

ghost commented 5 years ago

I succeded to make it work, but in a project without the default Laravel Auth system. Any Idea about this conflict ?

mariovalney commented 5 years ago

No. It's everything OK if you follow the README.

The intent of this project is to be a complete auth system to routes guarded by Keycloak.

This way, Laravel Auth system will not work with that.

You are able to implement your User model and create your own User Provider to manage Laravel stuff, but to make Keycloak work as "Facebook Login button" more work will be needed.

mariovalney commented 5 years ago

Tried with the new version, Auth login form is still here and getting another error now : Call to undefined method Vizir\KeycloakWebGuard\Auth\Guard\KeycloakWebGuard::attempt()

Attempt is used by Laravel's authentication to try to login the user into guard with credentials. In Keycloak, this is the Resource Owner Password Credentials Flow (or Direct Grant) and "it’s not recommended unless you absolutely need to."

So, the recommended way is to redirect user to Keycloak login page and proceed.

ghost commented 5 years ago

Seems to be working after deleting the default Auth files and controllers generated by make:auth. Also added the : Route::prefix('admin') ->middleware('keycloak-web') ->namespace($this->namespace) ->group(base_path('routes/web.php'));

To have the right redirections