Initialize a session with user credentials
@param string $user
@param string $password
@throws Exception
@return boolean
978313
public function initSessionByCredentials($user, $password) {
      $response = $this->request('get', 'initSession', ['auth' => [$user, $password]]);
      if ($response->getStatusCode() != 200
         || !$this->sessionToken = json_decode($response->getBody()->getContents(), true)['session_token']) {
         $body = json_decode($response->getBody()->getContents());
         throw new Exception(ErrorHandler::getMessage($body[0]));
      }
      return true;
   }
599473
public function login($user,$password,$storeCookie=false) {
        $this->user=$user;
        $this->password=$this->encrypt($password);
        $this->uid=$this->genUID();
        //$this->other=$other;
        if (call_user_func($this->loginFn,$this)) {
            $this->fixSession($storeCookie && $this->useCookie);
            return true;
        } else {
            @session_destroy();
            @session_write_close();
            $this->isLogged=false;
            return false;
        }
    }
1059915
protected function resetPassword($user, $password) {
        $user->password = bcrypt($password);
        $user->save();

        Auth::login($user);
    }
1015129
public static function login($userLogin, $userPassword)
    {
        try {
            $user = self::authenticate($userLogin, $userPassword);
            $loggedIn = self::startSession($user);
        } catch (common_user_auth_AuthFailedException $e) {
            $loggedIn = false;
        }
        return $loggedIn;
    }
526529
public function withCredentials($username, $password)
	{
		$this->cookie = null;
		$this->credentials = array('username' => $username, 'password' => $password);
		return $this;
	}
833939
public function setCredentials(string $username, string $password)
    {
        $userpwd = $username . ':' . $password;
        curl_setopt($this->curl, CURLOPT_USERPWD, $userpwd);
    }
490229
protected function authenticate(string $username, string $password)
    {
        if (!isset($this->users[$username]) || $this->users[$username]['password'] != $password) {
            return false;
        }

        return true;
    }
136210
public function login($login, $password) {
		$user = $this->findUser($login);

		if ($user) {
			$this->user = $user;
			$this->recognized = true;

			if ($this->verifyUser($user, $password)) {
				$this->authenticated = true;

				$session = $this->findSession($user);
				if ($session === null) {
					$session = $this->createSession($user);
				}

				$this->session = $session;
				return true;
			}
		}

		return false;
	}
862383
public function setup($userName, $password) {
        // we MUST have the username and password. No Blanks allowed!
        //
        // remove blanks else Empty doesn't work
        $userName = trim($userName);
        $password = trim($password);

        if (empty($userName) || empty($password)) {
            //Throw exception if the required parameters were not found
            $this->log('parameters did not include username and/or password');
            throw new RequiredParameterMissingException('One or more required parameters was not supplied. Both userName and password required!');
        }

        $this->userName = $userName;
        $this->password = $password;
    }
404406
public function checkUserCredentials($username, $password)
    {
        $this->user = $this->app['auth']->getUserWithCredentials($username, $password);

        return $this->user instanceof User;
    }
834302
public function setUserSession($user) {
		if (!isset($user[$this->usernameKey]) || $user[$this->usernameKey] == '')
			throw new Exception('Invalid username');

		foreach ($user as $strKey => $strValue)
			$_SESSION['user_'.$strKey] = $strValue;
	}
608784
public function setPassword( core_kernel_classes_Resource $user, $password)
    {
        if(!is_string($password)){
			throw new core_kernel_users_Exception('The password must be of "string" type, got '.gettype($password));
		}
		
		$user->editPropertyValues(new core_kernel_classes_Property(GenerisRdf::PROPERTY_USER_PASSWORD),core_kernel_users_Service::getPasswordHash()->encrypt($password));
    }
221679
public function login( $user, $password )
	{
		$this->getSession()->visit( $this->locatePath( '/wp-login.php' ) );
		$this->wait_the_element( "#loginform" );

		$element = $this->getSession()->getPage();
		$element->fillField( "user_login", $user );
		$element->fillField( "user_pass", $password );

		$submit = $element->findButton( "wp-submit" );
		$submit->click();

		for ( $i = 0; $i < $this->timeout; $i++ ) {
			// Check if keeping staying on login page till timeout.
			try {
				if ( $this->is_current_url( '/wp-login.php' ) ) {
					// Still in login page.
					if ( $this->getSession()->getPage()->find( 'css','#login_error' ) ) {
						// Find error dialog. Apparent Error.
						return false;
					} else {
						// @todo Should consider other situations?
					}
				} else {
					// Redirected. Guess logged in.
					return true;
				}
			} catch ( \Exception $e ) {
				// do nothing
			}

			sleep( 1 );
		}

		throw new \Exception( 'Login timeout' );
	}
101851
public function addUser($user, $password)
    {
        $params = [
            'name' => $user,
            'password' => $password,
        ];

        $body = $this->request(self::URI_AUTH_USER_ADD, $params);

        return $body;
    }
15161
public function login($user, $password, $tryApop = true)
    {
        if ($tryApop && $this->_timestamp) {
            try {
                $this->request("APOP $user ".md5($this->_timestamp.$password));
                return;
            } catch (\Exception $e) {
                // ignore
            }
        }

        $this->request("USER $user");
        $this->request("PASS $password");
    }
742296
public function login(?string $username, ?string $password)
    {
        try {
            $this->startBrokerSession();

            if (!$username || !$password) {
                $this->fail('No username and/or password provided.');
            }

            if (!$this->authenticate($username, $password)) {
                $this->fail('User authentication failed.');
            }
        } catch (SSOServerException $e) {
            return $this->returnJson(['error' => $e->getMessage()]);
        }

        $this->setSessionData('sso_user', $username);

        return $this->userInfo();
    }
314156
public function initSessionByUserToken($userToken) {
      $response = $this->request('get', 'initSession', ['headers' => ['Authorization' => "user_token $userToken"]]);
      if ($response->getStatusCode() != 200
         || !$this->sessionToken = json_decode($response->getBody()->getContents(), true)['session_token']) {
         $body = json_decode($response->getBody()->getContents());
         throw new Exception(ErrorHandler::getMessage($body[0]));
      }
      return true;
   }