Ldap connection in windows service account context

112 Views Asked by At

I have deployed .net 6 WEBAPI as windows service. I set GMS account for this service (in windows => services => Right click on service => properties => log in tab )

How to call LDAP in this user context, I use Novell.Directory.Ldap.NETStandard and I tried

        _ldapConnection.Connect(_ldapSettings.Address, LdapConnection.DefaultSslPort);
        _ldapConnection.Bind(null, null);

but I have here: LdapException: Operations Error (1) Operations Error LdapException: Server Message: 000004DC: LdapErr: DSID-0C090CE5, comment: In order to perform this operation a successful bind must be completed on the connection., data 0, v4563 LdapException: Matched DN:

I don't have an access for this user password so I cannot set it here

1

There are 1 best solutions below

0
user1686 On

You're trying to bind() using anonymous credentials. To use the service account, you need to perform a SASL GSSAPI (or SASL GSS-SPNEGO) bind, letting the OS handle authentication.

The module appears to support this using BindAsync(SaslRequest saslRequest), although I couldn't find any useful documentation.