all groups > dotnet security > august 2006 >
You're in the

dotnet security

group:

Windows Authentication in VB.Net Application



Windows Authentication in VB.Net Application Rocky Neurock
8/30/2006 6:43:43 AM
dotnet security: I have an application that requires a user name and password so no one
sits down at anyone else's desk and runs the application as that user.
I don't want to create a database to store user names and passwords.
All I want to do is prompt the user for their Windows user name and
password and verify it against the domain and not their local system.
This is so users can run the application on other user's systems
without having to log in to that system. This is necessary so that
managers and supervisors can access the application at any workstation.

I haven't found any nice code examples demostrating an effective way to
check user credentials in a windows forms application. Does anyone
have any thoughts, suggestions? Thanks.
Re: Windows Authentication in VB.Net Application Joe Kaplan
8/30/2006 9:28:38 AM
You can basically either use the LogonUser API (which has a wrapper
documented in the code sample for the WindowsImpersonationContext class) or
you can use SSPI directly, which is normally done using the NegotiateStream
class.

In order to provide the UI, you should probably use
CredUIPromptForCredentials.

Joe K.

--
Joe Kaplan-MS MVP Directory Services Programming
Co-author of "The .NET Developer's Guide to Directory Services Programming"
http://www.directoryprogramming.net
--
[quoted text, click to view]

Re: Windows Authentication in VB.Net Application Rocky Neurock
8/30/2006 10:12:18 AM
I looked into the example for the WindowsImpersonationContext class and
it said that it would only work with XP and we use 2K. I tried it
anyway and I could not get it to work. I also looked for
NegotiateStream and that said it was part of the 2.0 framework and we
are working with the 1.1 framework. Any other ideas?

[quoted text, click to view]
Re: Windows Authentication in VB.Net Application Rocky Neurock
8/30/2006 11:34:22 AM
Thanks Dominick, that solved my problem. I hope everyone else with the
same problem checks this post.

[quoted text, click to view]
Re: Windows Authentication in VB.Net Application Dominick Baier
8/30/2006 5:37:25 PM
On w2k you need very high privileges to call LogonUser - i found Keith's
old SSPI Verififer that works on w2k as a normal user.

http://www.develop.com/technology/resourcedetail.aspx?id=ee929f0b-1f9d-4a2a-92a1-911706bd7b52

---
Dominick Baier, DevelopMentor
http://www.leastprivilege.com

[quoted text, click to view]

AddThis Social Bookmark Button