Skip to content

Commit

Permalink
deal with Authorization headers without blank
Browse files Browse the repository at this point in the history
closes #473

Signed-off-by: Stefan Bodewig <stefan.bodewig@innoq.com>
  • Loading branch information
bodewig committed Mar 10, 2023
1 parent 4ff4189 commit ae3bc54
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion ChangeLog
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
03/02/2023
03/10/2023
- when looking for a bearer token an exception occured if the
Authorization header didn't contain any space character;
see #473

02/03/2023
- release 1.7.6-3 of luarock pinning lua-resty-session dependency to
not go beyond 3.1ß

Expand Down
2 changes: 1 addition & 1 deletion lib/resty/openidc.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1651,7 +1651,7 @@ local function openidc_get_bearer_access_token(opts)
end

local divider = header:find(' ')
if divider == 0 or string.lower(header:sub(0, divider - 1)) ~= string.lower("Bearer") then
if divider == nil or divider == 0 or string.lower(header:sub(0, divider - 1)) ~= string.lower("Bearer") then
err = "no Bearer authorization header value found"
log(ERROR, err)
return nil, err
Expand Down

0 comments on commit ae3bc54

Please sign in to comment.