This functionality is simply implemented using the following recipe ...
https://github.com/remiq/apigility-zfc-rbac-recipe
It worked very well, and it only took a few hours for it to work.
Alternatively, you can simply perform a check in the controller action (resource method)
$identity = $this->getIdentity()->getAuthenticationIdentity();
$scope = $identity["scope"]
if (! in_array('admin', $scope)) {
return new ApiProblem(Response::STATUS_CODE_401, 'No Auth');
}
The above code is untested, but should get you on the right track if you want to do it this way
source
share