From 6501e958cc77b4c57c1bf3b4bb4e1708ed317473 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Sat, 20 Jul 2013 14:33:50 +0200 Subject: [PATCH] fix security context example code --- components/security/firewall.rst | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/components/security/firewall.rst b/components/security/firewall.rst index 0251cb269f1..fe9b5c3760d 100644 --- a/components/security/firewall.rst +++ b/components/security/firewall.rst @@ -10,10 +10,16 @@ steps in the process of authenticating the user have been taken successfully, you can ask the security context if the authenticated user has access to a certain action or resource of the application:: - use Symfony\Component\Security\SecurityContext; + use Symfony\Component\Security\Core\SecurityContext; use Symfony\Component\Security\Core\Exception\AccessDeniedException; + + // instance of Symfony\Component\Security\Core\Authentication\AuthenticationManagerInterface + $authenticationManager = ...; - $securityContext = new SecurityContext(); + // instance of Symfony\Component\Security\Core\Authorization\AccessDecisionManagerInterface + $accessDecisionManager = ...; + + $securityContext = new SecurityContext($authenticationManager, $accessDecisionManager); // ... authenticate the user @@ -21,6 +27,11 @@ certain action or resource of the application:: throw new AccessDeniedException(); } +.. note:: + + Read the dedicated sections to learn more about :doc:`/components/security/authentication` + and :doc:`/components/security/authorization`. + .. _firewall: A Firewall for HTTP Requests