* rework Root DSE Signed-off-by: Jens Langhammer <jens@goauthentik.io> * always parse filter objectClass Signed-off-by: Jens Langhammer <jens@goauthentik.io> * start adding LDAP Schema Signed-off-by: Jens Langhammer <jens@goauthentik.io> * add more schema Signed-off-by: Jens Langhammer <jens@goauthentik.io> * update schema more Signed-off-by: Jens Langhammer <jens@goauthentik.io> * fix cn for schema Signed-off-by: Jens Langhammer <jens@goauthentik.io> * only include main DN in namingContexts Signed-off-by: Jens Langhammer <jens@goauthentik.io> * use schema from gh Signed-off-by: Jens Langhammer <jens@goauthentik.io> * add description Signed-off-by: Jens Langhammer <jens@goauthentik.io> * add response filtering Signed-off-by: Jens Langhammer <jens@goauthentik.io> * fix response filtering Signed-off-by: Jens Langhammer <jens@goauthentik.io> * don't return rootDSE entry when searching for singleLevel Signed-off-by: Jens Langhammer <jens@goauthentik.io> * remove currentTime Signed-off-by: Jens Langhammer <jens@goauthentik.io> * fix attribute filtering Signed-off-by: Jens Langhammer <jens@goauthentik.io> * fix tests Signed-off-by: Jens Langhammer <jens@goauthentik.io> * set SINGLE-VALUE Signed-off-by: Jens Langhammer <jens@goauthentik.io> * fix numbers Signed-off-by: Jens Langhammer <jens@goauthentik.io> --------- Signed-off-by: Jens Langhammer <jens@goauthentik.io>
		
			
				
	
	
		
			66 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			66 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			Go
		
	
	
	
	
	
package direct
 | 
						|
 | 
						|
import (
 | 
						|
	"fmt"
 | 
						|
	"strings"
 | 
						|
 | 
						|
	"beryju.io/ldap"
 | 
						|
	"goauthentik.io/internal/constants"
 | 
						|
	ldapConstants "goauthentik.io/internal/outpost/ldap/constants"
 | 
						|
	"goauthentik.io/internal/outpost/ldap/search"
 | 
						|
)
 | 
						|
 | 
						|
func (ds *DirectSearcher) SearchBase(req *search.Request) (ldap.ServerSearchResult, error) {
 | 
						|
	if req.Scope == ldap.ScopeSingleLevel {
 | 
						|
		return ldap.ServerSearchResult{
 | 
						|
			ResultCode: ldap.LDAPResultNoSuchObject,
 | 
						|
		}, nil
 | 
						|
	}
 | 
						|
	return ldap.ServerSearchResult{
 | 
						|
		Entries: []*ldap.Entry{
 | 
						|
			{
 | 
						|
				DN: "",
 | 
						|
				Attributes: []*ldap.EntryAttribute{
 | 
						|
					{
 | 
						|
						Name:   "objectClass",
 | 
						|
						Values: []string{ldapConstants.OCTop},
 | 
						|
					},
 | 
						|
					{
 | 
						|
						Name:   "entryDN",
 | 
						|
						Values: []string{""},
 | 
						|
					},
 | 
						|
					{
 | 
						|
						Name:   "supportedLDAPVersion",
 | 
						|
						Values: []string{"3"},
 | 
						|
					},
 | 
						|
					{
 | 
						|
						Name:   "subschemaSubentry",
 | 
						|
						Values: []string{"cn=subschema"},
 | 
						|
					},
 | 
						|
					{
 | 
						|
						Name: "namingContexts",
 | 
						|
						Values: []string{
 | 
						|
							strings.ToLower(ds.si.GetBaseDN()),
 | 
						|
						},
 | 
						|
					},
 | 
						|
					{
 | 
						|
						Name: "rootDomainNamingContext",
 | 
						|
						Values: []string{
 | 
						|
							strings.ToLower(ds.si.GetBaseDN()),
 | 
						|
						},
 | 
						|
					},
 | 
						|
					{
 | 
						|
						Name:   "vendorName",
 | 
						|
						Values: []string{"goauthentik.io"},
 | 
						|
					},
 | 
						|
					{
 | 
						|
						Name:   "vendorVersion",
 | 
						|
						Values: []string{fmt.Sprintf("authentik LDAP Outpost Version %s", constants.FullVersion())},
 | 
						|
					},
 | 
						|
				},
 | 
						|
			},
 | 
						|
		},
 | 
						|
		Referrals: []string{}, Controls: []ldap.Control{}, ResultCode: ldap.LDAPResultSuccess,
 | 
						|
	}, nil
 | 
						|
}
 |