



























@ -45,13 +45,15 @@ class Client extends IndieAuthClient {
|
||||
|
||||
$authorizationEndpoint = static::discoverAuthorizationEndpoint($url);
|
||||
|
||||
if((!$authorizationEndpoint) && (!$fallbackAuthorizationEndpoint)) {
|
||||
// didn't find an auth endpoint and no fallback passed in. we're stuck.
|
||||
return self::_errorResponse('missing_authorization_endpoint', 'Could not find your authorization endpoint');
|
||||
if(!$authorizationEndpoint) {
|
||||
if(!$fallbackAuthorizationEndpoint) {
|
||||
// didn't find an auth endpoint and no fallback passed in. we're stuck.
|
||||
return self::_errorResponse('missing_authorization_endpoint', 'Could not find your authorization endpoint');
|
||||
} else {
|
||||
$authorizationEndpoint = $fallbackAuthorizationEndpoint;
|
||||
}
|
||||
}
|
||||
|
||||
$authorizationEndpoint = $fallbackAuthorizationEndpoint;
|
||||
|
||||
$scopes = self::parseNonProfileScopes($scope);
|
||||
if(count($scopes)) {
|
||||
$tokenEndpoint = static::discoverTokenEndpoint($url);
|
||||
@ -85,4 +87,29 @@ class Client extends IndieAuthClient {
|
||||
|
||||
return [$authorizationURL, false];
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrapper to create an ErrorResponse and return the array
|
||||
* (Duplicated from parent class b/c it's flagged there as private.)
|
||||
* @return array
|
||||
*/
|
||||
private static function _errorResponse($error_code, $description, $debug = null)
|
||||
{
|
||||
self::_clearSessionData();
|
||||
$error = new \IndieAuth\ErrorResponse($error_code, $description, $debug);
|
||||
return $error->getArray();
|
||||
}
|
||||
|
||||
/**
|
||||
* Duplicated from parent class b/c it's flagged there as private.
|
||||
*/
|
||||
private static function _clearSessionData()
|
||||
{
|
||||
unset($_SESSION['indieauth_entered_url']);
|
||||
unset($_SESSION['indieauth_state']);
|
||||
unset($_SESSION['indieauth_code_verifier']);
|
||||
unset($_SESSION['indieauth_authorization_endpoint']);
|
||||
unset($_SESSION['indieauth_token_endpoint']);
|
||||
unset($_SESSION['indieauth_issuer']);
|
||||
}
|
||||
}
|
||||
|
||||
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。