initial commit
All checks were successful
continuous-integration/drone Build is passing

This commit is contained in:
Nathan Coad
2023-07-19 13:59:42 +10:00
commit 8692fa525b
7 changed files with 96 additions and 0 deletions

37
main.go Normal file
View File

@@ -0,0 +1,37 @@
package main
import (
"flag"
"fmt"
auth "github.com/korylprince/go-ad-auth/v3"
)
func main() {
// Process command line arguments
server := flag.String("server", "ldap.example.com", "LDAP server to bind to")
baseDN := flag.String("baseDN", "OU=Users,DC=example,DC=com", "Base DN to use when attempting to bind to AD")
username := flag.String("username", "user", "Username to use when attempting to bind to AD")
password := flag.String("password", "pass", "Password to use when attempting to bind to AD")
config := &auth.Config{
Server: *server,
Port: 636,
BaseDN: *baseDN,
Security: auth.SecurityStartTLS,
}
status, err := auth.Authenticate(config, *username, *password)
if err != nil {
//handle err
fmt.Println(err)
}
if !status {
//handle failed authentication
fmt.Println(err)
}
fmt.Println("success")
}