我正在研究symfony2项目,我得到了这个例外。任何人都知道造成它的原因是什么?
未捕获的异常'Symfony \ Component \ Security \ Core \ Exception \ AccessDeniedException',并在/ data / apache / www / emploipublic-sf / vendor / symfony / symfony / src / Symfony / Component / Security /中显示消息'Access Denied' HTTP /防火墙/ 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
}
}
}
答案 0 :(得分:5)
查看您的security.yml
文件(app/config/security.yml
)。
您可能拥有一些您无权访问的安全路径。看看
安全 - > access_control
部分。