C
C#7mo ago
reeeeeee

LDAP login after password change

I have an older implementation of the Web API for AD users login with LDAP path. Technically everything worker for the past few years, but now the client said that after he changed his password, he can't login to the app anymore. This occured a few weeks ago, so I think that all of the "LDAP syncing" went trough already... I tried to duplicate this, and after password change, actully both new and old passwords worked fine. After like one hour, the old password stopped working and only the new one works now. This is my implementation of the login, I see there are different kinds of approach, is there any better one that would kinda "force" to use only the latest password?
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;
}
0 Replies
No replies yetBe the first to reply to this messageJoin