Log a user into the application without sessions or cookies.

@param  array  $credentials
@return bool
493583
public function once(array $credentials = [])
    {
        $this->fireAttemptEvent($credentials);

        if ($this->validate($credentials)) {
            $this->setUser($this->lastAttempted);

            return true;
        }

        return false;
    }
1010605
private function processAuthentication(array $credentials)
    {
        /** @var \Ma27\ApiKeyAuthenticationBundle\Service\Auth\AuthenticationHandlerInterface $authenticationHandler */
        $authenticationHandler = $this->get('ma27_api_key_authentication.auth_handler');
        /** @var \Symfony\Component\EventDispatcher\EventDispatcherInterface $dispatcher */
        $dispatcher = $this->get('event_dispatcher');

        try {
            $user = $authenticationHandler->authenticate($credentials);
        } catch (CredentialException $ex) {
            $userOrNull = $user ?? null;
            $dispatcher->dispatch(
                Ma27ApiKeyAuthenticationEvents::CREDENTIAL_EXCEPTION_THROWN,
                new OnCredentialExceptionThrownEvent($ex, $userOrNull)
            );

            return [$userOrNull, $ex];
        }

        return [$user, null];
    }
793009
public function identify(array $credentials)
    {
        /** @var \Authentication\Identifier\IdentifierInterface $identifier */
        foreach ($this->_loaded as $name => $identifier) {
            $result = $identifier->identify($credentials);
            if ($result) {
                return $result;
            }
            $this->_errors[$name] = $identifier->getErrors();
        }

        return null;
    }
1043247
public function user_login($username, $password) {
        $cached = $this->get_static_user_info();
        if (empty($cached)) {
            // This means we were called as part of a normal login flow - without using oauth.
            return false;
        }
        $verifyusername = $cached['username'];
        if ($verifyusername == $username) {
            return true;
        }
        return false;
    }
1338376
protected function handleLogin(array $credentials = [], $remember = false)
    {
        $loginAttribute = strtolower(config('df.login_attribute', 'email'));
        if ($loginAttribute === 'username') {
            $username = array_get($credentials, 'username');
            if (empty($username)) {
                throw new BadRequestException('Login request is missing required username.');
            }
            unset($credentials['email']);
        } else {
            $email = array_get($credentials, 'email');
            if (empty($email)) {
                throw new BadRequestException('Login request is missing required email.');
            }
            unset($credentials['username']);
        }

        $password = array_get($credentials, 'password');
        if (empty($password)) {
            throw new BadRequestException('Login request is missing required password.');
        }

        $credentials['is_active'] = 1;

        // if user management not available then only system admins can login.
        if (!class_exists('\DreamFactory\Core\User\Resources\System\User')) {
            $credentials['is_sys_admin'] = 1;
        }

        if (Session::authenticate($credentials, $remember, true, $this->getAppId())) {
            return Session::getPublicInfo();
        } else {
            throw new UnauthorizedException('Invalid credentials supplied.');
        }
    }
749581
public function attempt(array $credentials = [], $remember = false, $login = true)
    {
        // we do thing if the user is allowed to login with only username or
        // only password
        if ((config('taki.login_by') == 'both') && isset($credentials[config('taki.field.both')])) {
            $login = $credentials[config('taki.field.both')];
            unset($credentials[config('taki.field.both')]);
            if (isset($credentials[config('taki.field.username')])) {
                unset($credentials[config(['taki.field.username'])]);
            }
            if (isset($credentials[config('taki.field.email')])) {
                unset($credentials[config('taki.field.email')]);
            }
            if (filter_var($login, FILTER_VALIDATE_EMAIL)) {
                $credentials[config('taki.field.email')] = $login;
            } else {
                $credentials[config('taki.field.username')] = $login;
            }
        }

        return $this->auth->attempt($credentials, $remember, $login);
    }
955984
public function retrieveByCredentials(array $credentials): ?UserContract
    {
        $name = Authen::getIdentifierName();

        if (! isset($credentials[$name]) || empty($credentials[$name])) {
            return parent::retrieveByCredentials($credentials);
        }

        $identifier = $credentials[$name];
        unset($credentials[$name]);

        // 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->createModel()
                    ->newQuery()
                    ->findByIdentifiers($identifier);

        foreach ($credentials as $key => $value) {
            if (! Str::contains($key, 'password')) {
                $query->where($key, $value);
            }
        }

        return $query->first();
    }
