Skip to content

Commit

Permalink
Merge pull request #4 from arcanys/master
Browse files Browse the repository at this point in the history
add token to user entity if available.
  • Loading branch information
djaney committed Nov 16, 2015
2 parents 5bb306b + c0603c9 commit 5538031
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Security/SSOAuthenticator.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ public function supportsToken(TokenInterface $token, $providerKey)

public function authenticateToken(TokenInterface $token, UserProviderInterface $userProvider, $providerKey)
{


$secret = $token->getCredentials();
$userData = $this->session->getFlashBag()->get('arcanys_sso_auth.user_data');
if($userData){
Expand All @@ -45,6 +43,7 @@ public function authenticateToken(TokenInterface $token, UserProviderInterface $
$email = reset($userData['email']);
$firstname = reset($userData['firstname']);
$lastname = reset($userData['lastname']);
$token = reset($userData['token']);
$roles = $userData['rights'];
if(!$roles) $roles = ['ROLE_USER'];
}else{
Expand All @@ -62,6 +61,7 @@ public function authenticateToken(TokenInterface $token, UserProviderInterface $
'email'=>$email,
'firstname'=>$firstname,
'lastname'=>$lastname,
'token'=>$token,
'roles'=>$roles,
]);

Expand Down
2 changes: 2 additions & 0 deletions Security/User/SSOUserProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ public function loadUserByUsername($userData)
$user->setLastname($userData['lastname']);
if(isset($userData['roles']))
$user->setRoles($userData['roles']);
if(isset($userData['token']))
$user->setToken($userData['token']);

if($new){
$this->doctrine->getManager()->persist($user);
Expand Down

0 comments on commit 5538031

Please sign in to comment.