diff --git a/k8s.yaml b/k8s.yaml index 863e4bb..51b50b6 100644 --- a/k8s.yaml +++ b/k8s.yaml @@ -6,20 +6,21 @@ data: config.yaml: | web: 0.0.0.0:5555 path: / + message: "LDAP Login" servers: - ldaps://ldap1.example.com:636 - ldaps://ldap2.example.com:636 - ldaps://ldap3.example.com:636 auth: - bindDN: uid=seviceaccount,cn=users,dc=example,dc=com + bindDN: cn=seviceaccount,cn=users,o=company bindPW: password user: - baseDN: ou=users,dc=example,dc=com + baseDN: ou=users,o=company filter: "(cn={0})" requiredGroups: - appAdmin group: - baseDN: ou=groups,dc=example,dc=com + baseDN: ou=groups,o=company groupAttr: cn filter: "(member={0})" timeout: diff --git a/src/config.go b/src/config.go index 1fde8e6..d67d3e0 100644 --- a/src/config.go +++ b/src/config.go @@ -27,6 +27,7 @@ type TimeoutConfig struct { type Config struct { Web string `yaml:"web"` Path string `yaml:"path"` + Message string `yaml:"message"` Servers []string `yaml:"servers"` Auth AuthConfig `yaml:"auth"` User UserConfig `yaml:"user"` diff --git a/src/main.go b/src/main.go index a2a5990..fa5d794 100644 --- a/src/main.go +++ b/src/main.go @@ -16,8 +16,9 @@ import ( var ( configFile = flag.String("config", "/etc/nginx-ldap-auth/config.yaml", "Configuration file") config = Config{ - Web: "0.0.0.0:5555", - Path: "/", + Web: "0.0.0.0:5555", + Path: "/", + Message: "LDAP Login", User: UserConfig{ Filter: "(cn={0})", }, @@ -84,7 +85,7 @@ func handler(w http.ResponseWriter, r *http.Request) { } } - w.Header().Set("WWW-Authenticate", "Basic realm=\"LDAP Login\"") + w.Header().Set("WWW-Authenticate", fmt.Sprintf("Basic realm=\"%s\"", config.Message)) w.WriteHeader(http.StatusUnauthorized) }