Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AuthUnknown error when running code in Windows Service #112

Open
umar-ulabs opened this issue Jan 12, 2021 · 3 comments
Open

AuthUnknown error when running code in Windows Service #112

umar-ulabs opened this issue Jan 12, 2021 · 3 comments
Labels

Comments

@umar-ulabs
Copy link

umar-ulabs commented Jan 12, 2021

The connection fails when using public IP or domain of the AD server
Everything works fine except when code is running inside a windows service and the server address is public one(port forwarding to 389 or 636).
The error return is AuthUnknown which is result code 86
Following are the connection settings:
var connection = new LdapConnection();
var isSecure = _config.UseSSL || _config.Port == 636 || _config.Port == 3269;
connection.Connect(_config.Server, _config.Port, isSecure ?
LdapSchema.LDAPS : LdapSchema.LDAP);
if (_configUseSSL)
{
connection.TrustAllCertificates();
}

            var cred = new LdapCredential();
            cred.UserName = _config.Username;
            cred.Password = _config.Password;
            await connection.BindAsync(LdapAuthType.Negotiate , cred);

Thanks

@flamencist
Copy link
Owner

Check requirements:

  • Your client machine should be joined to domain for using negotiate auth type
  • need specify realm(domain) , username and password for login as another user
    Or you could use other options: ldap simple auth or impersonate under domain user

@umar-ulabs
Copy link
Author

Right. What I did is try catch for couple of auth types. If one fails ,use different auth type. It seems working well that way. The OR on auth types didnt work like Auth Type Negotiate | Auth Type Simple, but using try catch to try different auth types seems working for now

@flamencist
Copy link
Owner

Yes. Its lightweight library without most features like cache or reliability

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants