-
-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The deny_by_default TRUE setting should not block apigility admin #22
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.
Originally posted by @pietervogelaar at zfcampus/zf-mvc-auth#43 (comment) |
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 Originally posted by @EMCP at zfcampus/zf-mvc-auth#43 (comment) |
@pietervogelaar where do you put this array? Originally posted by @EMCP at zfcampus/zf-mvc-auth#43 (comment) |
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);
}
} Originally posted by @stavarengo at zfcampus/zf-mvc-auth#43 (comment) |
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?
Originally posted by @pietervogelaar at zfcampus/zf-mvc-auth#43
The text was updated successfully, but these errors were encountered: