mirror of
https://github.com/elyby/oauth2-server.git
synced 2024-12-22 21:19:46 +05:30
PSR fixes
This commit is contained in:
parent
c760667448
commit
9dfa485bcb
@ -96,20 +96,20 @@ abstract class IDP
|
|||||||
/**
|
/**
|
||||||
* Returns the authorization URL for the provider.
|
* Returns the authorization URL for the provider.
|
||||||
*
|
*
|
||||||
* $url = $provider->url_authorize();
|
* $url = $provider->urlAuthorize();
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
abstract public function url_authorize();
|
abstract public function urlAuthorize();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the access token endpoint for the provider.
|
* Returns the access token endpoint for the provider.
|
||||||
*
|
*
|
||||||
* $url = $provider->url_access_token();
|
* $url = $provider->urlAccessToken();
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
abstract public function url_access_token();
|
abstract public function urlAccessToken();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Get an authorization code from Facebook. Redirects to Facebook, which this redirects back to the app using the redirect address you've set.
|
* Get an authorization code from Facebook. Redirects to Facebook, which this redirects back to the app using the redirect address you've set.
|
||||||
@ -128,7 +128,7 @@ abstract class IDP
|
|||||||
'approval_prompt' => 'force' // - google force-recheck
|
'approval_prompt' => 'force' // - google force-recheck
|
||||||
);
|
);
|
||||||
|
|
||||||
redirect($this->url_authorize().'?'.http_build_query($params));
|
redirect($this->urlAuthorize().'?'.http_build_query($params));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -145,8 +145,8 @@ abstract class IDP
|
|||||||
'grant_type' => isset($options['grant_type']) ? $options['grant_type'] : 'authorization_code',
|
'grant_type' => isset($options['grant_type']) ? $options['grant_type'] : 'authorization_code',
|
||||||
);
|
);
|
||||||
|
|
||||||
switch ($params['grant_type'])
|
switch ($params['grant_type']) {
|
||||||
{
|
|
||||||
case 'authorization_code':
|
case 'authorization_code':
|
||||||
$params['code'] = $code;
|
$params['code'] = $code;
|
||||||
$params['redirect_uri'] = isset($options['redirect_uri']) ? $options['redirect_uri'] : $this->redirect_uri;
|
$params['redirect_uri'] = isset($options['redirect_uri']) ? $options['redirect_uri'] : $this->redirect_uri;
|
||||||
@ -155,13 +155,14 @@ abstract class IDP
|
|||||||
case 'refresh_token':
|
case 'refresh_token':
|
||||||
$params['refresh_token'] = $code;
|
$params['refresh_token'] = $code;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$response = null;
|
$response = null;
|
||||||
$url = $this->url_access_token();
|
$url = $this->urlAccessToken();
|
||||||
|
|
||||||
|
switch ($this->method) {
|
||||||
|
|
||||||
switch ($this->method)
|
|
||||||
{
|
|
||||||
case 'GET':
|
case 'GET':
|
||||||
|
|
||||||
// Need to switch to Request library, but need to test it on one that works
|
// Need to switch to Request library, but need to test it on one that works
|
||||||
@ -205,13 +206,14 @@ abstract class IDP
|
|||||||
throw new OutOfBoundsException("Method '{$this->method}' must be either GET or POST");
|
throw new OutOfBoundsException("Method '{$this->method}' must be either GET or POST");
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ! empty($return['error']))
|
if ( ! empty($return['error'])) {
|
||||||
{
|
|
||||||
throw new OAuth2_Exception($return);
|
throw new OAuth2_Exception($return);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
switch ($params['grant_type'])
|
switch ($params['grant_type']) {
|
||||||
{
|
|
||||||
case 'authorization_code':
|
case 'authorization_code':
|
||||||
return OAuth2_Token::factory('access', $return);
|
return OAuth2_Token::factory('access', $return);
|
||||||
break;
|
break;
|
||||||
@ -219,6 +221,7 @@ abstract class IDP
|
|||||||
case 'refresh_token':
|
case 'refresh_token':
|
||||||
return OAuth2_Token::factory('refresh', $return);
|
return OAuth2_Token::factory('refresh', $return);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user