RE: ActiveDirectory and user page Access
- From: hongyes@xxxxxxxxxxxxxxxxxxxx ("Hongye Sun [MSFT]")
- Date: Wed, 03 Dec 2008 17:38:02 GMT
Hi Alex,
Thanks for your reply.
Now I have understood your scenario. In my opinion, the easiest way is
using WindowsTokenRoleProvider, since you are going to use AD memberships
and roles (Like Domain\Administrators). However, the provider is target to
Windows Integrated Authentication instead of Form. Is it possible for you
to change authentication type to Windows?
If Form authentication is a must requirement, only
AuthorizationStoreRoleProvider in those 3 providers works for this
scenario. According to
http://msdn.microsoft.com/en-us/library/aa478950.aspx, it says that:
" the fact that GetClientContext abstracts the authentication type means
that AuthorizationStoreRoleProvider works equally well with Windows
authentication and forms authentication. "
The basic idea of AuthorizationStoreRoleProvider is that it connect ASP.net
role manager with Authorization Manager (AzMan) tool, which is included in
W2k03 Administration Tools Pack. AzMan gets role information from AzMan
policy store, which can be configured from XML file, Active Directory and
ADAM. Apparently, we should configure it from AD in this case.
To do this job, please follow the steps below:
1. Install AzMan
Please follow the link you have mentioned before:
http://msdn.microsoft.com/en-us/library/ms998336.aspx#paght000019_rtf%20form
atting_step1 to install windows updates or download Windows Server 2003
Administration Tools Pack.
2. Create an authorization store
Follow this link: http://technet.microsoft.com/en-us/library/cc737065.aspx
Create an authorization store in Active Directory.
3. Configure ActiveDirectoryMembershipProvider and
AuthorizationStoreRoleProvider in web.config file
-----------------------
<connectionStrings>
<add name ="ADConnectionString"
connectionString="LDAP://server/DC=domain,DC=com"/>
<add name ="AzManPolicyStoreConnectionString"
connectionString="LDAP://server/CN=UserStore,DC=domain,DC=com"/>
</connectionStrings>
<system.web>
<membership defaultProvider="MembershipADProvider">
<providers>
<add name ="MembershipADProvider"
type="System.Web.Security.ActiveDirectoryMembershipProvider"
connectionStringName="ADConnectionString"
connectionUsername ="username"
connectionPassword="password"/>
</providers>
</membership>
<roleManager
enabled="true"
cacheRolesInCookie="true"
defaultProvider ="ActiveDirectory"
cookieName =".ASPXROLES"
cookiePath="/"
cookieTimeout="30"
cookieRequireSSL="false"
cookieSlidingExpiration="true"
createPersistentCookie="false"
cookieProtection ="All">
<providers>
<add name="ActiveDirectory"
type="System.Web.Security.AuthorizationStoreRoleProvider"
connectionStringName="AzManPolicyStoreConnectionString"
/>
</providers>
</roleManager>
<authentication mode ="Forms">
<forms loginUrl ="Login.aspx"
protection ="All"
timeout="30"
name ="MyCookie"
requireSSL ="false"
defaultUrl ="Default2.aspx"
/>
</authentication>
<authorization>
<allow roles="MyUsers" />
<deny users="?"/>
</authorization>
-----------------------
4. Configure role authorization in web.config
A typical use for roles is to establish rules that allow or deny access to
pages or folders. You can set up such access rules in the <authorization>
section of the Web.config file. The following example allows users in the
role of members to view pages in the folder named memberPages and denies
access to anyone else.
-----------------------
<configuration>
<location path="memberPages">
<system.web>
<authorization>
<allow roles="Manager" />
<deny users="*" />
</authorization>
</system.web>
</location>
<!-- other configuration settings here -->
</configuration>
-----------------------
5. Use Role API
If you want to manage role in the code, please use APIs:
Roles.IsUserInRole("roleName")
Roles.GetRolesForUser()
Roles.IsUserInRole("username", "roleName")
Please have a try and let me know if it works. Thanks.
Regards,
Hongye Sun (hongyes@xxxxxxxxxxxxxxxxxxxx, remove 'online.')
Microsoft Online Community Support
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
msdnmg@xxxxxxxxxxxxxx
This posting is provided "AS IS" with no warranties, and confers no rights.
.
- Follow-Ups:
- RE: ActiveDirectory and user page Access
- From: Alex. O. Koranteng
- RE: ActiveDirectory and user page Access
- References:
- RE: ActiveDirectory and user page Access
- From: "Hongye Sun [MSFT]"
- RE: ActiveDirectory and user page Access
- From: Alex. O. Koranteng
- RE: ActiveDirectory and user page Access
- From: "Hongye Sun [MSFT]"
- RE: ActiveDirectory and user page Access
- From: Alex. O. Koranteng
- RE: ActiveDirectory and user page Access
- Prev by Date: RE: ActiveDirectory and user page Access
- Next by Date: RE: ActiveDirectory and user page Access
- Previous by thread: RE: ActiveDirectory and user page Access
- Next by thread: RE: ActiveDirectory and user page Access
- Index(es):
Relevant Pages
|