mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-09 11:03:17 +00:00
use const on call
This commit is contained in:
@@ -537,7 +537,9 @@ class API_OAuth2_Adapter extends OAuth2
|
|||||||
|
|
||||||
public function verifyAccessToken($scope = null, $exit_not_present = true, $exit_invalid = true, $exit_expired = true, $exit_scope = true, $realm = null)
|
public function verifyAccessToken($scope = null, $exit_not_present = true, $exit_invalid = true, $exit_expired = true, $exit_scope = true, $realm = null)
|
||||||
{
|
{
|
||||||
$useTokenHeader = $this->app['conf']->get(['main', 'api_token_header']);
|
$apiTokenHeader = $this->app['conf']->get(['main', 'api_token_header']);
|
||||||
|
|
||||||
|
$useTokenHeader = $this->useTokenHeaderChoice($apiTokenHeader);
|
||||||
|
|
||||||
$token_param = $this->getAccessTokenParams($useTokenHeader);
|
$token_param = $this->getAccessTokenParams($useTokenHeader);
|
||||||
|
|
||||||
@@ -810,4 +812,21 @@ class API_OAuth2_Adapter extends OAuth2
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the correct constante to call on Oauth2
|
||||||
|
*
|
||||||
|
* @param $apiTokenHeader
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
private function useTokenHeaderChoice($apiTokenHeader)
|
||||||
|
{
|
||||||
|
if ($apiTokenHeader === true) {
|
||||||
|
return Oauth2::TOKEN_ONLY_IN_HEADER;
|
||||||
|
} elseif ($apiTokenHeader === false) {
|
||||||
|
return Oauth2::TOKEN_ONLY_IN_GETPOST;
|
||||||
|
} else {
|
||||||
|
return Oauth2::TOKEN_AUTO_FIND;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user