protected function generateSignature()
    {
        if (!$this->request->hasHeader('X-Authorization-Timestamp')) {
            throw new MalformedRequestException(
                'X-Authorization-Timestamp header missing from request.',
                null,
                0,
                $this->request
            );
        }

        $host = $this->request->getUri()->getHost();
        $port = $this->request->getUri()->getPort();

        if ($port) {
            $host .= ':' . $port;
        }

        $parts = [
            strtoupper($this->request->getMethod()),
            $host,
            $this->request->getUri()->getPath(),
            $this->request->getUri()->getQuery(),
            $this->serializeAuthorizationParameters(),
        ];

        $parts = array_merge($parts, $this->normalizeCustomHeaders());

        $parts[] = $this->request->getHeaderLine('X-Authorization-Timestamp');

        $body = (string) $this->request->getBody();

        if (strlen($body)) {
            if ($this->request->hasHeader('Content-Type')) {
                $parts[] = $this->request->getHeaderLine('Content-Type');
            }

            $parts[] = $this->digest->hash((string) $body);
        }

        return $this->digest->sign(implode("\n", $parts), $this->key->getSecret());
    }
protected function generateSignature()
    {
        if (!$this->request->hasHeader('X-Authorization-Timestamp')) {
            throw new MalformedRequestException(
                'X-Authorization-Timestamp header missing from request.',
                null,
                0,
                $this->request
            );
        }

        $host = $this->request->getUri()->getHost();
        $port = $this->request->getUri()->getPort();

        if ($port) {
            $host .= ':' . $port;
        }

        $parts = [
            strtoupper($this->request->getMethod()),
            $host,
            $this->request->getUri()->getPath(),
            $this->request->getUri()->getQuery(),
            $this->serializeAuthorizationParameters(),
        ];

        $parts = array_merge($parts, $this->normalizeCustomHeaders());

        $parts[] = $this->request->getHeaderLine('X-Authorization-Timestamp');

        $body = (string) $this->request->getBody();

        if (strlen($body)) {
            if ($this->request->hasHeader('Content-Type')) {
                $parts[] = $this->request->getHeaderLine('Content-Type');
            }

            $parts[] = $this->digest->hash((string) $body);
        }

        return $this->digest->sign(implode("\n", $parts), $this->key->getSecret());
    }
protected function generateSignature ( ) { if ( ! $ this -> request -> hasHeader ( 'X-Authorization-Timestamp' ) ) { throw new MalformedRequestException ( 'X-Authorization-Timestamp header missing from request.' , null , 0 , $ this -> request ) ; } $ host = $ this -> request -> getUri ( ) -> getHost ( ) ; $ port = $ this -> request -> getUri ( ) -> getPort ( ) ; if ( $ port ) { $ host .= ':' . $ port ; } $ parts = [ strtoupper ( $ this -> request -> getMethod ( ) ) , $ host , $ this -> request -> getUri ( ) -> getPath ( ) , $ this -> request -> getUri ( ) -> getQuery ( ) , $ this -> serializeAuthorizationParameters ( ) , ] ; $ parts = array_merge ( $ parts , $ this -> normalizeCustomHeaders ( ) ) ; $ parts [ ] = $ this -> request -> getHeaderLine ( 'X-Authorization-Timestamp' ) ; $ body = ( string ) $ this -> request -> getBody ( ) ; if ( strlen ( $ body ) ) { if ( $ this -> request -> hasHeader ( 'Content-Type' ) ) { $ parts [ ] = $ this -> request -> getHeaderLine ( 'Content-Type' ) ; } $ parts [ ] = $ this -> digest -> hash ( ( string ) $ body ) ; } return $ this -> digest -> sign ( implode ( "\n" , $ parts ) , $ this -> key -> getSecret ( ) ) ; }
Generate a signature from the request.

@throws \Acquia\Hmac\Exception\MalformedRequestException
When a required header is missing.

@return string
The generated signature.
Generate a signature from the request .