aboutsummaryrefslogtreecommitdiff
path: root/modules/auth/ldap/ldap_test.go
blob: 809657378280915ee9f69bff3e1b6c6c9c8a97c7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package ldap

import (
	"fmt"
	"testing"
)

var ldapServer = "ldap.itd.umich.edu"
var ldapPort = uint16(389)
var baseDN = "dc=umich,dc=edu"
var filter = []string{
	"(cn=cis-fac)",
	"(&(objectclass=rfc822mailgroup)(cn=*Computer*))",
	"(&(objectclass=rfc822mailgroup)(cn=*Mathematics*))"}
var attributes = []string{
	"cn",
	"description"}
var msadsaformat = ""

func TestLDAP(t *testing.T) {
	AddSource("test", ldapServer, ldapPort,
		basedn, attributes, filter,
		msadsaformat)
	user, err := LoginUserLdap("xiaolunwen", "")
	if err != nil {
		t.Error(err)
		return
	}

	fmt.Println(user)

}