I'm attempting to use annotations to secure my controllers:
namespace Vinny\StreamBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use JMS\SecurityExtraBundle\Annotation\Secure;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
class HomeController extends Controller
{
/**
* @Route("/home", name="home")
* @Secure(roles="ROLE_USER")
*/
public function indexAction()
{
...
But I can't seem to get my controllers to actually be secured. Is there any instances on which this would be ignored?
On an almost completely unrelated note, the issue of my problem didn't stem from anything in my configuration or controller, but was an migration mixup from the switch from Symfony 2.0 to Symfony 2.1. I was failing to register the JMSDiExtraBundle which was silently crippling the JMSSecurityExtraBundle's (and others') annotations.
In my AppKernel.php, I had been missing:
With that everything works fine, again.
You need to try with
ROLE_ADMIN
orROLE_SUPER
and then see if its secured or not.ROLE_USER
is the deafult role applied to all users , so u are allowed