As I noticed here #2 (comment), UserManager.php has wrong code.
Silex now has another interface with Security provider, and we can not use
app['security']->getToken() anymore like here https://github.com/DaveC49/SimpleUser-Silex2/blob/master/src/SimpleUser/UserManager.php#L741
The correct way now is app['security.token_storage']->getToken() and app['security.token_storage']->setToken()
Btw, the next line in this method is also broken, as it tries to call 'getKey' from AnonymousToken class, which does not have one, as it was renamed to getSecret.
symfony/security-core@5835d04
So, the correct code here will be:
public function loginAsUser(User $user)
{
if (null !== ($current_token = $this->app['security.token_storage']->getToken())) {
$providerKey = method_exists($current_token, 'getProviderKey') ? $current_token->getProviderKey() : $current_token->getSecret();
$token = new UsernamePasswordToken($user, null, $providerKey);
$this->app['security.token_storage']->setToken($token);
$this->app['user'] = $user;
}
}
Also, nothing will work and web-profiler will crash after registration, because there is wrong configuration sample in README to connect this UserManager as custom UserProvider.
Wrong part:
'users' => $app->share(function($app) { return $app['user.manager']; })
Correct:
'users' => function () use ($app) {
return $app['user.manager'];
},
As I noticed here #2 (comment), UserManager.php has wrong code.
Silex now has another interface with Security provider, and we can not use
app['security']->getToken()anymore like here https://github.com/DaveC49/SimpleUser-Silex2/blob/master/src/SimpleUser/UserManager.php#L741The correct way now is
app['security.token_storage']->getToken()andapp['security.token_storage']->setToken()Btw, the next line in this method is also broken, as it tries to call 'getKey' from
AnonymousTokenclass, which does not have one, as it was renamed to getSecret.symfony/security-core@5835d04
So, the correct code here will be:
Also, nothing will work and web-profiler will crash after registration, because there is wrong configuration sample in README to connect this UserManager as custom UserProvider.
Wrong part:
'users' => $app->share(function($app) { return $app['user.manager']; })Correct: