This allows a syncthing instance to be locked to exactly 1 user without needing search capability on the LDAP instance.
This commit is contained in:
@@ -45,3 +45,23 @@ func TestStaticAuthPasswordFail(t *testing.T) {
|
||||
t.Fatalf("should fail auth")
|
||||
}
|
||||
}
|
||||
|
||||
func TestAuthLDAPSendsCorrectBindDNWithTemplate(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
templatedDn := ldapTemplateBindDN("cn=%s,dc=some,dc=example,dc=com", "username")
|
||||
expectedDn := "cn=username,dc=some,dc=example,dc=com"
|
||||
if expectedDn != templatedDn {
|
||||
t.Fatalf("ldapTemplateBindDN should be %s != %s", expectedDn, templatedDn)
|
||||
}
|
||||
}
|
||||
|
||||
func TestAuthLDAPSendsCorrectBindDNWithNoTemplate(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
templatedDn := ldapTemplateBindDN("cn=fixedusername,dc=some,dc=example,dc=com", "username")
|
||||
expectedDn := "cn=fixedusername,dc=some,dc=example,dc=com"
|
||||
if expectedDn != templatedDn {
|
||||
t.Fatalf("ldapTemplateBindDN should be %s != %s", expectedDn, templatedDn)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user