0

It's been some times now that I'm struggling to make the autologin work on my Silex project.

I've been using the Silex doc to implement the RememberMeServiceProvider (http://silex.sensiolabs.org/doc/providers/remember_me.html) so that my app.php looks like that :

$app->register(new Silex\Provider\SecurityServiceProvider(), array(
    'security.firewalls' => array(
        'secured' => array(
            'pattern' => '^/',
            'anonymous' => true,
            'logout' => true,
            'form' => array('login_path' => '/login', 'check_path' => '/login_check', 'always_use_default_target_path' => true, 'default_target_path' => '/login/redirect'),
            'remember_me' => array(
                'key' => MD5('secret_key'),
                'always_remember_me' => true,
            ),
            'users' => $app->share(function () use ($app) {
                return new MyProject\DAO\UserDAO($app['db']);
            }),
        ),
    ),
    'security.role_hierarchy' => array(
        'ROLE_ADMIN' => array('ROLE_USER'),
    ),
    'security.access_rules' => array(
        array('^/admin', 'ROLE_ADMIN'),
    ),
));

$app->register(new Silex\Provider\RememberMeServiceProvider());

For now, when I log in, a REMEMBERME cookie is set (by default for a year).

But when I close my browser and come back on my project, no auto-login is done... The cookie is still there.

Anyone could help me making the autologin work?

Thank you very much in advance.

Hackay
  • 11
  • 3

1 Answers1

1

Just a little up, I'm still struggling with that auto authentication problem... Anyone could help me out? Thank you very much!

EDIT : After knocking my head on my desk for 2 days, I finally figured my problem out. If it can help anyone: I just forgot to add the IS_AUTHENTICATED_REMEMBERED condition wherever I used the IS_AUTHENTICATED_FULLY one... Check that thread for more details.

Community
  • 1
  • 1
Hackay
  • 11
  • 3