Custom auth message
This commit is contained in:
parent
05f005707c
commit
12f94aeb74
7
k8s.yaml
7
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:
|
||||
|
|
|
@ -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"`
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
||||
|
|
Reference in a new issue