Skip to content

Commit

Permalink
[TMA-630][haoliu & llr] Debug for label when use table
Browse files Browse the repository at this point in the history
  • Loading branch information
Nexuscream committed Feb 25, 2019
1 parent 5125662 commit 990bcc4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
8 changes: 4 additions & 4 deletions kong/plugins/okta-auth/access.lua
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@ local function make_oidc(token_data)
ngx.log(ngx.INFO, "Make Oidc")

local oidc = extract_data(token_data)
local oidc_label = okta_api.get_oidc_label(oidc.cid)
local oidc_label = okta_api.get_oidc_label(oidc["cid"])

if oidc_label then
ngx.log(ngx.DEBUG, " Complete Oidc label Success.")
oidc['Lab'] = oidc_label
ngx.log(ngx.DEBUG, " Get Oidc label Success.")
oidc["Lab"] = oidc_label
else
ngx.log(ngx.ERR, " Complete Oidc label failed.")
ngx.log(ngx.ERR, " Get Oidc label failed.")
end

return oidc
Expand Down
6 changes: 4 additions & 2 deletions kong/plugins/okta-auth/okta_api.lua
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ local function get_Oidc_headers()
end

local function fetch_objc_label(oidc_id)
ngx.log(ngx.INFO, "fetch_objc_label :oidc id ", oidc_id)

local url = os.getenv('OKTA_BASE_URL') .. '/api/v1/apps/' .. oidc_id
local headers = get_Oidc_headers()
local status_code, response_body, response_headers = send_request(
Expand All @@ -67,7 +69,7 @@ local function fetch_objc_label(oidc_id)
end

function _M.get_oidc_label(oidc_id)
ngx.log(ngx.INFO, "Get OIDC label.")
ngx.log(ngx.INFO, "Get OIDC label by oidc id: ", oidc_id)

local cache = singletons.cache
local oidc_label
Expand All @@ -81,7 +83,7 @@ function _M.get_oidc_label(oidc_id)
end

if err then
ngx.log(ngx.ERR, "Cache OIDC label by it's id failed.", err)
ngx.log(ngx.ERR, "Cache OIDC label by it's id failed: ", err)
oidc_label = nil
end
end
Expand Down

0 comments on commit 990bcc4

Please sign in to comment.