1

Q. How can I reuse in WPF the security features provided by the Windows credentials dialog (WinForms32)?

Brainstorm (not sure if any of these are possible):

  1. Host the WinForms32 dialog inside my own WPF dialog. MSDN has an article that explains how to host a WinForms control (i.e., textbox, etc.) but not a WinForms dialog. Yes, this will be ugly, but we're not worried about looks right now.

  2. Provide a WPF GUI that wraps the WinForms dialog. Upon login, the WPF username textbox and WPF SecurePassword textbox are transferred to their WinForms equivalent under the covers. The moving of sensitive data might pose a security risk (but some may argue that the attacker has plenty of other ways to steal your password).

  3. Move the WinForms username and password textboxes to the WPF dialog ("re-parent" the existing textboxes).

Any suggestions/comments (including criticism of my ideas) are appreciated!

Community
  • 1
  • 1
tony19
  • 125,647
  • 18
  • 229
  • 307
  • i usually don't ask why, but with security i must... Why? (isn't the user already logged in?) – Jake Berger Mar 19 '12 at 21:17
  • No, not necessarily. The login domain for this application isn't necessarily the same as the one used to log into Windows. The application allows switching the authentication server. – tony19 Mar 20 '12 at 02:35
  • the `Windows credentials dialog` article that you linked to shows all of the background code. why can't you just plop it into a custom `Window`? – Jake Berger Mar 20 '12 at 13:49
  • That article doesn't indicate how to "plop it into a custom window". I wish it were that simple. – tony19 Mar 20 '12 at 16:44
  • lolz, sorry for that. they have all the needed pinvoke functions there. create a custom WPF window with the user, password, etc controls and pinvoke on OK. – Jake Berger Mar 20 '12 at 17:15

1 Answers1

0

You can just show WinForms dialog in WPF application the same way you do it in regular WinForms application and it just works. For example WPF does not have FolderBrowserDialog but we use WinForms version of this dialog and it works ok.

Nikolay
  • 3,658
  • 1
  • 24
  • 25