Retrieve a user by the given credentials.

@param  array $credentials
@return \Illuminate\Contracts\Auth\Authenticatable|null
427686
public function retrieveByCredentials(array $credentials)
	{
		if (Authorizer::validateAccessToken(false, $credentials[$this->token_key])) {
			$user_id = Authorizer::getResourceOwnerId();

			return $this->retrieveById($user_id);
		}

		return null;
	}
1195260
public function authenticate(Authenticatable $user, array $credentials)
    {

        $handler = ldap_connect($this->host);

        if (! $handler) {
            throw new RuntimeException("Connection fail! Check your server address: '{$this->host}'.");
        }

        try {
            ldap_set_option($handler, LDAP_OPT_PROTOCOL_VERSION, 3);
        } catch (\ErrorException $e) {
            ;
        }

        $username = strtok($user->email, '@');

        $rdn = $this->makeRdn($username);

        try {
            $bind = ldap_bind($handler, $rdn, $credentials['password']);
        } catch (\ErrorException $e) {
            $bind = false;
        }

        if ($handler) {
            ldap_close($handler);

            unset($handler);
        }

        if ($bind) {
            $user->save();
        }

        return $bind;
    }
644548
public function getUser(array $credentials)
    {
        $credentials = Arr::except($credentials, ['token']);

        $user = $this->users->retrieveByCredentials($credentials);

        if ($user && !$user instanceof Contracts\RequiresEmailVerification) {
            throw new UnexpectedValueException('User must implement RequiresEmailVerification interface.');
        }

        return $user;
    }
70760
public function getUser($user) {
            if ($user instanceof TokenInterface) {
                $id = $user->getService();
            } else if (is_array($user)) {
                $id = $user['service'];
            } else {
                $id = $user;
            }

            if (!isset($this->users[$id])) {
                // TODO: execption
                return null;
            }
            if (is_string($this->users[$id])) {
                $this->users[$id] = $this->container->get($this->users[$id]);
            }

            if ($user instanceof TokenInterface) {
                $this->users[$id]->setTokenData($user);
            } else if (is_array($user)) {
                $this->users[$id]->setOptions($user);
            }

            return $this->users[$id];
        }
628460
public function validateNewPassword(array $credentials)
    {
        if (isset($this->passwordValidator)) {
            [$password, $confirm] = [
                $credentials['password'],
                $credentials['password_confirmation'],
            ];

            return call_user_func(
                $this->passwordValidator, $credentials
            ) && $password === $confirm;
        }

        return $this->validatePasswordWithDefaults($credentials);
    }
1203047
public function authentication(Request $request, array $credentials)
    {
        if (!isset($credentials['username'], $credentials['password'])) {
            return $request;
        }
        if (!isset($credentials['realm'])) {
            $credentials = $this->_getServerInfo($request, $credentials);
        }
        if (!isset($credentials['realm'])) {
            return $request;
        }
        $value = $this->_generateHeader($request, $credentials);

        return $request->withHeader('Authorization', $value);
    }
794902
public function getCredentials()
    {
        $auth = $this->request->getHeader('Authorization');

        if (!$auth) {
            return null;
        }

        if ('basic ' !== strtolower(substr($auth, 0, 6))) {
            return null;
        }

        $credentials = explode(':', base64_decode(substr($auth, 6)), 2);

        if (2 !== count($credentials)) {
            return null;
        }

        return $credentials;
    }
516224
public function authenticate(string $credential, string $password = null): ?UserInterface
    {
        $user = $this->users->read($credential);

        if ($user) {
            if ($password && !$this->verifyPassword($user, $password)) {
                return null;
            }

            return ($this->userFactory)(
                $this->users->getIdentifier(),
                $this->getRoles($credential),
                $this->getDetails($user)
            );
        }

        return null;
    }
1267708
public function create(array $credentials)
	{
		if ( ! isset($credentials['permissions']) )
		{
			$credentials['permissions'] = array();
		}

		$user = $this->createModel();
		$user->values($credentials);
		$user->save();

		return $user;
	}
1114831
public function read(array $credentials)
    {
        try {

            while (($job = $this->connect->peekReady()) !== false) {

                $message = unserialize($job->getBody());

                if($message['hash'] === $credentials['hash']) {
                    // hash found! Remove job from queue and return message
                    $job->delete();
                    unset($message['hash']);
                    return $message;
                }
            }
        }
        catch(\Exception $e) {
            throw new BeanstalkMapperException($e->getMessage());
        }
    }
