|
|
|
date: Sat, 5 Jul 2008 14:45:07 -0700 (PDT),
group: microsoft.public.dotnet.framework.aspnet.security
back
Re: querying AD users
On Mon, 7 Jul 2008 20:53:34 -0700 (PDT), SpaceMarine wrote:
¤ On Jul 7, 1:29 pm, Alexey Smirnov wrote:
¤
¤ > Note, that if you run it from the ASP.NET application on a server, in
¤ > most cases you may need to implement impersonation in the application,
¤ > before you access the AD.
¤
¤ well, id like to avoid impersonation if possible. if my DirectoryEntry
¤ class is instantiated w/ an optional username & password in its
¤ constructor (a service account given to me by our AD admin), then
¤ would i no longer need to impersonate?
As long as your ASP.NET app is running under an account that has sufficient permissions to query AD
then you should be fine. W/o impersonation, the default account would be ASPNET (2000, XP) or
NetworkService (2003 or higher). You can also configure your ASP.NET app to run under a custom least
privilege account.
With respect to syntax you would want to include the "and" operator in your query as well:
.Filter = "(&(objectClass=user)(lastName = A*))"
The following link should help you with LDAP query syntax:
http://msdn.microsoft.com/en-us/library/aa746475.aspx
Paul
~~~~
Microsoft MVP (Visual Basic)
date: Tue, 08 Jul 2008 10:50:48 -0500
author: Paul Clement
Re: querying AD users
On Jul 8, 5:50 pm, Paul Clement
wrote:
> On Mon, 7 Jul 2008 20:53:34 -0700 (PDT), SpaceMarine wrote:
>
> ¤ On Jul 7, 1:29 pm, Alexey Smirnov wrote:
> ¤
> ¤ > Note, that if you run it from the ASP.NET application on a server, in
> ¤ > most cases you may need to implement impersonation in the application,
> ¤ > before you access the AD.
> ¤
> ¤ well, id like to avoid impersonation if possible. if my DirectoryEntry
> ¤ class is instantiated w/ an optional username & password in its
> ¤ constructor (a service account given to me by our AD admin), then
> ¤ would i no longer need to impersonate?
>
> As long as your ASP.NET app is running under an account that has sufficient permissions to query AD
> then you should be fine. W/o impersonation, the default account would be ASPNET (2000, XP) or
> NetworkService (2003 or higher). You can also configure your ASP.NET app to run under a custom least
> privilege account.
>
> With respect to syntax you would want to include the "and" operator in your query as well:
>
> .Filter = "(&(objectClass=user)(lastName = A*))"
>
> The following link should help you with LDAP query syntax:
>
> http://msdn.microsoft.com/en-us/library/aa746475.aspx
>
sm, you can also move the code for AD to a separated class library
DLL, and refer to it from your main ASP.NET application. You would
need to register that DLL as a COM component (Administrative Tools -
Component Services) using an account that has sufficient permissions
to query AD. In this case you would not need to make an impersonation
within your application and all request to AD would go through the COM
date: Wed, 9 Jul 2008 05:25:58 -0700 (PDT)
author: Alexey Smirnov
|
|