Skip to content

Commit bdc1a0e

Browse files
committed
strip extraneous whitespace
1 parent a119260 commit bdc1a0e

File tree

1 file changed

+23
-23
lines changed

1 file changed

+23
-23
lines changed

lib/resty/openidc.lua

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -375,20 +375,20 @@ local function openidc_call_token_endpoint(opts, endpoint, body, auth, endpoint_
375375
end
376376

377377
local pass_cookies = opts.pass_cookies or nil
378-
if pass_cookies ~= nil then
379-
local cookies = ngx.req.get_headers()["Cookie"]
380-
if cookies ~= nil then
378+
if pass_cookies ~= nil then
379+
local cookies = ngx.req.get_headers()["Cookie"]
380+
if cookies ~= nil then
381381
local t = {}
382382
for cookie_name in string.gmatch(pass_cookies, "%S+") do
383-
local cookie_value = ngx.var["cookie_"..cookie_name]
384-
if cookie_value ~= nil then
383+
local cookie_value = ngx.var["cookie_"..cookie_name]
384+
if cookie_value ~= nil then
385385
table.insert(t, cookie_name.."="..cookie_value)
386386
end
387387
end
388388
headers.Cookie = table.concat(t, "; ")
389389
end
390-
end
391-
390+
end
391+
392392
ngx.log(ngx.DEBUG, "request body for "..ep_name.." endpoint call: ", ngx.encode_args(body))
393393

394394
local httpc = http.new()
@@ -681,11 +681,11 @@ local function openidc_pem_from_jwk(opts, kid)
681681
if err then
682682
return nil, err
683683
end
684-
684+
685685
if not opts.discovery.jwks_uri or not (type(opts.discovery.jwks_uri) == "string") or (opts.discovery.jwks_uri == "") then
686686
return nil, "opts.discovery.jwks_uri is not present or not a string"
687687
end
688-
688+
689689
local cache_id = opts.discovery.jwks_uri .. '#' .. (kid or '')
690690
local v = openidc_cache_get("jwks", cache_id)
691691

@@ -1230,41 +1230,41 @@ end
12301230

12311231
-- get an OAuth 2.0 bearer access token from the HTTP request cookies
12321232
local function openidc_get_bearer_access_token_from_cookie(opts)
1233-
1233+
12341234
local err
12351235

12361236
ngx.log(ngx.DEBUG, "getting bearer access token from Cookie")
12371237

12381238
local accept_token_as = opts.auth_accept_token_as or "header"
12391239

12401240
local default_cookie_name = "PA.global"
1241-
local cookie_name
1241+
local cookie_name
12421242

1243-
local divider = accept_token_as:find(':')
1243+
local divider = accept_token_as:find(':')
12441244

1245-
if divider ~= nil then
1245+
if divider ~= nil then
12461246
cookie_name = accept_token_as:sub(divider+1)
12471247
end
1248-
1249-
if cookie_name == nil then
1248+
1249+
if cookie_name == nil then
12501250
cookie_name = default_cookie_name
12511251
end
12521252

12531253
ngx.log(ngx.DEBUG, "bearer access token from cookie named: "..cookie_name)
12541254

1255-
local cookies = ngx.req.get_headers()["Cookie"]
1255+
local cookies = ngx.req.get_headers()["Cookie"]
12561256

1257-
if cookies == nil then
1257+
if cookies == nil then
12581258
err = "no Cookie header found"
12591259
ngx.log(ngx.ERR, err)
12601260
return nil, err
1261-
end
1262-
1261+
end
1262+
12631263
local cookie_value = ngx.var["cookie_"..cookie_name]
1264-
if cookie_value == nil then
1264+
if cookie_value == nil then
12651265
err = "no Cookie "..cookie_name.." found"
12661266
ngx.log(ngx.ERR, err)
1267-
1267+
12681268
end
12691269

12701270
return cookie_value, err
@@ -1279,9 +1279,9 @@ local function openidc_get_bearer_access_token(opts)
12791279

12801280
local accept_token_as = opts.auth_accept_token_as or "header"
12811281

1282-
if accept_token_as:find("cookie") ~= nil then
1282+
if accept_token_as:find("cookie") ~= nil then
12831283
return openidc_get_bearer_access_token_from_cookie(opts)
1284-
end
1284+
end
12851285

12861286
-- get the access token from the Authorization header
12871287
local headers = ngx.req.get_headers()

0 commit comments

Comments
 (0)