968531
private function retrieveByToken(string $token)
    {
        $token = $this->validateToken($token);
        if (!$token) {
            return NULL;
        }
        $user = new User();
        if ($token->hasClaim('sub')) {
            $user->id = $token->getClaim('sub');
        }
        if ($token->hasClaim('name')) {
            $user->name = $token->getClaim('name');
        }
        if ($token->hasClaim('email')) {
            $user->email = $token->getClaim('email');
        }
        if ($token->hasClaim('roles')) {
            $user->roles = explode(' ', $token->getClaim('roles'));
        }
        if ($token->hasClaim('registries')) {
            $user->registries = explode(' ', $token->getClaim('registries'));
        }
        if ($token->hasClaim('cpf')) {
            $user->cpf = $token->getClaim('cpf');
        }
        if ($token->hasClaim('avatar')) {
            $user->avatar = $token->getClaim('avatar');
        }

        return $user;
    }
125083
public function getByAttributes(array $attributes) : ?Model
    {
        if (empty($attributes)) {
            return null;
        }

        // First we will add each credential element to the query as a where clause.
        // Then we can execute the query and, if we found a user, return it in a
        // Eloquent User "model" that will be utilized by the Guard instances.
        $query = $this->getModel()->newQuery();

        foreach ($attributes as $key => $value) {
            $query->where($key, $value);
        }

        return $query->first();
    }
1060137
public static function getSession($credentials)
    {
        $connectionData = new PagSeguroConnectionData($credentials, 'sessionService');

        $url = self::buildSessionURL($connectionData)  . "?" . $connectionData->getCredentialsUrlQuery();

        try {
            $connection = new PagSeguroHttpConnection();
            $connection->post(
                $url,
                array(),
                $connectionData->getServiceTimeout(),
                $connectionData->getCharset()
            );

            $httpStatus = new PagSeguroHttpStatus($connection->getStatus());

            switch ($httpStatus->getType()) {
                case 'OK':

                    $session = PagSeguroSessionParser::readResult($connection->getResponse());

                    return $session->getId();

                    LogPagSeguro::info(
                        "PagSeguroSessionService.getSession()(" . $session->toString() . ") - end {1}"
                    );
                    break;
                    case 'BAD_REQUEST':
                        $errors = PagSeguroSessionParser::readErrors($connection->getStatus());
                        $e = new PagSeguroServiceException($httpStatus, $errors);
                        LogPagSeguro::error(
                            "PagSeguroSessionService.getSession() - error " .
                            $e->getOneLineMessage()
                        );
                    throw $e;
                    break;
                    default:

                        $e = new PagSeguroServiceException($httpStatus);
                        LogPagSeguro::error(
                            "PagSeguroSessionService.getSession() - error " .
                            $e->getOneLineMessage()
                        );
                    throw $e;
                    break;
            }
        } catch (PagSeguroServiceException $e) {
            throw $e;
        } catch (Exception $e) {
            LogPagSeguro::error("Exception: " . $e->getMessage());
            throw $e;
        }
    }
636100
public function validate(array $credentials = [])
    {
        $this->lastAttempted = $user = $this->provider->retrieveByCredentials($credentials);

        return $this->hasValidCredentials($user, $credentials);
    }
682423
public function getUser(array $credentials)
    {
        $credentials = Arr::except($credentials, ['token']);

        $user = $this->users->retrieveByCredentials($credentials);

        if ($user && ! $user instanceof CanResetPasswordContract) {
            throw new UnexpectedValueException('User must implement CanResetPassword interface.');
        }

        return $user;
    }
946592
public function setSnsCredentials(array $credentials = null)
    {
        ValidationUtility::ensureNullOrArrayOfType(
            '$credentials', $credentials, __NAMESPACE__ . '\SnsCredentials');

        $this->snsCredentials = $credentials;

        return $this;
    }
1178888
public function getUser(array $credentials)
    {
        $user = $this->users->retrieveByCredentials(Arr::only($credentials, ['email']));

        if ($user && ! $user instanceof CanVerifyEmailContract) {
            throw new UnexpectedValueException('User must implement CanVerifyEmailContract interface.');
        }

        return $user;
    }