symfony security - Symfony2 secure whole controller -
im having different user-actions within controller. want secure them anonymous users cant access actions. (they not rely special prefix-path)
according to: http://symfony.com/doc/current/book/security.html#securing-a-controller
i have secure every action seperate. not handy , produces duplicate code.
is there possibility throw accessdenied exception actions of controller?
you need secure in security.yml
right access_control
section is:
this how 1 of projects like.
access_control: - { path: ^/oauth, role: role_user }
now in controller, in case first line, add together next annotation @ top of class:
/** * class oauthcontroller * @package mynamespace\mybundle\controller * @route("/oauth") */ class oauthcontroller extends controller { }
and whole controller secured.
symfony2 symfony-security
No comments:
Post a Comment