-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: support hide the authentication header in basic-auth with a config #6039
Changes from 11 commits
dc2570a
f0d6f6f
3845a27
db0c9e7
0cee869
79ca875
9a9565c
10d35fd
c642635
29d3077
1c42db0
7a663fa
6e8d684
ec3bec6
37076a7
484d05d
63aa704
210c9d5
cb53193
395ac1a
25602a7
41bb17e
49b7850
a1deeef
4fc743f
8440045
8531227
31af04d
ccc46b6
1b0ffe4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -30,7 +30,12 @@ local consumers_lrucache = core.lrucache.new({ | |||||
local schema = { | ||||||
type = "object", | ||||||
title = "work with route or service object", | ||||||
properties = {}, | ||||||
properties = { | ||||||
hide_auth_header = { | ||||||
type = "boolean", | ||||||
default = true, | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think the default value should be false. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Ditto There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done. |
||||||
} | ||||||
}, | ||||||
} | ||||||
|
||||||
local consumer_schema = { | ||||||
|
@@ -39,6 +44,10 @@ local consumer_schema = { | |||||
properties = { | ||||||
username = { type = "string" }, | ||||||
password = { type = "string" }, | ||||||
hide_auth_header = { | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We don't need to configure it in the consumer There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done. |
||||||
type = "boolean", | ||||||
default = true, | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Need to discuss it in maillist if use |
||||||
} | ||||||
}, | ||||||
required = {"username", "password"}, | ||||||
} | ||||||
|
@@ -161,6 +170,11 @@ function _M.rewrite(conf, ctx) | |||||
return 401, { message = "Password is error" } | ||||||
end | ||||||
|
||||||
-- 5. hide `Authentication` header if `hide_auth_header` is `true` | ||||||
if conf.hide_auth_header == true then | ||||||
core.response.set_header("Authentication", "") | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It seems you misunderstand the original issue. We want to hide the request header. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. My fault. Done. |
||||||
end | ||||||
|
||||||
consumer.attach_consumer(ctx, cur_consumer, consumer_conf) | ||||||
|
||||||
core.log.info("hit basic-auth access") | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hide_credentials
would be better? Kong uses this field in their basic-auth.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.