Merge pull request #627 from paypal/openidconnect-url-change

Update OpenID Connect URLs to match docs
This commit is contained in:
Jay
2016-08-15 11:16:45 -05:00
committed by GitHub
3 changed files with 7 additions and 7 deletions

View File

@@ -53,7 +53,7 @@ class OpenIdSession
if ($state) {
$params['state'] = $state;
}
return sprintf("%s/v1/authorize?%s", self::getBaseUrl($config), http_build_query($params));
return sprintf("%s/authorize?%s", self::getBaseUrl($config), http_build_query($params));
}
@@ -80,7 +80,7 @@ class OpenIdSession
'redirect_uri' => $redirectUri,
'logout' => 'true'
);
return sprintf("%s/v1/endsession?%s", self::getBaseUrl($config), http_build_query($params));
return sprintf("%s/endsession?%s", self::getBaseUrl($config), http_build_query($params));
}
/**

View File

@@ -20,8 +20,8 @@ class PayPalConstants
const APPROVAL_URL = 'approval_url';
const REST_SANDBOX_ENDPOINT = "https://api.sandbox.paypal.com/";
const OPENID_REDIRECT_SANDBOX_URL = "https://www.sandbox.paypal.com/webapps/auth/protocol/openidconnect";
const OPENID_REDIRECT_SANDBOX_URL = "https://www.sandbox.paypal.com/signin";
const REST_LIVE_ENDPOINT = "https://api.paypal.com/";
const OPENID_REDIRECT_LIVE_URL = "https://www.paypal.com/webapps/auth/protocol/openidconnect";
const OPENID_REDIRECT_LIVE_URL = "https://www.paypal.com/signin";
}

View File

@@ -48,7 +48,7 @@ class OpenIdSessionTest extends \PHPUnit_Framework_TestCase
$redirectUri = 'https://devtools-paypal.com/';
$scope = array('this', 'that', 'and more');
$expectedBaseUrl = "https://www.paypal.com/webapps/auth/protocol/openidconnect/v1/authorize";
$expectedBaseUrl = "https://www.paypal.com/signin/authorize";
$this->assertEquals($expectedBaseUrl . "?client_id=$clientId&response_type=code&scope=this+that+and+more+openid&redirect_uri=" . urlencode($redirectUri),
OpenIdSession::getAuthorizationUrl($redirectUri, $scope, $clientId), "Failed case - custom scope");
@@ -71,7 +71,7 @@ class OpenIdSessionTest extends \PHPUnit_Framework_TestCase
$redirectUri = 'http://mywebsite.com';
$scope = array('this', 'that', 'and more');
$expectedBaseUrl = "https://www.paypal.com/webapps/auth/protocol/openidconnect/v1/authorize";
$expectedBaseUrl = "https://www.paypal.com/signin/authorize";
$this->assertEquals($expectedBaseUrl . "?client_id=DummyId&response_type=code&scope=this+that+and+more+openid&redirect_uri=" . urlencode($redirectUri),
OpenIdSession::getAuthorizationUrl($redirectUri, $scope, "DummyId", null, null, $this->context), "Failed case - custom config");
@@ -85,7 +85,7 @@ class OpenIdSessionTest extends \PHPUnit_Framework_TestCase
$redirectUri = 'http://mywebsite.com';
$idToken = 'abc';
$expectedBaseUrl = "https://www.paypal.com/webapps/auth/protocol/openidconnect/v1/endsession";
$expectedBaseUrl = "https://www.paypal.com/signin/endsession";
$this->assertEquals($expectedBaseUrl . "?id_token=$idToken&redirect_uri=" . urlencode($redirectUri) . "&logout=true",
OpenIdSession::getLogoutUrl($redirectUri, $idToken, $this->context), "Failed case - custom config");