public function loadUserByOAuthCredentials(\Gigablah\Silex\OAuth\Security\Authentication\Token\OAuthTokenInterface $token) { foreach ($this->users as $user) { $providerToken = $user->getProviderToken($token->getService()); if (!is_null($providerToken) && $providerToken->getUid() == $token->getUid()) { return $user; } } return null; }
/** * {@inheritdoc} */ public function loadUserByOAuthCredentials(OAuthTokenInterface $token) { foreach ($this->credentials as $username => $credentials) { foreach ($credentials as $credential) { if ($credential['service'] == $token->getService() && $credential['uid'] == $token->getUid()) { return $this->loadUserByUsername($username); } } } $user = new StubUser($token->getUsername(), '', $token->getEmail(), array('ROLE_USER'), true, true, true, true); $this->createUser($user); return $user; }