mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-08 10:34:34 +00:00
change behavior api_token_header
This commit is contained in:
@@ -537,7 +537,7 @@ 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)
|
||||
{
|
||||
$apiTokenHeader = $this->app['conf']->get(['main', 'api_token_header']);
|
||||
$apiTokenHeader = $this->app['conf']->get(['registry', 'api-clients', 'api_token_header_only']);
|
||||
|
||||
$useTokenHeader = $this->useTokenHeaderChoice($apiTokenHeader);
|
||||
|
||||
@@ -816,15 +816,13 @@ class API_OAuth2_Adapter extends OAuth2
|
||||
/**
|
||||
* Get the correct constante to call on Oauth2
|
||||
*
|
||||
* @param $apiTokenHeader
|
||||
* @param $apiTokenHeaderOnly
|
||||
* @return string
|
||||
*/
|
||||
private function useTokenHeaderChoice($apiTokenHeader)
|
||||
private function useTokenHeaderChoice($apiTokenHeaderOnly)
|
||||
{
|
||||
if ($apiTokenHeader === true) {
|
||||
if ($apiTokenHeaderOnly === 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