in src/Unosquare.PassCore.PasswordProvider/PasswordChangeProvider.cs [128:145]
private bool ValidateUserCredentials(
string upn,
string currentPassword,
PrincipalContext principalContext)
{
if (principalContext.ValidateCredentials(upn, currentPassword))
return true;
if (NativeMethods.LogonUser(upn, string.Empty, currentPassword, NativeMethods.LogonTypes.Network, NativeMethods.LogonProviders.Default, out _))
return true;
var errorCode = System.Runtime.InteropServices.Marshal.GetLastWin32Error();
_logger.LogDebug($"ValidateUserCredentials GetLastWin32Error {errorCode}");
// Both of these means that the password CAN change and that we got the correct password
return errorCode == NativeMethods.ErrorPasswordMustChange || errorCode == NativeMethods.ErrorPasswordExpired;
}