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-10-09 11:17:46 +00:00
|
|
|
{
|
2023-12-18 21:07:59 +00:00
|
|
|
Name: "supportedCapabilities",
|
2023-10-09 11:17:46 +00:00
|
|
|
Values: []string{
|
2023-12-18 21:07:59 +00:00
|
|
|
"1.2.840.113556.1.4.800", // LDAP_CAP_ACTIVE_DIRECTORY_OID
|
|
|
|
"1.2.840.113556.1.4.1791", // LDAP_CAP_ACTIVE_DIRECTORY_LDAP_INTEG_OID
|
|
|
|
"1.2.840.113556.1.4.1670", // LDAP_CAP_ACTIVE_DIRECTORY_V51_OID
|
|
|
|
"1.2.840.113556.1.4.1880", // LDAP_CAP_ACTIVE_DIRECTORY_ADAM_DIGEST_OID
|
|
|
|
"1.2.840.113556.1.4.1851", // LDAP_CAP_ACTIVE_DIRECTORY_ADAM_OID
|
|
|
|
"1.2.840.113556.1.4.1920", // LDAP_CAP_ACTIVE_DIRECTORY_PARTIAL_SECRETS_OID
|
|
|
|
"1.2.840.113556.1.4.1935", // LDAP_CAP_ACTIVE_DIRECTORY_V60_OID
|
|
|
|
"1.2.840.113556.1.4.2080", // LDAP_CAP_ACTIVE_DIRECTORY_V61_R2_OID
|
|
|
|
"1.2.840.113556.1.4.2237", // LDAP_CAP_ACTIVE_DIRECTORY_W8_OID
|
2023-10-09 11:17:46 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2023-12-18 21:07:59 +00:00
|
|
|
Name: "supportedControl",
|
2023-10-09 11:17:46 +00:00
|
|
|
Values: []string{
|
2023-12-18 21:07:59 +00:00
|
|
|
"2.16.840.1.113730.3.4.9", // VLV Request LDAPv3 Control
|
|
|
|
"2.16.840.1.113730.3.4.10", // VLV Response LDAPv3 Control
|
|
|
|
"1.2.840.113556.1.4.474", // Sort result
|
|
|
|
"1.2.840.113556.1.4.319", // Paged Result Control
|
2023-10-09 11:17:46 +00:00
|
|
|
},
|
|
|
|
},
|
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
|
|
|
|
}
|