Skip to content

Commit

Permalink
configurable email header names
Browse files Browse the repository at this point in the history
  • Loading branch information
foosinn committed Apr 4, 2020
1 parent ffa3b03 commit 07c26c8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions internal/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ type Config struct {
CookieDomains []CookieDomain `long:"cookie-domain" env:"COOKIE_DOMAIN" description:"Domain to set auth cookie on, can be set multiple times"`
InsecureCookie bool `long:"insecure-cookie" env:"INSECURE_COOKIE" description:"Use insecure cookies"`
CookieName string `long:"cookie-name" env:"COOKIE_NAME" default:"_forward_auth" description:"ID Cookie Name"`
EmailHeaderNames CommaSeparatedList `long:"email-header-names" env:"EMAIL_HEADER_NAMES" default:"X-Forwarded-User" description:"Headers which will contain the users email address"`
UserCookieName string `long:"user-cookie-name" env:"USER_COOKIE_NAME" default:"_forward_auth_name" description:"User Cookie Name"`
CSRFCookieName string `long:"csrf-cookie-name" env:"CSRF_COOKIE_NAME" default:"_forward_auth_csrf" description:"CSRF Cookie Name"`
GroupsSessionName string `long:"groups-session-name" env:"GROUPS_SESSION_NAME" default:"_forward_auth_claims" description:"Groups Session Name"`
Expand Down
4 changes: 3 additions & 1 deletion internal/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,9 @@ func (s *Server) AuthHandler(rule string) http.HandlerFunc {

// Valid request
logger.Debugf("Allow request from %s", email)
w.Header().Set("X-Forwarded-User", email)
for _, headerName := range config.EmailHeaderNames {
w.Header().Set(headerName, email)
}

if config.EnableImpersonation {
// Set impersonation headers
Expand Down

0 comments on commit 07c26c8

Please sign in to comment.