-
-
Notifications
You must be signed in to change notification settings - Fork 58
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
Added impersonate header #120
Conversation
Codecov Report
@@ Coverage Diff @@
## master #120 +/- ##
==========================================
+ Coverage 92.61% 92.74% +0.13%
==========================================
Files 70 70
Lines 1530 1558 +28
==========================================
+ Hits 1417 1445 +28
Misses 79 79
Partials 34 34
Continue to review full report at Codecov.
|
@@ -51,33 +52,55 @@ func sessionCallbacks(request *http.Request, writer http.ResponseWriter) *http.R | |||
} | |||
|
|||
func reqisterUser(request *http.Request, writer http.ResponseWriter, db *gorm.DB) *http.Request { |
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.
Hey, the code looks fine, could you add some tests in auth/middleware_test.go?
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.
I added some HTTP status-code returns and a few tests.
4d11888
to
2554636
Compare
2554636
to
d6d9d23
Compare
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.
Looks good, I fixed the formatting via go fmt
.
if err != nil { | ||
msg := "Issue fetching token" | ||
log.Info().Msg(msg) | ||
http.Error(writer, msg, 400) |
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.
I think this is problematic @jmattheis.
I'm seeing output like this (on http://localhost:3030/):
Issue fetching token
<!doctype html><html lang="en"><head><meta charset="utf-8"/>...</head><body>...</body></html>
Do you see the same issue on your end?
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.
Yeah, fixed in the last commit.
This PR introduces impersonation via a HTTP Header as suggested on #119.
This allows admins to impersonate other users, fetching their data, etc.
Currently this is a backend only implementation to support integrations.