change behavior api_token_header

This commit is contained in:
aynsix
2020-08-05 19:57:53 +03:00
parent f6854caaba
commit 2e1ce43321
9 changed files with 88 additions and 15 deletions

View File

@@ -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;
}