silex-oauth
silex-oauth copied to clipboard
Allow passing of additional authorization uri parameters
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.
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();
}
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.