2021-11-05 09:37:30 +00:00
|
|
|
package direct
|
2021-09-26 12:01:22 +00:00
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
2023-06-08 13:16:40 +00:00
|
|
|
"strings"
|
2021-09-26 12:01:22 +00:00
|
|
|
|
2023-06-06 19:40:19 +00:00
|
|
|
"beryju.io/ldap"
|
2021-09-26 12:01:22 +00:00
|
|
|
"goauthentik.io/internal/constants"
|
2023-06-08 13:16:40 +00:00
|
|
|
ldapConstants "goauthentik.io/internal/outpost/ldap/constants"
|
2021-11-05 09:37:30 +00:00
|
|
|
"goauthentik.io/internal/outpost/ldap/search"
|
2021-09-26 12:01:22 +00:00
|
|
|
)
|
|
|
|
|
2023-06-08 13:16:40 +00:00
|
|
|
func (ds *DirectSearcher) SearchBase(req *search.Request) (ldap.ServerSearchResult, error) {
|
|
|
|
if req.Scope == ldap.ScopeSingleLevel {
|
|
|
|
return ldap.ServerSearchResult{
|
|
|
|
ResultCode: ldap.LDAPResultNoSuchObject,
|
|
|
|
}, nil
|
2021-09-26 12:01:22 +00:00
|
|
|
}
|
|
|
|
return ldap.ServerSearchResult{
|
|
|
|
Entries: []*ldap.Entry{
|
|
|
|
{
|
2023-06-08 13:16:40 +00:00
|
|
|
DN: "",
|
2021-09-26 12:01:22 +00:00
|
|
|
Attributes: []*ldap.EntryAttribute{
|
|
|
|
{
|
2023-06-08 13:16:40 +00:00
|
|
|
Name: "objectClass",
|
|
|
|
Values: []string{ldapConstants.OCTop},
|
2021-09-26 12:01:22 +00:00
|
|
|
},
|
|
|
|
{
|
2023-06-08 13:16:40 +00:00
|
|
|
Name: "entryDN",
|
|
|
|
Values: []string{""},
|
2021-09-26 12:01:22 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
Name: "supportedLDAPVersion",
|
|
|
|
Values: []string{"3"},
|
|
|
|
},
|
2023-06-08 13:16:40 +00:00
|
|
|
{
|
|
|
|
Name: "subschemaSubentry",
|
|
|
|
Values: []string{"cn=subschema"},
|
|
|
|
},
|
2021-09-26 12:01:22 +00:00
|
|
|
{
|
|
|
|
Name: "namingContexts",
|
|
|
|
Values: []string{
|
2023-06-08 13:16:40 +00:00
|
|
|
strings.ToLower(ds.si.GetBaseDN()),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
Name: "rootDomainNamingContext",
|
|
|
|
Values: []string{
|
|
|
|
strings.ToLower(ds.si.GetBaseDN()),
|
2021-09-26 12:01:22 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
Name: "vendorName",
|
|
|
|
Values: []string{"goauthentik.io"},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
Name: "vendorVersion",
|
2022-01-14 09:45:37 +00:00
|
|
|
Values: []string{fmt.Sprintf("authentik LDAP Outpost Version %s", constants.FullVersion())},
|
2021-09-26 12:01:22 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
Referrals: []string{}, Controls: []ldap.Control{}, ResultCode: ldap.LDAPResultSuccess,
|
|
|
|
}, nil
|
|
|
|
}
|