Your access_control
part looks wrong in app/config/security.yml :
- { path: ^/admin, roles: IS_AUTHENTICATED_REMEMBERED}
# You should remove following line
# - { path: ^/admin, roles: ROLE_AUTHENTICATED}
Question
i have a problem with remember me functionality with symfony2 ajax login. Here is my firewall configuration:
firewalls:
secured_front:
pattern: ^/admin/*
anonymous: ~
remember_me:
key: "%secret%"
lifetime: 31536000
domain: ~
path: /
remember_me_parameter: _remember_me
form_login:
login_path: /#login
check_path: /admin/login_check
default_target_path: /admin
remember_me: true
success_handler: front_authentication_handler
failure_handler: front_authentication_handler
logout:
path: /admin/logout
Here is what i send to the login_checl:
ajaxData['_username'] = $(this.form).find('#username').val();
ajaxData['_password'] = $(this.form).find('#password').val();
$(this.form).find('#rememberMe').is(':checked');
if($(this.form).find('#rememberMe').is(':checked')){
ajaxData['_remember_me'] = 'on';
}
Here is the configuration. which should allow remembered users to access "/admin" url:
- { path: ^/admin, roles: IS_AUTHENTICATED_REMEMBERED}
- { path: ^/admin, roles: ROLE_AUTHENTICATED}
The problem is, that it doesn`t work. After closing the browser, opening it and trying to access a secured url "/admin" it wants an authentication again. If you need more information, ask for it in the comment section. Thanks for the time.
No correct solution
OTHER TIPS
Your access_control
part looks wrong in app/config/security.yml :
- { path: ^/admin, roles: IS_AUTHENTICATED_REMEMBERED}
# You should remove following line
# - { path: ^/admin, roles: ROLE_AUTHENTICATED}