You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We are using .NET 7 and Novell.Directory.Ldap.NETStandard 3.6.0. We have the following code snippet for validating username and password against an LDAP server:
try{using(varconnection=new LdapConnection(ldapOptions){SecureSocketLayer=true,ConnectionTimeout=timeoutMs}){
connection.Connect(ldapServer.Url, ldapServer.Port);
_logger.LogInformation($"Connection to LDAP server {ldapServer} succeeded");
connection.Bind(usernameWithDomain,string.Empty);if(connection.Bound){
_logger.LogInformation($"User {usernameWithDomain} LDAP bind successfull (Password verification passed).");return PasswordVerificationResultExtended.Success;}}}catch(LdapExceptionex){if(ex.ResultCode == LdapException.ServerDown || ex.ResultCode == LdapException.ConnectError){
_logger.LogError($"Error during LDAP connect/bind! User={usernameWithDomain}, Server={ldapServer}, Error={ex.Message}");return PasswordVerificationResultExtended.Failed;}elseif(ex.ResultCode == LdapException.InvalidCredentials){
_logger.LogError($"Username {usernameWithDomain} and password don't match!");return PasswordVerificationResultExtended.Failed;}else{
_logger.LogError($"Error during LDAP connect/bind! User={usernameWithDomain}, Server={ldapServer}, Error={ex.Message}");return PasswordVerificationResultExtended.Failed;}}catch(Exceptionex){
_logger.LogError($"Error during LDAP connect/bind! User={usernameWithDomain}, Server={ldapServer}, Error={ex.Message}");return PasswordVerificationResultExtended.Failed;}
Pay attention to the connection.Bind(usernameWithDomain, string.Empty); line. I would expect that an exception with LdapException.InvalidCredentials result code would be thrown in such case. Instead, only connection.Bound field is set to false.
Is this a bug?
The text was updated successfully, but these errors were encountered:
We are using
.NET 7
andNovell.Directory.Ldap.NETStandard 3.6.0
. We have the following code snippet for validating username and password against an LDAP server:Pay attention to the
connection.Bind(usernameWithDomain, string.Empty);
line. I would expect that an exception withLdapException.InvalidCredentials
result code would be thrown in such case. Instead, onlyconnection.Bound
field is set tofalse
.Is this a bug?
The text was updated successfully, but these errors were encountered: