Skip to content

Commit

Permalink
added check for invalid user providers
Browse files Browse the repository at this point in the history
  • Loading branch information
kriswallsmith committed Dec 6, 2011
1 parent e316a2f commit 70e9332
Showing 1 changed file with 7 additions and 0 deletions.
Expand Up @@ -22,6 +22,7 @@
use Symfony\Component\Security\Core\Exception\UnsupportedUserException;
use Symfony\Component\Security\Core\SecurityContext;
use Symfony\Component\Security\Core\User\UserInterface;
use Symfony\Component\Security\Core\User\UserProviderInterface;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;

/**
Expand All @@ -43,6 +44,12 @@ public function __construct(SecurityContext $context, array $userProviders, $con
throw new \InvalidArgumentException('$contextKey must not be empty.');
}

foreach ($userProviders as $userProvider) {
if (!$userProvider instanceof UserProviderInterface) {
throw new \InvalidArgumentException(sprintf('User provider "%s" must implement "Symfony\Component\Security\Core\User\UserProviderInterface".', get_class($userProvider)));
}
}

$this->context = $context;
$this->userProviders = $userProviders;
$this->contextKey = $contextKey;
Expand Down

0 comments on commit 70e9332

Please sign in to comment.