Skip to content

Commit

Permalink
[Login] Case insensitive comparison of Authentication header
Browse files Browse the repository at this point in the history
The HTTP spec says the header name is case-insensitive. Some clients
send it as "authentication" (lowercase). This makes our check for
the header case-insensitive by lower-casing the headers before doing
the comparison.
  • Loading branch information
driusan committed Jun 1, 2023
1 parent fc3d08a commit d0cf5e0
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions php/libraries/SinglePointLogin.class.inc
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,9 @@ class SinglePointLogin
// First try JWT authentication, which is cheaper and
// doesn't involve database calls
$headers = getallheaders();
$authHeader = isset($headers['Authorization'])
? $headers['Authorization']
$headers = array_change_key_case($headers, CASE_LOWER);
$authHeader = isset($headers['authorization'])
? $headers['authorization']
: '';
if (!empty($authHeader)) {
$token = explode(" ", $authHeader);
Expand Down

0 comments on commit d0cf5e0

Please sign in to comment.