Skip to content

Commit

Permalink
Merge pull request #2508 from Mashape/hotfix/anonymous
Browse files Browse the repository at this point in the history
hotfix(auth) handle nil anonymous consumers
  • Loading branch information
subnetmarco authored May 11, 2017
2 parents b78d1f8 + bb88a80 commit af43508
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion kong/plugins/basic-auth/access.lua
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ function _M.execute(conf)

local ok, err = do_authentication(conf)
if not ok then
if conf.anonymous ~= "" then
if conf.anonymous ~= "" and conf.anonymous ~= nil then
-- get anonymous user
local consumer, err = cache.get_or_set(cache.consumer_key(conf.anonymous),
nil, load_consumer_into_memory, conf.anonymous, true)
Expand Down
2 changes: 1 addition & 1 deletion kong/plugins/hmac-auth/access.lua
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ function _M.execute(conf)

local ok, err = do_authentication(conf)
if not ok then
if conf.anonymous ~= "" then
if conf.anonymous ~= "" and conf.anonymous ~= nil then
-- get anonymous user
local consumer, err = cache.get_or_set(cache.consumer_key(conf.anonymous),
nil, load_consumer_into_memory, conf.anonymous, true)
Expand Down
2 changes: 1 addition & 1 deletion kong/plugins/jwt/handler.lua
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ function JwtHandler:access(conf)

local ok, err = do_authentication(conf)
if not ok then
if conf.anonymous ~= "" then
if conf.anonymous ~= "" and conf.anonymous ~= nil then
-- get anonymous user
local consumer, err = cache.get_or_set(cache.consumer_key(conf.anonymous),
nil, load_consumer, conf.anonymous, true)
Expand Down
2 changes: 1 addition & 1 deletion kong/plugins/key-auth/handler.lua
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ function KeyAuthHandler:access(conf)

local ok, err = do_authentication(conf)
if not ok then
if conf.anonymous ~= "" then
if conf.anonymous ~= "" and conf.anonymous ~= nil then
-- get anonymous user
local consumer, err = cache.get_or_set(cache.consumer_key(conf.anonymous),
nil, load_consumer, conf.anonymous, true)
Expand Down
2 changes: 1 addition & 1 deletion kong/plugins/ldap-auth/access.lua
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ function _M.execute(conf)

local ok, err = do_authentication(conf)
if not ok then
if conf.anonymous ~= "" then
if conf.anonymous ~= "" and conf.anonymous ~= nil then
-- get anonymous user
local consumer, err = cache.get_or_set(cache.consumer_key(conf.anonymous),
nil, load_consumer, conf.anonymous, true)
Expand Down
2 changes: 1 addition & 1 deletion kong/plugins/oauth2/access.lua
Original file line number Diff line number Diff line change
Expand Up @@ -560,7 +560,7 @@ function _M.execute(conf)

local ok, err = do_authentication(conf)
if not ok then
if conf.anonymous ~= "" then
if conf.anonymous ~= "" and conf.anonymous ~= nil then
-- get anonymous user
local consumer, err = cache.get_or_set(cache.consumer_key(conf.anonymous),
nil, load_consumer_into_memory, conf.anonymous, true)
Expand Down

0 comments on commit af43508

Please sign in to comment.