-
Notifications
You must be signed in to change notification settings - Fork 46
The deny_by_default TRUE setting should not block apigility admin #43
Comments
If anyone is looking for the same, I had to add the following to the configuration to make the Apigility Admin work with deny_by_default TRUE.
|
I think MVC-Auth users need to decide whether this default behavior is acceptable and the work around documented. OR it's not acceptable and strategizing something else. Personally I'm rather stuck debugging all these |
@pietervogelaar where do you put this array? |
I know it's a little bit late, but I think I have a better solution than add all of the zf-apigility-admin's controllers to the config file. use Zend\EventManager\AbstractListenerAggregate;
use Zend\EventManager\EventManagerInterface;
use ZF\MvcAuth\MvcAuthEvent;
/**
* This listener makes the zf-mvc-auth module allow all requests from zf-apigility-admin-ui when the 'deny_by_default'
* flag is true.
*/
class AllowAllApigilityRequests extends AbstractListenerAggregate
{
public function __invoke(MvcAuthEvent $authEvent)
{
$mvcEvent = $authEvent->getMvcEvent();
$routeMatch = $mvcEvent->getRouteMatch();
if (!$routeMatch) {
return;
}
if (strpos((string)$routeMatch->getMatchedRouteName(), 'zf-apigility') === 0) {
/** @var \ZF\MvcAuth\Authorization\AclAuthorization $authorization */
$authorization = $authEvent->getAuthorizationService();
$authorization->allow($authorization->getRoles());
}
}
/**
* Attach one or more listeners
*
* Implementors may add an optional $priority argument; the EventManager
* implementation will pass this to the aggregate.
*
* @param EventManagerInterface $events
*
* @return void
*/
public function attach(EventManagerInterface $events)
{
$this->listeners[] = $events->attach(MvcAuthEvent::EVENT_AUTHORIZATION, $this, 2);
}
} |
This repository has been closed and moved to laminas-api-tools/api-tools-mvc-auth; a new issue has been opened at laminas-api-tools/api-tools-mvc-auth#22. |
If deny_by_default is set to TRUE, the application home route, Apigility admin, documentation route and the swagger documentation routes are also blocked. Is this really desirable?
If yes, what is an easy way to figure out what all the apigility admin controllers are?
The text was updated successfully, but these errors were encountered: