Re: Authenticate Against localhost and AD
From: Michał Januszczyk (MichaJanuszczyk_at_discussions.microsoft.com)
Date: 06/28/04
- Next message: Gionni: "Https and certificate store"
- Previous message: Joe Kaplan \(MVP - ADSI\): "Re: Authenticate Against localhost and AD"
- In reply to: Joe Kaplan \(MVP - ADSI\): "Re: Authenticate Against localhost and AD"
- Next in thread: Joe Kaplan \(MVP - ADSI\): "Re: Authenticate Against localhost and AD"
- Reply: Joe Kaplan \(MVP - ADSI\): "Re: Authenticate Against localhost and AD"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Date: Mon, 28 Jun 2004 08:05:01 -0700
"Joe Kaplan (MVP - ADSI)" wrote:
> ASPNET can definitely talking to Active Directory. However, you may need to
> supply a domain controller name in your LDAP path as well as valid domain
> credentials depending on what you are binding to. If you just want to test
> user names and passwords via a DirectoryEntry bind, this will work fine.
> Make sure you use the LDAP provider though.
currently i'm using the following code to talk to DC:
string path = @"LDAP://CN=Users,DC=mydomain,DC=com";
DirectoryEntry entry = new DirectoryEntry(path, domainAndUsername, pwd);
DirectorySearcher search =null;
try
{
// Bind to the native AdsObject to force authentication.
Object obj = entry.NativeObject;
...
}
What can I change here to make ASPNET account to connect (and talk) to AD ?
> For authenticating against local machine accounts, the WinNT provider is not
> well suited for this as it has all sorts of problems binding with different
> credentials in the same process. It would probably be better to call the
> LogonUser API to test the user's credentials (although you'll need high
> privileges to call this API in Win2K). LogonUser can also validate domain
> credentials.
I cannot use LogonUser function since this would make the whole application working as another user for fraction of time. If the application would require to do something that the "curret account" cannot do, there would be an error. This is quite low probable, but may happen. I might use locking here, but i would have to enforce locking in many places in the application (the app stimultaneously serves many users)
> Instead of doing this authentication in code, is it possible for you to
> leverage IIS security to do this work for you?
I can not do that since I'm using forms authentication.
The application allows to use application-specific accounts
(if somebody does not want to use windows accounts), local machine
windows accounts (authentication code example has been provided),
and domain-wide accounts, if the machine is conected into domain.
Thank You
Michał
- Next message: Gionni: "Https and certificate store"
- Previous message: Joe Kaplan \(MVP - ADSI\): "Re: Authenticate Against localhost and AD"
- In reply to: Joe Kaplan \(MVP - ADSI\): "Re: Authenticate Against localhost and AD"
- Next in thread: Joe Kaplan \(MVP - ADSI\): "Re: Authenticate Against localhost and AD"
- Reply: Joe Kaplan \(MVP - ADSI\): "Re: Authenticate Against localhost and AD"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Relevant Pages
|