Skip to content

Commit

Permalink
change refs to security.context to security.token_storage
Browse files Browse the repository at this point in the history
  • Loading branch information
Deamon committed Apr 10, 2016
1 parent 87b919c commit d62f603
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Resources/config/services.yml
Expand Up @@ -22,4 +22,4 @@ services:

riper.security.active.directory.factory.adldap:
class: Riper\Security\ActiveDirectoryBundle\Security\Factory\AdldapFactory
arguments: [ "@security.context", "@riper.security.active.directory.service.adldap" ]
arguments: [ "@security.token_storage", "@riper.security.active.directory.service.adldap" ]
15 changes: 7 additions & 8 deletions Security/Factory/AdldapFactory.php
Expand Up @@ -3,35 +3,34 @@

namespace Riper\Security\ActiveDirectoryBundle\Security\Factory;


use Riper\Security\ActiveDirectoryBundle\Exception\WrongTokenException;
use Riper\Security\ActiveDirectoryBundle\Service\AdldapService;
use Riper\Security\ActiveDirectoryBundle\Token\FaultyToken;
use Symfony\Component\Security\Core\SecurityContext;
use Riper\Security\ActiveDirectoryBundle\Security\Token\FaultyToken;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage;

class AdldapFactory
{

/**
* @var SecurityContext
* @var TokenStorage
*/
private $securityContext;
private $tokenStorage;

/**
* @var AdldapService
*/
private $adldapService;

public function __construct(SecurityContext $securityContext, AdldapService $adldapService)
public function __construct(TokenStorage $tokenStorage, AdldapService $adldapService)
{
$this->securityContext = $securityContext;
$this->tokenStorage = $tokenStorage;
$this->adldapService = $adldapService;
}


public function getAuthenticatedAdLdap()
{
$token = $this->securityContext->getToken();
$token = $this->tokenStorage->getToken();
if ($token instanceof FaultyToken) {
throw new WrongTokenException(
'The token is not the right one. Did you forget to set "keep_password_in_token" to "true" in bundle configuration ?'
Expand Down

0 comments on commit d62f603

Please sign in to comment.