Skip to content
This repository was archived by the owner on Jul 26, 2018. It is now read-only.

Commit e289119

Browse files
committed
bug #5 remove need to save token to session (kbond)
This PR was merged into the master branch. Discussion ---------- remove need to save token to session This is handled by the ContextListener Commits ------- e4cc0a3 remove need to save token to session
2 parents 4024da7 + e4cc0a3 commit e289119

1 file changed

Lines changed: 1 addition & 7 deletions

File tree

Security/Security.php

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111

1212
namespace EasyCorp\Bundle\EasySecurityBundle\Security;
1313

14-
use Symfony\Component\HttpFoundation\Session\Session;
1514
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
1615
use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken;
1716
use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface;
@@ -33,16 +32,14 @@ class Security
3332
private $authorizationChecker;
3433
private $passwordEncoder;
3534
private $authenticationUtils;
36-
private $session;
3735
private $roleHierarchy;
3836

39-
public function __construct(TokenStorageInterface $tokenStorage, AuthorizationCheckerInterface $authorizationChecker, UserPasswordEncoder $passwordEncoder, AuthenticationUtils $authenticationUtils, Session $session, RoleHierarchy $roleHierarchy)
37+
public function __construct(TokenStorageInterface $tokenStorage, AuthorizationCheckerInterface $authorizationChecker, UserPasswordEncoder $passwordEncoder, AuthenticationUtils $authenticationUtils, RoleHierarchy $roleHierarchy)
4038
{
4139
$this->tokenStorage = $tokenStorage;
4240
$this->authorizationChecker = $authorizationChecker;
4341
$this->passwordEncoder = $passwordEncoder;
4442
$this->authenticationUtils = $authenticationUtils;
45-
$this->session = $session;
4643
$this->roleHierarchy = $roleHierarchy;
4744
}
4845

@@ -221,9 +218,6 @@ public function login(UserInterface $user, $firewallName = 'main')
221218
$token = new UsernamePasswordToken($user, $user->getPassword(), $firewallName, $user->getRoles());
222219
$this->tokenStorage->setToken($token);
223220

224-
$this->session->set('_security_'.$firewallName, serialize($token));
225-
$this->session->save();
226-
227221
return $user;
228222
}
229223

0 commit comments

Comments
 (0)