php - FOS user bundle doesn't keep logged session -
i have integrated fos user bundle quick guide tells do. seem work except once log in , redirects loses session reason , i'm anonymous user.
this when log in before i'm redirect back:
as can see i'm logged in , should redirect homepage. when i'm on homepage i'm redirected login because check if user logged in or not. somehow not remember logged in.
this configuration security.xml
security: encoders: fos\userbundle\model\userinterface: bcrypt role_hierarchy: role_admin: role_user role_super_admin: [role_user, role_admin, role_allowed_to_switch] # http://symfony.com/doc/current/book/security.html#where-do-users-come-from-user-providers providers: in_memory: memory: ~ fos_userbundle: id: fos_user.user_provider.username firewalls: main: pattern: ^/ form_login: check_path: /login_check login_path: /login provider: fos_userbundle default_target_path: / logout: true anonymous: true access_control: - { path: ^/login$, role: is_authenticated_anonymously } - { path: ^/register, role: is_authenticated_anonymously } - { path: ^/resetting, role: is_authenticated_anonymously } - { path: ^/admin/, role: role_admin }
config.yml
fos_user: db_driver: orm # other valid values 'mongodb', 'couchdb' , 'propel' firewall_name: main user_class: userbundle\entity\user
i added bundle app kernel , created user entity. when run doctrine command creates user table, etc...
i have working fine in project, difference project i'm using docker. cause problem?
edit: code use check if user logged in:
if(!$this->container->get('security.authorization_checker')->isgranted('is_authenticated_fully') ){ return $this->redirect($this->generateurl('fos_user_security_login')); }
and toolbar shows me anonymous after login_check redirects.
it brought attention if mysave_path
under /var/www/project
mounted on local machine not work.
so in config.yml commented out handler_id
, changed thesave_path
value ~
Comments
Post a Comment