If I know who is my user, and I want tell to symfony that is logged in with a ROLE_USER role. Is this code enough? I enough, assign a token to current session?
$request->getSession()->set(
'_security_secured_area',
serialize(new UsernamePasswordToken(
$user = new User(
'foo',
'bar',
['ROLE_USER']
),
null,
'secured_area',
$user->getRoles()
))
);