Get the authentication object for login.

@return \Crypt_RSA|string
@throws \InvalidArgumentException
173713
protected function getAuthForLogin()
	{
		// If a "key" was specified in the auth credentials, we will load it into a
		// secure RSA key instance, which will be used to connect to the servers
		// in place of a password, and avoids the developer specifying a pass.
		if ($this->hasRsaKey())
		{
			return $this->loadRsaKey($this->auth);
		}

		// If a plain password was set on the auth credentials, we will just return
		// that as it can be used to connect to the server. This will be used if
		// there is no RSA key and it gets specified in the credential arrays.
		elseif (isset($this->auth['password']))
		{
			return $this->auth['password'];
		}

		throw new \InvalidArgumentException('Password / key is required.');
	}
379382
public static function token()
    {
        $name = config('security.key1');

        $token = '';

        if (static::exists($name)) {
            $token = static::get($name);
        } else {
            $token = Hash::token();
            //
            static::put($name, $token);
        }

        return $token;
    }
63436
public function getAuthenticationsAsArray()
    {

        // initialize the array for the authentications
        $authentications = array();

        // iterate over the authentication nodes and sort them into an array
        /** @var \AppserverIo\Appserver\Core\Api\Node\AuthenticationNode $authenticationNode */
        foreach ($this->getAuthentications() as $authenticationNode) {
            $authentications[$authenticationNode->getUri()] = $authenticationNode->getParamsAsArray();
        }

        // return the array
        return $authentications;
    }
805355
public function getSignature(): string
	{
		$input = $this->getArgs();

		$items = [];
		foreach ($input as $key => $val) {
			$items[] = sprintf('%s=%s', $key, $val);
		}

		$items[] = 'password=' . $this->getMerchantConfig()->password;

		return self::hashFunction(implode('&', $items));
	}
839063
protected function login()
    {
        return $this->query('login '.md5(substr($this->read(true), 17) . $this->pwd)) == 'Authentication successful, rcon ready.';
    }
675546
public function authenticateAction()
    {
        if ($this->cmsAuthentication()->hasIdentity()) {
            return $this->redirect()->toRoute($this->options->getLoginRedirectRoute());
        }

        $result = $this->cmsAuthentication()->authenticate();

        // Return early if $result is a response
        if ($result instanceof Response) {
            return $result;
        }

        $redirect = $this->getRedirectParameter();

        if (!$result->isValid()) {
            if ($this->forwardingController) {
                return $this->forward()->dispatch(
                    $this->forwardingController,
                    ['action' => 'login']
                );
            }

            $url = $this->url()->fromRoute(
                $this->options->getLoginRoute(),
                [],
                $redirect ? ['query' => [$this->options->getRedirectKey() => $redirect]] : []
            );

            return $this->redirect()->toUrl($url);
        }

        if ($redirect) {
            return $this->redirect()->toUrl($redirect);
        }

        $route = $this->options->getLoginRedirectRoute();
        if (is_callable($route)) {
            $route = $route($this->cmsAuthentication()->getIdentity());
        }

        return $this->redirect()->toRoute($route);
    }
1278609
public function getRequestSignature()
    {
        if (empty($this->requestSignature)) {

            $string = $this->getApiId()
                . $this->getTimeStamp()
                . $this->getNonce()
                . $this->getDataString();

            $this->requestSignature = hash_hmac('sha1', $string, $this->getService()->getApiSecret());
        }

        return $this->requestSignature;
    }
129340
public function authenticate()
    {
        $object = 'login';
        $url = sprintf('/api/%s/version/%s', $object, $this->version);
        $parameters = array(
            'email'    => $this->email,
            'password' => $this->password,
            'user_key' => $this->userKey,
            'format'   => $this->format
        );

        $this->apiKey = $this->doPost($object, $url, $parameters);

        return $this->apiKey;
    }
