Skip to content
This repository has been archived by the owner on Feb 22, 2020. It is now read-only.

Commit

Permalink
Merge pull request #6 from checkr/zz/remove-password-checking-part
Browse files Browse the repository at this point in the history
Remove the consideration of password
  • Loading branch information
zhouzhuojie authored Apr 23, 2018
2 parents 54ba707 + bc01cef commit 0635916
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
6 changes: 0 additions & 6 deletions kong/plugins/basicauth2keyauth/handler.lua
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,6 @@ local function retrieve_credentials(request, header_name, conf)
end

username = basic_parts[1]
password = basic_parts[2]

if password ~= "" then
-- if password exists, we don't want to use that as api key
return
end
end
end
end
Expand Down
7 changes: 4 additions & 3 deletions spec/basicauth2keyauth/01-access_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ describe("Plugin: key-auth (access)", function()
local header_value = assert.request(res).has.header("apikey_from_basicauth")
assert.equal("api1234", header_value)
end)
it("generates nothing if basic auth has the password part", function()
it("generates new api_key if basic auth has the password part", function()
local res = assert(client:send {
method = "GET",
path = "/request",
Expand All @@ -72,7 +72,8 @@ describe("Plugin: key-auth (access)", function()
}
})
assert.res_status(200, res)
assert.request(res).has.no.header("apikey_from_basicauth")
local header_value = assert.request(res).has.header("apikey_from_basicauth")
assert.equal("632d187cde1f395f3fb17e9783748d101b70174988a8e148bc7bc20f63453ea5", header_value)
end)
it("generates new api_key header with sha256 value if basic auth is in the headers", function()
local res = assert(client:send {
Expand Down Expand Up @@ -113,7 +114,7 @@ describe("Plugin: key-auth (access)", function()
local header_value = assert.request(res).has.header("apikey_from_basicauth")
assert.equal("632d187cde1f395f3fb17e9783748d101b70174988a8e148bc7bc20f63453ea5", header_value)
end)
it("generates new api_key header with sha256 value if password is just empty", function()
it("generates new api_key header with sha256 value if password is just a space", function()
local res = assert(client:send {
method = "GET",
path = "/request",
Expand Down

0 comments on commit 0635916

Please sign in to comment.