Sets the provided user information to current instance.

@param string $user     The user name to use for authority
@param string $password The password associated with $user

@return Uri The current instance with the provided user information
491142
protected function setUserInfo($user = '', $password = '')
    {
        $this->uriString = null;

        if (! $user) {
            $this->userInfo = '';

            return $this;
        }
        $this->userInfo = rtrim($user, '@');

        if ($password) {
            $this->userInfo .= ':' . $password;
        }

        return $this;
    }
550291
public function setAuthorization($username, $password)
    {
        $this->username = $username;
        $this->password = $password;

        return $this;
    }
160915
public static function changePassword($user = null, $password)
	{
		$passhash = self::getPasshash($password);

		return self::changePasshash($user, $passhash);
	}
1369681
public function withCredentials($username, $password)
    {
        if (null === $username || null === $password) {
            // No change if credentials or null
            return $this;
        }

        $new = $this->setValue('username', $username)
            ->setValue('password', $password)
            ->setValue('credentials', [$username, $password]);

        // To keep BC
        $new->username = $username;
        $new->password = $password;
        $new->credentials = [$username, $password];

        return $new;
    }
995788
public function setPassword(User $user, $password)
    {
        $encoder = $this->container->get('security.encoder_factory')
            ->getEncoder($user);

        $salt = $this->createSalt();

        $encryptedPassword = $encoder->encodePassword($password, $salt);

        $user
            ->setPassword($encryptedPassword)
            ->setSalt($salt);
    }
832405
public function setPassword($password)
    {
        if ($this->validatePassword($password) === false) {
            include_once 'Zend/Uri/Exception.php';
            throw new Zend_Uri_Exception("Password \"$password\" is not a valid HTTP password.");
        }

        $oldPassword     = $this->_password;
        $this->_password = $password;

        return $oldPassword;
    }
725227
public function setAuth($user, $pass)
    {
        $this->user = (string) $user;
        $this->pass = (string) $pass;

        return $this->hasAuth();
    }
917161
public function setBasicAuth($username, $password)
    {
        $this->username = $username;
        $this->password = $password;

        return $this;
    }
373397
public function setPassword($password)
    {
        if (preg_match(self::PATTERN_MATCH_PASSWORD, $password) !== 1) {
            throw new \InvalidArgumentException('The specified password is not valid as part of a URI.', 1184071239);
        }

        $this->password = $password;
    }
771261
public function login(User $user, $password)
    {
        if ($user->isPasswordValid($password)) {
            $token = new UsernamePasswordToken($user, null, 'main', $user->getRoles());
            $this->tokenStorage->setToken($token);
            $user->setLastLogin(new \DateTime());
            $this->save($user);

            return true;
        }

        return false;
    }
1320824
public function setUser($user)
    {
        if (\is_object($user)) {
            $this->userObject = $user;
            $this->user       = $user->getId();
        } else {
            $this->userObject = null;
            $this->user       = $user;
        }

        return $this;
    }
402186
public function setAuthPassword( ?string $password ) : MySQL
   {

      if ( ! $this->_supportedAttributes->get( 'password' )->validateValue( $password ) )
      {
         throw new ArgumentException(
            'password', \str_repeat( '*', min( 48, \mb_strlen( $password, 'utf-8' ) ) ), 'Invalid auth password!' );
      }

      $this->_attributes[ 'password' ] = $password;

      return $this;

   }
568656
private function setUserInfo($user, $pass)
    {
        $this->userInfo = $user . (!empty($pass) ? ':' . $pass : '');

        return $this;
    }
765620
public function withUserInfo($user, $password = null){
        if(!is_string($user)){
            throw new \InvalidArgumentException();
        }

        if(null !== $password && !is_string($password)){
            throw new \InvalidArgumentException();
        }

        $password   = "" === $password ? null : $password;

        if("" !== $user && 1 !== preg_match(static::REGEX_USERINFO_USER, $user)){
            throw new \InvalidArgumentException();
        }

        if(null !== $password && 1 !== preg_match(static::REGEX_USERINFO_PASS, $password)){
            throw new \InvalidArgumentException();
        }

        $userinfo   = ("" === $user || null === $password)
            ? $user
            : $user . ":" . $password
        ;

        if($this->userinfo == $userinfo){
            return $this;
        }

        $clone              = clone $this;
        $clone->userinfo    = $userinfo;

        return $clone;
    }
629838
public static function setAdmin($username , $password = null , $logs = null)
	{
		return self::setUser( $username , $password , $roles = array('admin') , $logs );
	}
1002961
public function setBasicAuthentication($username = '', $password = '')
    {
        $this->basicAuthentication = [
            'username' => $username,
            'password' => $password
        ];
        $this->debug->info(__FUNCTION__, 'setBasicAuthentication: ', $this->basicAuthentication);

        return $this;
    }
433680
public function withUserInfo($user, $password = null): self
    {
        $user_info = null;
        $user = $this->filterString($user);
        if (null !== $password) {
            $password = $this->filterString($password);
        }

        if ('' !== $user) {
            $user_info = $this->formatUserInfo($user, $password);
        }

        if ($user_info === $this->user_info) {
            return $this;
        }

        $clone = clone $this;
        $clone->user_info = $user_info;
        $clone->authority = $clone->setAuthority();
        $clone->assertValidState();

        return $clone;
    }