RE: validaing security using AD groups... in web.config



Hi Nalaka,

From your description, you're using ASP.NET membership provider and want to
use AD groups (roles) for authorization in the application ,correct?

Based on the web.config segment you provided, you configured the following
things:

** set membership service to use ADMembershipprovider
** add authorization setting to allow only members of
"bctgtwdom\someADSecurityGroup" AD group to visit default.aspx

However, the problem is that if you use "roles" rather than "users" in
<authorization> entry, that means you use the current user's roles to
perform authorization check. So only configuring membership provider
provider is not enough. Membership provider only help authenticate the
user(verify the user through the given username/password credentials).

Therefore, for the case here, what you need is a RoleManager provider which
can query the AD windows roles of a given user:

#How To: Use Role Manager in ASP.NET 2.0
http://msdn2.microsoft.com/en-us/library/ms998314.aspx#paght000013_step4

There is a built-in windowsTokenRoleProvider in ASP.NET 2.0:

#WindowsTokenRoleProvider Class
http://msdn2.microsoft.com/en-us/library/system.web.security.windowstokenrol
eprovider.aspx\

Or you can implement your own AD Role provider through ADSI codes since the
built-in one may have some limitation and not quite flexible.

#WindowsTokenRoleProvider - Dominick's view
http://www.pluralsight.com/blogs/keith/archive/2006/05/31/26192.aspx

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead



==================================================

Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.



Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.

==================================================


This posting is provided "AS IS" with no warranties, and confers no rights.


--------------------
From: "Nalaka" <nalaka12@xxxxxxxxxxxxx>
Subject: validaing security using AD groups... in web.config
Date: Mon, 5 Nov 2007 17:14:09 -0800

Hi,
I am testing with an asp.net 2.0 app.... has only one page Default.aspx.
I want to deny all users except for a certain AD group.
I did the following... but app keeps allowing everyone in.
What am I doing wrong?

<configuration>
<connectionStrings>
<add name="ADConnectionString"
connectionString="LDAP://gtwds7eap01"; />
</connectionStrings>

<system.web>
<identity impersonate="true"/>
<authentication mode="Windows"/>

<membership defaultProvider="MembershipADProvider">
<providers>
<add name="MembershipADProvider"

type="System.Web.Security.ActiveDirectoryMembershipProvider"
connectionStringName="ADConnectionString"
connectionUsername=""
connectionPassword=""/>
</providers>
</membership>
</system.web>

<location path="Default.aspx">
<system.web>
<authorization>
<allow roles=" bctgtwdom\someADSecurityGroup"/>
<deny users="*"/>
</authorization>
</system.web>
</location>
</configuration>



Any help is deeply appreciated
Thanks
Nalaka






.



Relevant Pages

  • Re: Defining Groups with AD users
    ... For ASP.NET authentication and role based authorization, ... you can configure the membership to use AD ... membership provider and Rolemanager to use SQL server provider. ... Microsoft MSDN Online Support Lead ...
    (microsoft.public.dotnet.framework.aspnet.security)
  • RE: Different password policies for different roles
    ... As you have found, by default, each ASP.NET membership provider has a set ... password related policy to the loosest level. ... Microsoft MSDN Online Support Lead ...
    (microsoft.public.dotnet.framework.aspnet.security)
  • Re: Defining Groups with AD users
    ... For ASP.NET authentication and role based authorization, ... you can configure the membership to use AD ... membership provider and Rolemanager to use SQL server provider. ... Microsoft MSDN Online Support Lead ...
    (microsoft.public.dotnet.framework.aspnet.security)
  • Re: SQL Membership Provider Problem
    ... Roles provider. ... it seems he has registered a new membership ... ASP.NET 2.0 membership &role manager service, they use separate provider, ... Microsoft MSDN Online Support Lead ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: validaing security using AD groups... in web.config
    ... you're using ASP.NET membership provider and want ... use AD groups for authorization in the application,correct? ... Microsoft MSDN Online Support Lead ...
    (microsoft.public.dotnet.framework.aspnet)