Skip to content

Commit

Permalink
restores corrects code
Browse files Browse the repository at this point in the history
  • Loading branch information
amir20 committed Oct 25, 2023
1 parent 47ddc35 commit ffc4dc6
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions internal/auth/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import (
"encoding/hex"
"net/http"
"strings"

log "github.com/sirupsen/logrus"
)

type contextKey string
Expand Down Expand Up @@ -42,15 +44,13 @@ func newUser(username, email, name string) *User {

func ForwardProxyAuthorizationRequired(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
// if r.Header.Get("Remote-Email") == "" {
// log.Error("Unable to find remote email. Please check your proxy configuration. Expecting header 'Remote-Email'")
// http.Error(w, "Unauthorized", http.StatusUnauthorized)
// return
// }

// user := newUser(r.Header.Get("Remote-User"), r.Header.Get("Remote-Email"), r.Header.Get("Remote-Name"))
if r.Header.Get("Remote-Email") == "" {
log.Error("Unable to find remote email. Please check your proxy configuration. Expecting headers Remote-Email, Remote-User, Remote-Name")
http.Error(w, "Unauthorized", http.StatusUnauthorized)
return
}

user := newUser("admin", "test@mail.com", "admin")
user := newUser(r.Header.Get("Remote-User"), r.Header.Get("Remote-Email"), r.Header.Get("Remote-Name"))

ctx := context.WithValue(r.Context(), remoteUser, user)
next.ServeHTTP(w, r.WithContext(ctx))
Expand Down

0 comments on commit ffc4dc6

Please sign in to comment.