This commit is contained in:
14
main.go
14
main.go
@@ -86,13 +86,21 @@ func main() {
|
||||
// Get a copy of the system defined CA's
|
||||
system, err := x509.SystemCertPool()
|
||||
if err != nil {
|
||||
panic("failed to access system CA list")
|
||||
output.AuthSuccess = false
|
||||
output.Error = "failed to access system CA list"
|
||||
b, _ := json.Marshal(output)
|
||||
fmt.Println(string(b))
|
||||
return
|
||||
}
|
||||
|
||||
// Add custom certificate to the system cert pool
|
||||
ok := system.AppendCertsFromPEM([]byte(WSDCCertPem))
|
||||
if !ok {
|
||||
panic("failed to parse WSDC intermediate certificate")
|
||||
output.AuthSuccess = false
|
||||
output.Error = "failed to parse WSDC intermediate certificate"
|
||||
b, _ := json.Marshal(output)
|
||||
fmt.Println(string(b))
|
||||
return
|
||||
}
|
||||
|
||||
config := &auth.Config{
|
||||
@@ -102,7 +110,7 @@ func main() {
|
||||
Security: auth.SecurityTLS,
|
||||
RootCAs: system,
|
||||
}
|
||||
fmt.Printf("Connecting to ldap server '%s' with DN '%s' on port 636\n", *server, *baseDN)
|
||||
//fmt.Printf("Connecting to ldap server '%s' with DN '%s' on port 636\n", *server, *baseDN)
|
||||
|
||||
status, err := auth.Authenticate(config, *username, *password)
|
||||
|
||||
|
Reference in New Issue
Block a user