C
C#•5mo ago
reeeeeee

LDAP authentication stopped working for one user

Hey all! I had an LDAP auth implemented on my site, which worked fine for past two years, but randomly stopped working for one user after he changed password. The code is like this
public bool IsAuthenticated(string ldap, string usr, string pwd)
{
bool authenticated = false;

try
{
DirectoryEntry entry = new DirectoryEntry(ldap, usr, pwd);
object nativeObject = entry.NativeObject;
authenticated = true;

}
catch (DirectoryServicesCOMException cex)
{
_logger.Error("DirectoryServicesCOMException occured");
_logger.Error(cex, cex.StackTrace);
}
catch (Exception ex)
{
_logger.Error($"Exception occured: {ex.Message}");
_logger.Error(ex, ex.StackTrace);
}
return authenticated;
}
public bool IsAuthenticated(string ldap, string usr, string pwd)
{
bool authenticated = false;

try
{
DirectoryEntry entry = new DirectoryEntry(ldap, usr, pwd);
object nativeObject = entry.NativeObject;
authenticated = true;

}
catch (DirectoryServicesCOMException cex)
{
_logger.Error("DirectoryServicesCOMException occured");
_logger.Error(cex, cex.StackTrace);
}
catch (Exception ex)
{
_logger.Error($"Exception occured: {ex.Message}");
_logger.Error(ex, ex.StackTrace);
}
return authenticated;
}
I am getting returned the username or password is incorrect. Should I implement this better? How can I even debug this? Can I check anything on the AD / LDAP side?
2 Replies
Unknown User
Unknown User•5mo ago
Message Not Public
Sign In & Join Server To View
reeeeeee
reeeeeee•5mo ago
Yes i logged everything so I could find anything useful.. which I can't, sooo... 😄
Want results from more Discord servers?
Add your server
More Posts