Ah, thanks. So then let me rephrase my question: How do I configure firewalls in security.yml for a page that allows authenticated users but also showing content to anonymous users? How Do I configure it in a way that the regular user info takes precedence to the anonymous info?
I have tried the following: mypage: pattern: ^/shared_page form_login: check_path: /logincheck login_path: /login logout: path: /logout target: / anonymous: But still got the anonymous user back. On 11 Mai, 23:01, Christophe COEVOET <s...@notk.org> wrote: > Le 11/05/2011 21:30, thesaint a �crit : > > > > > > > > > I have one page that is accessible by logged in and non-logged in > > users and checks for certain roles in the controller code. In order > > that $this->get('security.context') returns something I have the > > following lines in my security.yml > > > mypage: > > pattern: ^/shared_page > > anonymous: true > > > When looking at mypage, I see in the web debug toolbar that I'm logged > > in as an anonymous user. But when I change to a secured page, I see > > that I'm loged in as a regular user. The problem with this is that I > > have the line > > > if($securityContext- > >> isGranted(AuthenticatedVoter::IS_AUTHENTICATED_ANONYMOUSLY)) { > > // do anon stuff here > > } > > > in the action for mypage which gets executed even if the user is > > logged in as someone else. How can i avoid that? > > this role is granted to all users as there is an inheritance in the > status. Allowing only anonymous users somewhere does not make sense. > so the way to check if the user is anonymous is to check if it is *not* > remembered. > > -- > Christophe | Stof -- If you want to report a vulnerability issue on symfony, please send it to security at symfony-project.com You received this message because you are subscribed to the Google Groups "symfony users" group. To post to this group, send email to symfony-users@googlegroups.com To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en