* outposts/ldap: add tests Signed-off-by: Jens Langhammer <jens@goauthentik.io> * fix missing posixAccount Signed-off-by: Jens Langhammer <jens@goauthentik.io> * attempt to expand attributes Signed-off-by: Jens Langhammer <jens@goauthentik.io> * fix routing without base DN Signed-off-by: Jens Langhammer <jens@goauthentik.io> * more logging Signed-off-by: Jens Langhammer <jens@goauthentik.io> * remove our custom attribute filtering since this is done by the ldap library Signed-off-by: Jens Langhammer <jens@goauthentik.io> * add test for schema Signed-off-by: Jens Langhammer <jens@goauthentik.io> * fix tests Signed-off-by: Jens Langhammer <jens@goauthentik.io> --------- Signed-off-by: Jens Langhammer <jens@goauthentik.io>
		
			
				
	
	
		
			32 lines
		
	
	
		
			809 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			32 lines
		
	
	
		
			809 B
		
	
	
	
		
			Go
		
	
	
	
	
	
package ldap_test
 | 
						|
 | 
						|
import (
 | 
						|
	"testing"
 | 
						|
 | 
						|
	"beryju.io/ldap"
 | 
						|
	"github.com/stretchr/testify/assert"
 | 
						|
	oldap "goauthentik.io/internal/outpost/ldap"
 | 
						|
)
 | 
						|
 | 
						|
func ProviderInstance() *oldap.ProviderInstance {
 | 
						|
	return &oldap.ProviderInstance{
 | 
						|
		BaseDN:         "dc=ldap,dc=goauthentik,dc=io",
 | 
						|
		UserDN:         "ou=users,dc=ldap,dc=goauthentik,dc=io",
 | 
						|
		VirtualGroupDN: "ou=virtual-groups,dc=ldap,dc=goauthentik,dc=io",
 | 
						|
		GroupDN:        "ou=groups,dc=ldap,dc=goauthentik,dc=io",
 | 
						|
	}
 | 
						|
}
 | 
						|
 | 
						|
func AssertLDAPAttributes(t *testing.T, attrs []*ldap.EntryAttribute, expected *ldap.EntryAttribute) {
 | 
						|
	found := false
 | 
						|
	for _, attr := range attrs {
 | 
						|
		if attr.Name == expected.Name {
 | 
						|
			assert.Equal(t, expected.Values, attr.Values)
 | 
						|
			found = true
 | 
						|
		}
 | 
						|
	}
 | 
						|
	if !found {
 | 
						|
		t.Fatalf("Key %s not found in ldap attributes", expected.Name)
 | 
						|
	}
 | 
						|
}
 |