Additional info: Without main firewall I don't get a token at all.If I add the main firewall I get anon. as user but not the username of the real user from the login page. What I want is a main page that is freely available but with a login/logout button for further services. When the user is logged in I want to show the name on this page.
I don't have an idea how to configure that. login: pattern: ^/profile/login$ security: false profile: pattern: ^/profile/ form_login: check_path: /profile/login_check login_path: /profile/login use_referer: true logout: path: /profile/logout target: / main: pattern: ^/$ anonymous: true regards Peter On 6 Apr., 20:40, pzwosta <peter.zwo...@gmx.de> wrote: > Sorry what I wanted to say is that the user token doesn't exist while > _security_profile does. > > GlobalVariables.php: > > public function getUser() > { > if (!$security = $this->getSecurity()) { > return; > } > > if (!$token = $security->getToken()) { > return; <<<<------ returns > } > > regards Peter > > On 5 Apr., 23:01, Christophe COEVOET <s...@notk.org> wrote: > > > > > > > > > Le 05/04/2011 22:51, pzwosta a crit :> Thanks $app-getUser() and the > > security.context exist in the container > > > but doesn't return the username though authentication was successful. > > > The username only exists in the _security_profile token of the session > > > which I don't know how to unserialize. > > > > regards Peter > > > $app->getUser() returns the User which is set in the Token by the > > UserProvider. So then call getUsername on this user (taking care that an > > anonymous user will return a string, not an object so you need to check > > for this before calling the method). > > You should not use the _security_profile token directly. > > > -- > > 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