763606
public function authenticate()
    {
        $allowOverride = $this->shardServiceManager->getAllowOverride();
        $this->shardServiceManager->setAllowOverride(true);

        $sysUser = new User;
        $sysUser->addRole('sys::authenticate');
        $this->shardServiceManager->setService('user', $sysUser);
        
        $this->doctrineAdapter->setIdentity($this->identity);
        $this->doctrineAdapter->setCredential($this->credential);
        $result = $this->doctrineAdapter->authenticate();
             
        if ($result->isValid()) {
            $this->shardServiceManager->setService('user', $result->getIdentity());
        } else {
            $sysUser->removeRole('sys::authenticate');
        }
        $this->shardServiceManager->setAllowOverride($allowOverride);
            
        return $result;
    }
1178937
public static function getAuth()
    {
        $result = null;
        if ($user = Arr::key('PHP_AUTH_USER', $_SERVER, true)) {
            $result .= $user;

            if ($password = Arr::key('PHP_AUTH_PW', $_SERVER, true)) {
                $result .= ':' . $password;
            }

            $result .= '@';
        }

        return $result;
    }
1314446
public function authenticate()
	{
		$user=User::model()->find('LOWER(username)=?',array(strtolower($this->username)));
		if($user===null)
			$this->errorCode=self::ERROR_USERNAME_INVALID;
		else if(!$user->validatePassword($this->password))
			$this->errorCode=self::ERROR_PASSWORD_INVALID;
		else
		{
			$this->_id=$user->id;
			$this->username=$user->username;
			$this->errorCode=self::ERROR_NONE;
		}
		return $this->errorCode==self::ERROR_NONE;
	}
97819
protected function getCredentials()
    {
        if (empty($this->username) || empty($this->password)) {
            throw new \Exception('Basic authentication requires a $username & $password property.');
        }

        return [$this->username, $this->password];
    }
1082245
public function authenticate()
	{
		if ($data['code'] = $this->input->get('code', false, 'raw'))
		{
			$data['grant_type'] = 'authorization_code';
			$data['redirect_uri'] = $this->getOption('redirecturi');
			$data['client_id'] = $this->getOption('clientid');
			$data['client_secret'] = $this->getOption('clientsecret');
			$response = $this->http->post($this->getOption('tokenurl'), $data);

			if ($response->code >= 200 && $response->code < 400)
			{
				if ($response->headers['Content-Type'] == 'application/json')
				{
					$token = array_merge(json_decode($response->body, true), array('created' => time()));
				}
				else
				{
					parse_str($response->body, $token);
					$token = array_merge($token, array('created' => time()));
				}

				$this->setToken($token);

				return $token;
			}
			else
			{
				throw new \RuntimeException('Error code ' . $response->code . ' received requesting access token: ' . $response->body . '.');
			}
		}

		if ($this->getOption('sendheaders'))
		{
			$this->application->redirect($this->createUrl());
		}

		return false;
	}
838484
public function login(){
        if ($this->getGet('code')) {
            $this->client->authenticate($this->getGet('code'));
            $this->setSession('token', $this->client->getAccessToken());

            $redirect = $this->config->redirect_uris[0];
            header('Location: ' . filter_var($redirect, FILTER_SANITIZE_URL));
            return;
        }


        $token = $this->getSession('token');
        if ($token) {
            $this->client->setAccessToken($token);
        }

        if ($this->client->getAccessToken()) {
            $user = $this->oauth2_service->userinfo->get();
            $this->setSession('token', $this->client->getAccessToken());
            return $user;
        }
    }
1312778
private function authenticateBySession()
    {
        $u = $this->userFactory()->create($this->userType());
        // Call static method on user
        $u = call_user_func([get_class($u), 'getAuthenticated'], $this->userFactory());

        if ($u && $u->id()) {
            $u->saveToSession();

            return $u;
        } else {
            return null;
        }
    }
1137226
public final function getAuthority(): string
   {
       return ($this->user ? $this->user . static::USER_SEPARATOR : "")
            . $this->host
            . ($this->port ? static::HOST_SEPARATOR . $this->port : "");
   }
1112046
protected function getCryptAes()
	{
		if ($this->aes === null) {
			$this->aes = new \Crypt_AES();
			$this->aes->setKey($this->psk);
		}

		return $this->aes;
	}