zend framework2 - How to check for oAuth2 scopes in Apigility? -


i creating apigility project hosting of our apis. need able use oauth2 authentication cannot figure out how control access apis, seems once client authenticates, can use of our apis want limit them use specific ones define. after reading oauth2 library apigility uses, saw there scopes can defined have not found documentation how check user's scope see if have access. want find out if best way restrict access apis , how set if is, or there better way control access?

just implemented functionality using following recipe ...

https://github.com/remiq/apigility-zfc-rbac-recipe

it worked , took few hours working.

alternatively can checking in 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 untested should on right path if wanted way


Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -