Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion lib/ngx-oauth/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ local map = util.map
local par = util.partial
local starts_with = util.starts_with

local oauth_config_prefix = nil
local DEFAULTS = {
client_id = '',
client_secret = '',
Expand All @@ -30,7 +31,7 @@ local OAAS_ENDPOINT_VARS = {'authorization_url', 'token_url', 'userinfo_url'}


local load_from_ngx = par(map, function(default_value, key)
return util.default(ngx.var['oauth_'..key], default_value)
return util.default(ngx.var[oauth_config_prefix..key], default_value)
end, DEFAULTS)

local function validate (conf)
Expand Down Expand Up @@ -71,6 +72,7 @@ local M = {}
-- @treturn nil|string Validation error, or `false` if no validation
-- error was found.
function M.load ()
oauth_config_prefix = ngx.var['oauth_config_prefix'] or 'oauth_'
local conf = load_from_ngx()

if not is_absolute_url(conf.redirect_uri) then
Expand Down