Last post May 04, 2021 05:14 AM by ChaoDeng
May 03, 2021 02:20 PM|Baze72|LINK
How can I check the current user (to see of they have access to AD to unlock a user) and use that user to unlock an account? If I hard code a username and password in the PrinipalContext it works fine. I just don't want to expose a password:
public ActionResult Unlock(string user)
PrincipalContext ctx = new PrincipalContext(ContextType.Domain);
// find a user
UserPrincipal usr = UserPrincipal.FindByIdentity(ctx, user);
if (usr != null)
May 03, 2021 09:08 PM|PatriceSc|LINK
You could perhaps use
https://docs.microsoft.com/en-us/troubleshoot/aspnet/implement-impersonation#impersonate-the-authenticating-user-in-code to impersonate the user and connect to AD on behalf of this user.
Or you could grant access to your app to so that users not having this permission can unlock users only through your app ?
May 04, 2021 05:14 AM|ChaoDeng|LINK
Microsoft provides an AD account lockout tool to check the lockout status:
Account Lockout and Management Tools.
You can use this tool to check the status and find the source of the lock.
You can use the method can refer to the