508404
protected function validateEmailVerification(array $credentials)
    {
        if (is_null($user = $this->getUser($credentials))) {
            return static::INVALID_USER;
        }

        if (! $this->validateToken($user, $credentials)) {
            return static::INVALID_TOKEN;
        }

        if (! $this->validateTimestamp($credentials['expiration'])) {
            return static::EXPIRED_TOKEN;
        }

        return $user;
    }
195319
public function register(array $credentials, $activate)
    {
        try
        {
            if ( $this->validator->with($credentials)->passes() )
            {
                $this->users->register($credentials,$activate);
                return true;
            }
        }
        catch (LoginRequiredException $e)
        {
            $this->validator->add('LoginRequiredException',$e->getMessage());
        }
        catch (PasswordRequiredException $e)
        {
            $this->validator->add('PasswordRequiredException',$e->getMessage());
        }
        catch (UserExistsException $e)
        {
            $this->validator->add('UserExistsException',$e->getMessage());
        }

        return false;
    }
149342
public function authenticate($credentials, $remember = false, $login = true)
    {
        return $this->sentinel->authenticate($credentials, $remember, $login);
    }
1229271
public function attempt(array $credentials) {
    $user = $this->users->retrieveByCredentials($credentials);

    if($user instanceof UserInterface && $this->users->validateCredentials($user, $credentials)) {
       return $this->create($user);
    }

    return false;
  }
384967
public function retrieveByCredentials(array $credentials) {

        $conditions = [];

        foreach ($credentials as $key => $value) {
            if (!str_contains($key, 'password')) {
                $conditions[$key] = $value;
            }
        }
        $user = $this->createEmptyUserRecord()->fromDb($conditions, [], $this->getRelationsToFetch());

        return $this->validateUser($user, null);
    }
1152745
protected function validateVerification(array $credentials)
    {
        if (is_null($user = $this->getUser($credentials))) {
            return Contracts\VerificationBroker::INVALID_USER;
        }

        if (!$this->tokens->exists($user, $credentials['token'])) {
            return Contracts\VerificationBroker::INVALID_TOKEN;
        }

        return $user;
    }
1299615
public function authenticate(array $credentials, $remember = false)
    {
        $user = $this->sentry->authenticate($credentials,$remember);
        $this->event->fire('users.login',array($user));
        return $user;
    }
1217263
protected function validateReset(array $credentials)
	{
		if (is_null($user = $this->getUser($credentials)))
		{
			return PasswordBrokerContract::INVALID_USER;
		}

		if ( ! $this->validateNewPassword($credentials))
		{
			return PasswordBrokerContract::INVALID_PASSWORD;
		}

		if ( ! $this->tokens->exists($user, $credentials['token']))
		{
			return PasswordBrokerContract::INVALID_TOKEN;
		}

		return $user;
	}
1071679
public function findByCredentials(array $credentials)
    {
        $queryBuilder = $this->createQueryBuilder('u');

        $this->createCredentialsCriteria($queryBuilder, $credentials);

        $queryBuilder->setMaxResults(1);

        return $queryBuilder->getQuery()->getOneOrNullResult();
    }
409874
public function authenticate(array $credentials)
    {
        list($username, $password) = $credentials;

        $row = $this->database->table(self::TABLE_NAME)->where(self::COLUMN_NAME, $username)->fetch();

        if (!$row) {
            throw new Nette\Security\AuthenticationException('The username is incorrect.', self::IDENTITY_NOT_FOUND);

        } elseif (!Passwords::verify($password, $row[self::COLUMN_PASSWORD_HASH])) {
            throw new Nette\Security\AuthenticationException('The password is incorrect.', self::INVALID_CREDENTIAL);

        } elseif (Passwords::needsRehash($row[self::COLUMN_PASSWORD_HASH])) {
            $row->update([
                self::COLUMN_PASSWORD_HASH => Passwords::hash($password),
            ]);
        }

        $arr = $row->toArray();
        unset($arr[self::COLUMN_PASSWORD_HASH]);
        return new Nette\Security\Identity($row[self::COLUMN_ID], $row[self::COLUMN_ROLE], $arr);
    }