Fixed missing scopes from endpoints due a lv cache bug
Change-Id: I6eeba6b76b5bc933e162d223fd7d806fa6d776fb
This commit is contained in:
parent
c0b2758e4e
commit
b8db89260e
@ -160,11 +160,9 @@ class OAuth2BearerAccessTokenRequestValidator
|
||||
}
|
||||
//check scopes
|
||||
Log::debug('checking token scopes ...');
|
||||
$endpoint_scopes = $endpoint->getScope();
|
||||
Log::debug(sprintf("endpoint scopes %s", $endpoint_scopes));
|
||||
$endpoint_scopes = $endpoint->getScopesNames();
|
||||
Log::debug(sprintf("endpoint scopes %s", implode(' ',$endpoint_scopes)));
|
||||
Log::debug(sprintf("token scopes %s", $token_info->getScope()));
|
||||
|
||||
$endpoint_scopes = explode(' ', $endpoint_scopes);
|
||||
$token_scopes = explode(' ', $token_info->getScope());
|
||||
|
||||
//check token available scopes vs. endpoint scopes
|
||||
|
@ -255,26 +255,28 @@ class ApiEndpoint extends ResourceServerEntity implements IApiEndpoint
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getScope()
|
||||
public function getFriendlyScopes():string
|
||||
{
|
||||
return CacheFacade::remember
|
||||
(
|
||||
'endpoint_scopes_'.$this->id,
|
||||
Config::get("cache_regions.region_api_scopes_lifetime", 1140),
|
||||
function() {
|
||||
$scope = '';
|
||||
foreach ($this->scopes as $s) {
|
||||
if (!$s->isActive()) {
|
||||
continue;
|
||||
}
|
||||
$scope = $scope . $s->getName() . ' ';
|
||||
}
|
||||
$scope = trim($scope);
|
||||
return $scope;
|
||||
}
|
||||
);
|
||||
$scopes = $this->getScopesNames();
|
||||
return implode(' ', $scopes);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string[]
|
||||
*/
|
||||
public function getScopesNames(): array {
|
||||
$scopes = [];
|
||||
|
||||
foreach ($this->scopes as $s) {
|
||||
if (!$s->isActive()) {
|
||||
continue;
|
||||
}
|
||||
$scopes[] = $s->getName();
|
||||
}
|
||||
|
||||
return $scopes;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param IApiScope $scope
|
||||
*/
|
||||
|
@ -57,7 +57,12 @@ interface IApiEndpoint extends IEntity
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getScope();
|
||||
public function getFriendlyScopes();
|
||||
|
||||
/**
|
||||
* @return string[]
|
||||
*/
|
||||
public function getScopesNames(): array;
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
|
Loading…
x
Reference in New Issue
Block a user