bili
bili

Reputation: 415

symfony2 access denied exception

i'm working on symfony2 project and i get this exception. anybody have an idea on what is causing it ?

Uncaught exception 'Symfony\Component\Security\Core\Exception\AccessDeniedException' with message 'Access Denied' in /data/apache/www/emploipublic-sf/vendor/symfony/symfony/src/Symfony/Component/Security/Http/Firewall/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
    }
}
}

Upvotes: 1

Views: 8548

Answers (1)

Alex
Alex

Reputation: 1183

Look at your security.yml file (app/config/security.yml).

You may have some secure path which you do not have access to. Check out

security -> access_control

section.

Upvotes: 5

Related Questions