Skip to content

Commit

Permalink
Merge pull request #195 from l0gicgate/188-patch
Browse files Browse the repository at this point in the history
Ensure authorization header parsing is case insensitive
  • Loading branch information
l0gicgate committed May 8, 2021
2 parents e99324d + 8960be9 commit 0dca983
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/Headers.php
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,15 @@ protected function normalizeHeaderName(string $name, bool $preserveCase = false)
*/
protected function parseAuthorizationHeader(array $headers): array
{
if (!isset($headers['Authorization'])) {
$hasAuthorizationHeader = false;
foreach ($headers as $name => $value) {
if (strtolower($name) === 'authorization') {
$hasAuthorizationHeader = true;
break;
}
}

if (!$hasAuthorizationHeader) {
if (isset($this->globals['REDIRECT_HTTP_AUTHORIZATION'])) {
$headers['Authorization'] = $this->globals['REDIRECT_HTTP_AUTHORIZATION'];
} elseif (isset($this->globals['PHP_AUTH_USER'])) {
Expand Down

0 comments on commit 0dca983

Please sign in to comment.