Skip to content

Commit

Permalink
Fixed redirectUrl handling
Browse files Browse the repository at this point in the history
in OAuthUtils#getAuthorizationUrl
  • Loading branch information
Padam87 authored and stloyd committed Sep 25, 2013
1 parent b655dbd commit a15a401
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions Security/OAuthUtils.php
Expand Up @@ -65,16 +65,18 @@ public function getResourceOwners()
*/
public function getAuthorizationUrl($name, $redirectUrl = null, array $extraParameters = array())
{
$hasUser = $this->container->get('security.context')->isGranted('IS_AUTHENTICATED_REMEMBERED');
$connect = $this->container->getParameter('hwi_oauth.connect');

$resourceOwner = $this->getResourceOwner($name);
$checkPath = $this->ownerMap->getResourceOwnerCheckPath($name);

if (!$connect || !$hasUser) {
$redirectUrl = $this->generateUri($checkPath);
} elseif (null === $redirectUrl) {
$redirectUrl = $this->generateUrl('hwi_oauth_connect_service', array('service' => $name), true);
if ($redirectUrl === null) {
$connect = $this->container->getParameter('hwi_oauth.connect');
$hasUser = $this->container->get('security.context')->isGranted('IS_AUTHENTICATED_REMEMBERED');
$checkPath = $this->ownerMap->getResourceOwnerCheckPath($name);

if (!$connect || !$hasUser) {
$redirectUrl = $this->generateUri($checkPath);
} else {
$redirectUrl = $this->generateUrl('hwi_oauth_connect_service', array('service' => $name), true);
}
}

return $resourceOwner->getAuthorizationUrl($redirectUrl, $extraParameters);
Expand Down

0 comments on commit a15a401

Please sign in to comment.