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

Adding optional scopes #100

Closed Murielle666 closed 6 months ago

Murielle666 commented 1 year ago

We have optional scopes in keycloak but there is no way to add these to the keycloak-web.php. Currently KeycloakService only uses openid.

I would like to add a new configuration option for these optional scopes and add them to the login url.

Something like this: keycloak-web.php

'optional_scopes' => ['scope1', 'scope2', 'scope4']

KeycloakService.php __construct

$this->scopes = ['openid'];
$this->scopes = array_merge($this->scopes, Config::get('keycloak-web.optional_scopes'));

KeycloakService.php getLoginUrl

$params = [
      'scope' => implode(' ', $this->scopes),
       ...
];