symfony2访问被拒绝的异常

bil*_*ili 1 php symfony web

我正在研究symfony2项目,我得到了这个例外.谁知道造成它的原因是什么?

未捕获的异常'Symfony\Component\Security\Core\Exception\AccessDeniedException',在/ data/apache/www/emploipublic-sf/vendor/symfony/symfony/src/Symfony/Component/Security/Http/Firewall中显示消息'Access Denied' /AccessListener.php:70\n

class AccessListener implements ListenerInterface
{  
private $context;
private $accessDecisionManager;
private $map;
private $authManager;
private $logger;

public function __construct(SecurityContextInterface $context, AccessDecisionManagerInterface $accessDecisionManager, AccessMapInterface $map, AuthenticationManagerInterface $authManager, LoggerInterface $logger = null)
{
    $this->context = $context;
    $this->accessDecisionManager = $accessDecisionManager;
    $this->map = $map;
    $this->authManager = $authManager;
    $this->logger = $logger;
}

/**
 * Handles access authorization.
 *
 * @param GetResponseEvent $event A GetResponseEvent instance
 */
public function handle(GetResponseEvent $event)
{
    if (null === $token = $this->context->getToken()) {
        throw new AuthenticationCredentialsNotFoundException('A Token was not found in the SecurityContext.');
    }

    $request = $event->getRequest();

    list($attributes, $channel) = $this->map->getPatterns($request);

    if (null === $attributes) {
        return;
    }

    if (!$token->isAuthenticated()) {
        $token = $this->authManager->authenticate($token);
        $this->context->setToken($token);
    }

    if (!$this->accessDecisionManager->decide($token, $attributes, $request)) {
        throw new AccessDeniedException();  // this is line 70
    }
}
}
Run Code Online (Sandbox Code Playgroud)

小智 5

看看你的security.yml文件(app/config/security.yml).

您可能拥有一些您无权访问的安全路径.查看

安全 - > access_control

部分.