silex-oauth icon indicating copy to clipboard operation
silex-oauth copied to clipboard

Allow passing of additional authorization uri parameters

Open oniric85 opened this issue 9 years ago • 2 comments

I see that authorization uri is built here https://github.com/gigablah/silex-oauth/blob/master/src/Security/Firewall/OAuthAuthenticationListener.php#L135

The method getAuthorizationUri accepts an array of parameters so it would be cool if we could use that to pass additional information during the uri build process. I'm asking this because I would like to dinamically configure an authorization url parameter and, untill now, I've failed to find an alternative solution.

oniric85 avatar Feb 01 '16 15:02 oniric85

I could have the dispatcher fire an event with the authorization params array, so you could modify it with an event listener. Would that solve your issue?

if (null !== $this->dispatcher) {
    $authEvent = new FilterAuthEvent($authorizationParameters);
    $this->dispatcher->dispatch(OAuthEvents::AUTH, $authEvent);
    $authorizationParameters = $authEvent->getAuthorizationParameters();
}

gigablah avatar Feb 01 '16 16:02 gigablah

Thanks for your reply, I thought about such an approach. It seems quite reasonable, only other option I thought about is to allow passing query string parameters to service login_url which are then passed to the authorization url before the redirect. Not sure if this is as clean as the dispatcher approach.

oniric85 avatar Feb 01 '16 18:02 oniric85