silexphp / Silex

[DEPRECATED -- Use Symfony instead] The PHP micro-framework based on the Symfony Components
https://silex.symfony.com
MIT License
3.58k stars 718 forks source link

Unknown encoder for UserInterface #387

Closed cynddl closed 12 years ago

cynddl commented 12 years ago

With a simple login app, I received this issue when sending credentials to /admin/login_check :

RuntimeException: No encoder has been configured for account "Symfony\Component\Security\Core\User\UserInterface".

I tried to debug this but I'm stuck with this "absence"…

My code is the following (from the doc):

...
$app['security.firewalls'] = array(
    'admin' => array(
        'pattern' => '^/admin/',
        'form' => array('login_path' => '/login', 'check_path' => '/admin/login_check'),
        'users' => array(
            'admin' => array('ROLE_ADMIN', '5FZ2Z8QIkA7UTZ4BYkoC+GsReLf569mSKDsfods6LYQ8t+a8EW9oaircfMpmaLbPBh4FOBiiFyLfuZmTSUwzZg=='),
        ),
    ),
);

$app->get('/login', function(Request $request) use ($app) {
    $app['session']->start();

    return $app['twig']->render('login.twig', array(
        'error'         => $app['security.last_error']($request),
        'last_username' => $app['session']->get('_security.last_username'),
    ));
});
...

I use silex in dev version and symfony/security in last stable version (2.1).

vlastv commented 12 years ago

The problem is corrected. Update package please.