Returns the digest hash for a user.

@param string $realm
@param string $username

@return string|null
773669
public function getDigestHash($realm, $username)
    {
        $stmt = $this->pdo->prepare('SELECT digesta1 FROM '.$this->tableName.' WHERE username = ?');
        $stmt->execute([$username]);

        return $stmt->fetchColumn() ?: null;
    }
1205715
public function withUserInfo(string $username, $password = null): URI
    {
        $result = clone $this;
        $result->user = $username.((string) $password != '' ? ':'.(string) $password : '');

        return $result;
    }
290876
public function requireBasicAuth($check_auth = '', $realm = 'Please enter your username and password')
    {

        $authorized = false;
        if (!isset($_SERVER['PHP_AUTH_USER'])) {
            header('WWW-Authenticate: Basic realm="' . $realm . '"');
            header('HTTP/1.0 401 Unauthorized');
            echo 'You must authenticate to continue';
        } else {

            if (is_callable($check_auth)) {
                $authorized = $check_auth($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']);
            }

            if (!$authorized) {
                session_unset();
                unset($_SERVER['PHP_AUTH_USER']);
                return $this->requireBasicAuth($check_auth, $realm);
            }
        }

        return $authorized;
    }
1190130
public static String HA1(String username, String realm, String password, String algorithm){
        String ha1 = "";
        ha1 = DigestAuthentication.H(username+":"+realm+":"+password, algorithm);
        return ha1;
    }
56210
public function authenticate($username, $password)
    {
        try {
            $user = $this->userProvider->loadUserByUsername($username);
        } catch (UsernameNotFoundException $e) {
            return null;
        }

        $valid = $this->encoderFactory->getEncoder($user)->isPasswordValid(
            $user->getPassword(),
            $password,
            $user->getSalt()
        );

        if ($valid) {
            return $user;
        }

        return null;
    }
1263992
function getAccountInfoByUsername($username)
    {
        $response = $this->call( new Command\AccountInfo($username, Command\AccountInfo::TYPE_USERNAME) );
        if ( $ex = $response->hasException() )
            throw $ex;

        $r = $response->expected();
        $r = ($r instanceof iDataEntity) ? $r->get('result') : $r;
        return $r;
    }
1020472
public function parseAuthData($digest)
    {
        if (substr($digest, 0, 7) === 'Digest ') {
            $digest = substr($digest, 7);
        }
        $keys = $match = [];
        $req = ['nonce' => 1, 'nc' => 1, 'cnonce' => 1, 'qop' => 1, 'username' => 1, 'uri' => 1, 'response' => 1];
        preg_match_all('/(\w+)=([\'"]?)([a-zA-Z0-9\:\#\%\?\&@=\.\/_-]+)\2/', $digest, $match, PREG_SET_ORDER);

        foreach ($match as $i) {
            $keys[$i[1]] = $i[3];
            unset($req[$i[1]]);
        }

        if (empty($req)) {
            return $keys;
        }

        return null;
    }
867190
private static function getPasswordHash($username , $password)
	{
		return sha1( self::getSecurityToken() . $username . self::getGenerated() . $password );
	}
1361173
def _user_agent_digest_hash(self):
        
        if not self.version:
            raise MissingVersion("A version is required for user agent auth. The RETS server should set this"
                                 "automatically but it has not. Please instantiate the session with a version argument"
                                 "to provide the version.")
        version_number = self.version.strip('RETS/')
        user_str = '{0!s}:{1!s}'.format(self.user_agent, self.user_agent_password).encode('utf-8')
        a1 = hashlib.md5(user_str).hexdigest()
        session_id = self.session_id if self.session_id is not None else ''
        digest_str = '{0!s}::{1!s}:{2!s}'.format(a1, session_id, version_number).encode('utf-8')
        digest = hashlib.md5(digest_str).hexdigest()
        return digest
908541
private function findByUsername(string $username)
    {
        if ($this->userRepository instanceof UserRepositoryInterface) {
            return $this->userRepository->findByUsername($username);
        }

        return $this->userRepository->findOneBy(['username' => $username]);
    }
484879
public function loadUserByUsername($username)
    {
        $qb = $this->getEntityManager()->createQueryBuilder();

        return $qb
            ->select('u')
            ->from('CiscajaUhsaUserBundle:User', 'u')
            ->where(
                $qb->expr()->orX(
                    $qb->expr()->eq('u.username', ':username'),
                    $qb->expr()->eq('u.email', ':username')
                )
            )
            ->setParameters(array(
                'username' => $username
            ))
            ->getQuery()
            ->getOneOrNullResult();
    }
1247800
public function getToken($username)
	{
		return isset($this->access_tokens[$username]) ? $this->access_tokens[$username] : null;
	}
545793
public static function getAuthKey($username, $password, $nonce)
    {
        return md5($nonce . $username . md5($username . ':mongo:' . $password));
    }
1185789
protected function _digestHeader()
    {
        $wwwauth = 'Digest realm="' . $this->_realm . '", '
                 . 'domain="' . $this->_domains . '", '
                 . 'nonce="' . $this->_calcNonce() . '", '
                 . ($this->_useOpaque ? 'opaque="' . $this->_calcOpaque() . '", ' : '')
                 . 'algorithm="' . $this->_algo . '", '
                 . 'qop="' . implode(',', $this->_supportedQops) . '"';

        return $wwwauth;
    }
254405
def getRealmUserPassword(self, realmname, username, environ):
        
        return self.user_manager.get_user_api_key(username, create=True)
257339
public function getAuthorizationHeader($realm = null)
    {
        $first = true;
        if ($realm) {
            $out = 'OAuth realm="' . Util::urlencodeRfc3986($realm) . '"';
            $first = false;
        } else {
            $out = 'OAuth';
        }

        foreach ($this->parameters as $k => $v) {
            if (substr($k, 0, 5) != "oauth") {
                continue;
            }
            if (is_array($v)) {
                throw new Exception('Arrays not supported in headers');
            }
            $out .= ($first) ? ' ' : ',';
            $out .= Util::urlencodeRfc3986($k) .
                '="' .
                Util::urlencodeRfc3986($v) .
                '"';
            $first = false;
        }
        return $out;
    }
57779
public function toHeader( $realm = null ) {
		$first = true;
		if ( $realm ) {
			$out = 'Authorization: OAuth realm="' .
				Util::urlencode( $realm ) . '"';
			$first = false;
		} else {
			$out = 'Authorization: OAuth';
		}

		foreach ( $this->parameters as $k => $v ) {
			if ( substr( $k, 0, 5 ) !== 'oauth' ) {
				continue;
			}
			if ( is_array( $v ) ) {
				throw new Exception( 'Arrays not supported in headers' );
			}
			$out .= ( $first ) ? ' ' : ',';
			$out .= Util::urlencode( $k ) . '="' . Util::urlencode( $v ) . '"';
			$first = false;
		}
		return $out;
	}