rest - How to activate authorization only for some of HTTP methods in Apigility? -
on configuration page {api name} -> {service name} -> authorization
single methods service can put under authentication:
in page can specify http methods put under authentication, entity , collection service.
e.g.:
if anderstand correctly, checked methods should require authorization , other ones not.
i have 2 services in application: user
, address
. problem is: wheter activate authorization 1 of them or not, or if authorization deactivated methods of services -- moment, when choose auth type api, every request requires authentication , returns status code 401
, if no credentials sent.
what can wrong here? how put methods under authentication?
update
the relevant configs:
/config/autoload/global.php
return array( ... 'zf-mvc-auth' => array( 'authentication' => array( 'map' => array( 'addressbookapi\\v1' => 'demo', ), ), ), );
/config/autoload/local.php
return array( ... 'zf-mvc-auth' => array( 'authentication' => array( 'adapters' => array( 'demo' => array( 'adapter' => 'zf\\mvcauth\\authentication\\httpadapter', 'options' => array( 'accept_schemes' => array( 0 => 'basic', ), 'realm' => 'demo', 'htpasswd' => 'data/users.htpasswd', ), ), ), ), ), );
/module/addressbookapi/config/module.config.php
return array( ... 'zf-mvc-auth' => array( 'authorization' => array( 'addressbookapi\\v1\\rest\\user\\controller' => array( 'collection' => array( 'get' => false, 'post' => false, 'put' => false, 'patch' => false, 'delete' => false, ), 'entity' => array( 'get' => true, 'post' => false, 'put' => false, 'patch' => false, 'delete' => false, ), ), 'addressbookapi\\v1\\rest\\address\\controller' => array( 'collection' => array( 'get' => false, 'post' => false, 'put' => false, 'patch' => false, 'delete' => false, ), 'entity' => array( 'get' => false, 'post' => false, 'put' => false, 'patch' => false, 'delete' => false, ), ), ), ), );
i believe kind of bug on side, because in api works think should work.
Comments
Post a Comment