-
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
Merged
spacewander
merged 30 commits into
apache:master
from
mangoGoForward:feature/hide-auth-header
Jan 14, 2022
Merged
Changes from 19 commits
Commits
Show all changes
30 commits
Select commit
Hold shift + click to select a range
dc2570a
fix:
f0d6f6f
merge from upstream master
3845a27
Merge remote-tracking branch 'upstream/master'
db0c9e7
feature: support hide the authentication header in basic-auth plugin
mangoGoForward 0cee869
add test case with hide auth header
mangoGoForward 79ca875
Revert "fix: when eureka server return compressed data, use lua-zlib …
mangoGoForward 9a9565c
remove blank line
mangoGoForward 10d35fd
change default value of hide_auth_header to `true`
mangoGoForward c642635
change default value of hide_auth_header to `true`
mangoGoForward 29d3077
fix code lint error
mangoGoForward 1c42db0
fix code lint error
mangoGoForward 7a663fa
Merge pull request #1 from mangoGoForward/feature/hide-auth-header
mangoGoForward 6e8d684
hide Authentication request header if hide_auth_header is true
mangoGoForward ec3bec6
hide Authentication request header if hide_auth_header is true
mangoGoForward 37076a7
Merge branch 'apache:master' into master
mangoGoForward 484d05d
change config item `hide_auth_header` to `hide_credentials` and updat…
mangoGoForward 63aa704
change config item `hide_auth_header` to `hide_credentials` and updat…
mangoGoForward 210c9d5
add test cases to cover it
mangoGoForward cb53193
add test cases to cover it
mangoGoForward 395ac1a
add test cases
mangoGoForward 25602a7
add test cases
mangoGoForward 41bb17e
update basic-auth doc
mangoGoForward 49b7850
remove log_level
mangoGoForward a1deeef
Revert "feat: support hide the authentication header in basic-auth"
mangoGoForward 4fc743f
Merge pull request #2 from mangoGoForward/revert-1-feature/hide-auth-…
mangoGoForward 8440045
Merge branch 'master' into feature/hide-auth-header
mangoGoForward 8531227
Revert "Revert "feat: support hide the authentication header in basic…
mangoGoForward 31af04d
change en doc
mangoGoForward ccc46b6
change zh doc
mangoGoForward 1b0ffe4
Merge branch 'apache:master' into feature/hide-auth-header
mangoGoForward File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,6 +20,7 @@ repeat_each(2); | |
no_long_string(); | ||
no_root_location(); | ||
no_shuffle(); | ||
log_level('info'); | ||
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. @mangoGoForward please take a check whether this change is needed. Thanks. 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. Seems unnecessary, removed. |
||
run_tests; | ||
|
||
__DATA__ | ||
|
@@ -356,3 +357,103 @@ GET /t | |
GET /t | ||
--- no_error_log | ||
[error] | ||
|
||
|
||
|
||
=== TEST 15: enable basic auth plugin using admin api, set hide_credentials = true | ||
--- config | ||
location /t { | ||
content_by_lua_block { | ||
local t = require("lib.test_admin").test | ||
local code, body = t('/apisix/admin/routes/1', | ||
ngx.HTTP_PUT, | ||
[[{ | ||
"plugins": { | ||
"basic-auth": { | ||
"hide_credentials": true | ||
} | ||
}, | ||
"upstream": { | ||
"nodes": { | ||
"127.0.0.1:1980": 1 | ||
}, | ||
"type": "roundrobin" | ||
}, | ||
"uri": "/echo" | ||
}]] | ||
) | ||
|
||
if code >= 300 then | ||
ngx.status = code | ||
end | ||
ngx.say(body) | ||
} | ||
} | ||
--- request | ||
GET /t | ||
--- response_body | ||
passed | ||
--- no_error_log | ||
[error] | ||
|
||
|
||
|
||
=== TEST 16: verify Authorization request header is hidden | ||
--- request | ||
GET /echo | ||
--- more_headers | ||
Authorization: Basic Zm9vOmJhcg== | ||
--- response_headers | ||
!Authorization | ||
--- no_error_log | ||
[error] | ||
|
||
|
||
|
||
=== TEST 17: enable basic auth plugin using admin api, hide_credentials = false | ||
--- config | ||
location /t { | ||
content_by_lua_block { | ||
local t = require("lib.test_admin").test | ||
local code, body = t('/apisix/admin/routes/1', | ||
ngx.HTTP_PUT, | ||
[[{ | ||
"plugins": { | ||
"basic-auth": { | ||
"hide_credentials": false | ||
} | ||
}, | ||
"upstream": { | ||
"nodes": { | ||
"127.0.0.1:1980": 1 | ||
}, | ||
"type": "roundrobin" | ||
}, | ||
"uri": "/echo" | ||
}]] | ||
) | ||
|
||
if code >= 300 then | ||
ngx.status = code | ||
end | ||
ngx.say(body) | ||
} | ||
} | ||
--- request | ||
GET /t | ||
--- response_body | ||
passed | ||
--- no_error_log | ||
[error] | ||
|
||
|
||
|
||
=== TEST 18: verify Authorization request header should not hidden | ||
--- request | ||
GET /echo | ||
--- more_headers | ||
Authorization: Basic Zm9vOmJhcg== | ||
--- response_headers | ||
Authorization: Basic Zm9vOmJhcg== | ||
--- no_error_log | ||
[error] |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
@mangoGoForward IMHO there's no need to change this. How about revert it?
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.