File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -222,6 +222,13 @@ local function get_first_header_and_strip_whitespace(headers, header_name)
222222 return header and header :gsub (' %s' , ' ' )
223223end
224224
225+ local function trim (s )
226+ if s then
227+ return s :match (" ^%s*(.-)%s*$" )
228+ end
229+ return s
230+ end
231+
225232local function get_forwarded_parameter (headers , param_name )
226233 local forwarded = get_first_header (headers , ' Forwarded' )
227234 local params = {}
@@ -1701,7 +1708,7 @@ local function openidc_get_bearer_access_token(opts)
17011708 -- get the access token from the Authorization header
17021709 local headers = ngx .req .get_headers ()
17031710 local header_name = opts .auth_accept_token_as_header_name or " Authorization"
1704- local header = get_first (headers [header_name ])
1711+ local header = trim ( get_first (headers [header_name ]) )
17051712
17061713 if header == nil then
17071714 err = " no Authorization header found"
@@ -1717,7 +1724,7 @@ local function openidc_get_bearer_access_token(opts)
17171724 end
17181725
17191726 local access_token = header :sub (divider + 1 )
1720- if access_token == nil then
1727+ if access_token == " " then
17211728 err = " no Bearer access token value found"
17221729 log (ERROR , err )
17231730 return nil , err
You can’t perform that action at this time.
0 commit comments