-
Notifications
You must be signed in to change notification settings - Fork 501
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
Http basic auth #454
Http basic auth #454
Conversation
Codecov Report
@@ Coverage Diff @@
## main #454 +/- ##
==========================================
- Coverage 80.32% 80.21% -0.12%
==========================================
Files 73 76 +3
Lines 8279 8666 +387
==========================================
+ Hits 6650 6951 +301
- Misses 1265 1321 +56
- Partials 364 394 +30
Continue to review full report at Codecov.
|
9271006
to
6f08125
Compare
please keep total test coverage higher than 80%..... |
…oth password file and etcd
…ping unvalid etcd entries
e4aeaba
to
68d7cf8
Compare
This is fixed now, the issue was in cluster package as I introduced a test util that was not used |
Fix #404
Table of Contents
Test case with userFile
Test case with etcd
User Header Lookup
BasicAuth and UserHeaderLookup filter combined
Test case with userFile
Create
.htpasswd
file:Create HTML Server:
and pipeline:
Start also backend for proxy, for example
go run example/backend-service/echo/echo.go
for testing.Send authorized request:
curl -u doge:doge -v localhost:10081/pipeline
and observe status code 200.Unauthorized one:
curl -u doge:foo -v localhost:10081/pipeline
and see 401.Remove doge's line from
/etc/apache2/.htpasswd
. Wait 1 minute and execute:curl -u doge:doge -v localhost:10081/pipeline
and notice status code 401 as doge has no more access.Test case with etcd
Use same setup as previously, except change first filter to
Send authorized request with doge's credentials:
curl -u doge:doge -v localhost:10081/pipeline
==> 401.Add password to Easegress using
egctl
custom-data command:Now
curl -u doge:doge -v localhost:10081/pipeline
==> 200.Add apache2 mod5 encrypted password to etcd:
Again
curl -u doge:doge -v localhost:10081/pipeline
==> 200.Add bryct encrypted password to etcd:
Curling
curl -u doge:doge -v localhost:10081/pipeline
==> 200.UserHeaderLookup filter
Create a filter called
UserHeaderLookup
with following configurationHeaderLookup filter modifies request header: it looks up user information stored in etcd, identified by
etcdPrefix
andheaderKey
. HeaderLookup then extracts theetcdKey
s defined inheaderSetter
and sets them to headers, usingheaderKey
as key.BasicAuth and UserHeaderLookup filter combined
To use BasicAuth and UserHeaderLookup together, add following filters to pipeline
Update Easegress custom-data:
Then execute
curl -u doge:doge -v localhost:10081/pipeline
and the headerService-X-Id: [12345678]
has been included to the request.