protected function validate(): bool
    {
        $A2 = $this->request->getMethod().':'.$this->digestParts['uri'];

        if ('auth-int' === $this->digestParts['qop']) {
            // Making sure we support this qop value
            if (!($this->qop & self::QOP_AUTHINT)) {
                return false;
            }
            // We need to add an md5 of the entire request body to the A2 part of the hash
            $body = $this->request->getBody($asString = true);
            $this->request->setBody($body);
            $A2 .= ':'.md5($body);
        } elseif (!($this->qop & self::QOP_AUTH)) {
            return false;
        }

        $A2 = md5($A2);

        $validResponse = md5("{$this->A1}:{$this->digestParts['nonce']}:{$this->digestParts['nc']}:{$this->digestParts['cnonce']}:{$this->digestParts['qop']}:{$A2}");

        return $this->digestParts['response'] === $validResponse;
    }
protected function validate(): bool
    {
        $A2 = $this->request->getMethod().':'.$this->digestParts['uri'];

        if ('auth-int' === $this->digestParts['qop']) {
            // Making sure we support this qop value
            if (!($this->qop & self::QOP_AUTHINT)) {
                return false;
            }
            // We need to add an md5 of the entire request body to the A2 part of the hash
            $body = $this->request->getBody($asString = true);
            $this->request->setBody($body);
            $A2 .= ':'.md5($body);
        } elseif (!($this->qop & self::QOP_AUTH)) {
            return false;
        }

        $A2 = md5($A2);

        $validResponse = md5("{$this->A1}:{$this->digestParts['nonce']}:{$this->digestParts['nc']}:{$this->digestParts['cnonce']}:{$this->digestParts['qop']}:{$A2}");

        return $this->digestParts['response'] === $validResponse;
    }
protected function validate ( ) : bool { $ A2 = $ this -> request -> getMethod ( ) . ':' . $ this -> digestParts [ 'uri' ] ; if ( 'auth-int' === $ this -> digestParts [ 'qop' ] ) { // Making sure we support this qop value if ( ! ( $ this -> qop & self :: QOP_AUTHINT ) ) { return false ; } // We need to add an md5 of the entire request body to the A2 part of the hash $ body = $ this -> request -> getBody ( $ asString = true ) ; $ this -> request -> setBody ( $ body ) ; $ A2 .= ':' . md5 ( $ body ) ; } elseif ( ! ( $ this -> qop & self :: QOP_AUTH ) ) { return false ; } $ A2 = md5 ( $ A2 ) ; $ validResponse = md5 ( "{$this->A1}:{$this->digestParts['nonce']}:{$this->digestParts['nc']}:{$this->digestParts['cnonce']}:{$this->digestParts['qop']}:{$A2}" ) ; return $ this -> digestParts [ 'response' ] === $ validResponse ; }
Validates the digest challenge.
Validates the digest challenge .