Skip to content

How to verify credentials in CredentialDialog ? #4

Answered by augustoproiete
mridah asked this question in Q&A
Discussion options

You must be logged in to vote

@mridah The CredentialDialog class is meant to be a generic user/password dialog that you can use to capture the user's login and password and then you validate it against any authentication system you want...

You will have to write the code for validating your credentials against your Active Directory, or some other authentication system you have...

For example, if you want to validate against a Active Directory in your domain, you

using System.DirectoryServices.AccountManagement;

void Main()
{
	using (PrincipalContext pc = new PrincipalContext(ContextType.Domain, "YOUR-DOMAIN-NAME"))
	{
		bool isValid = pc.ValidateCredentials("user-login", "user-password");
		
		// ...
	}
}

You can fin…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by augustoproiete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #4 on December 18, 2020 04:25.