AY's Macbook Pro 3 rokov pred
rodič
commit
09e4381ea1
1 zmenil súbory, kde vykonal 10 pridanie a 7 odobranie
  1. 10 7
      mod/auth/ldap/ldap.go

+ 10 - 7
mod/auth/ldap/ldap.go

@@ -15,10 +15,10 @@ type ldapHandler struct {
 }
 
 const (
-	BindUsername = "read-only-admin"
-	BindPassword = "password"
-	FQDN         = "ldap.forumsys.com"
-	BaseDN       = "ou=mathematicians,dc=example,dc=com"
+	BindUsername = "uid=root,cn=users,dc=dsm"
+	BindPassword = "12345678"
+	FQDN         = "192.168.1.147"
+	BaseDN       = "cn=users,dc=dsm"
 	Filter       = "(objectClass=*)"
 )
 
@@ -50,7 +50,9 @@ func (handler *ldapHandler) Ldap() {
 	if err != nil {
 		log.Fatal(err)
 	}
-	result.Entries[0].PrettyPrint(4)
+	for _, v := range result.Entries {
+		v.PrettyPrint(4)
+	}
 }
 
 // Ldap Connection without TLS
@@ -70,13 +72,14 @@ func (handler *ldapHandler) BindAndSearch(l *ldap.Conn) (*ldap.SearchResult, err
 
 	searchReq := ldap.NewSearchRequest(
 		BaseDN,
-		ldap.ScopeBaseObject, // you can also use ldap.ScopeWholeSubtree
+		//ldap.ScopeBaseObject, // you can also use ldap.ScopeWholeSubtree
+		ldap.ScopeWholeSubtree,
 		ldap.NeverDerefAliases,
 		0,
 		0,
 		false,
 		Filter,
-		[]string{},
+		[]string{"uid", "memberOf"},
 		nil,
 	)
 	result, err := l.Search(searchReq)