only output json
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Nathan Coad
2023-07-19 15:13:21 +10:00
parent 5f6f116068
commit f987f4438a

14
main.go
View File

@@ -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)