Search code examples
c#credential-providers

c# custom credential provider


I am trying to develop a custom credential provider. Trying to learn the basics. I implemented ICredentialProvider and ICredentialProviderCredential.

I added a custom credential tile, edit text and command link to windows logon UI.

  1. What i want to do is, when i click on CommandButton i try to read textbox value but i could not do that.

  2. I want to open a custom windows form (e.g MFA form), how can i open a custom form?

I am using phaetto/windows-credentials-provider implementation as example

There is not much information about this topic.


Solution

  • 1. Text field

    You must collect and keep securely the value(s) of text box(ex) field(s) as far as it is updated and your tile implementation class is notified about the change of that value.
    You will be notified about every single character user entered into the text field. Be ready for this.

    As far as user type info input text box your provider's method ICredentialProviderCredential::SetStringValue will be called on every text box update.

    2. Popup window (dialog)

    If you want to open any window you must acquire a parent window handle from Logon UI / Cred UI. Handle acquisition method is ICredentialProviderCredentialEvents::OnCreatingWindow.

    You can find more details in the answer and it's comments: https://stackoverflow.com/a/52089207/3868464 .