emartech / escher-php

Library for HTTP request signing (PHP implementation)
MIT License
17 stars 12 forks source link

access key cannot contains spaces #4

Closed FallDi closed 9 years ago

FallDi commented 9 years ago

I think, you should specify in your implementation that access key cannot contains spaces; See first explode in class function

/**
 * @param $headerContent
 * @param $algoPrefix
 * @return array
 * @throws EscherException
 */
public static function parseAuthHeader($headerContent, $algoPrefix)
{
    $parts = explode(' ', $headerContent);
    if (count($parts) !== 4) {
        throw new EscherException('Could not parse authorization header: ' . $headerContent);
    }
    return array(
        'Algorithm'     => self::match(self::algoPattern($algoPrefix),    $parts[0]),
        'Credentials'   => self::match('Credential=([A-Za-z0-9\/\-_]+),', $parts[1]),
        'SignedHeaders' => self::match('SignedHeaders=([A-Za-z\-;]+),',   $parts[2]),
        'Signature'     => self::match('Signature=([0-9a-f]+)',           $parts[3]),
    );
}
boogie commented 9 years ago

Yes, thanks for the fix.