mirror of
https://github.com/fosrl/badger.git
synced 2026-07-16 19:09:56 +00:00
Merge pull request #21 from fosrl/dev
Update information passed downstream
This commit is contained in:
1
.github/CODEOWNERS
vendored
Normal file
1
.github/CODEOWNERS
vendored
Normal file
@@ -0,0 +1 @@
|
||||
* @oschwartz10612 @miloschwartz
|
||||
15
main.go
15
main.go
@@ -67,6 +67,8 @@ type VerifyResponse struct {
|
||||
HeaderAuthChallenged bool `json:"headerAuthChallenged"`
|
||||
Valid bool `json:"valid"`
|
||||
RedirectURL *string `json:"redirectUrl"`
|
||||
UserId *string `json:"userId,omitempty"`
|
||||
DontStripSession bool `json:"dontStripSession,omitempty"`
|
||||
Username *string `json:"username,omitempty"`
|
||||
Email *string `json:"email,omitempty"`
|
||||
Name *string `json:"name,omitempty"`
|
||||
@@ -276,6 +278,7 @@ func (p *Badger) ServeHTTP(rw http.ResponseWriter, req *http.Request) {
|
||||
req.Header.Del("Remote-Email")
|
||||
req.Header.Del("Remote-Name")
|
||||
req.Header.Del("Remote-Role")
|
||||
req.Header.Del("Remote-User-Id")
|
||||
|
||||
if result.Data.ResponseHeaders != nil {
|
||||
for key, value := range result.Data.ResponseHeaders {
|
||||
@@ -305,6 +308,10 @@ func (p *Badger) ServeHTTP(rw http.ResponseWriter, req *http.Request) {
|
||||
|
||||
if result.Data.Valid {
|
||||
|
||||
if result.Data.UserId != nil {
|
||||
req.Header.Add("Remote-User-Id", *result.Data.UserId)
|
||||
}
|
||||
|
||||
if result.Data.Username != nil {
|
||||
req.Header.Add("Remote-User", *result.Data.Username)
|
||||
}
|
||||
@@ -321,9 +328,11 @@ func (p *Badger) ServeHTTP(rw http.ResponseWriter, req *http.Request) {
|
||||
req.Header.Add("Remote-Role", *result.Data.Role)
|
||||
}
|
||||
|
||||
p.stripSessionCookies(req)
|
||||
p.stripSessionParam(req)
|
||||
p.stripAccessTokenHeaders(req)
|
||||
if !result.Data.DontStripSession {
|
||||
p.stripSessionParam(req)
|
||||
p.stripSessionCookies(req)
|
||||
p.stripAccessTokenHeaders(req)
|
||||
}
|
||||
|
||||
fmt.Println("Badger: Valid session")
|
||||
p.next.ServeHTTP(rw, req)
|
||||
|
||||
Reference in New Issue
Block a user