mirror of
				https://github.com/go-gitea/gitea
				synced 2025-10-31 11:28:24 +00:00 
			
		
		
		
	add login name for auth type
This commit is contained in:
		
							
								
								
									
										32
									
								
								modules/auth/ldap/ldap_test.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										32
									
								
								modules/auth/ldap/ldap_test.go
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,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) | ||||
|  | ||||
| } | ||||
		Reference in New Issue
	
	Block a user