asp.net mvc - ASP .NET MVC Forms authorization with Active Directory groups -


i'm attempting authenticate using users , groups in asp.net mvc against active directory.

i have put following attribute on classes (except account class):

[authorize (roles="subcontractdb users")] 

this group found under ou=area->ou=groups->ou=company->cn=subcontractdb in active directory. i'm assuming need setup rolemanager in web.config i've attempted follows:

<rolemanager defaultprovider="adroleprovider">   <providers>     <clear />         <add name="admembershipprovider"               type="system.web.security.activedirectorymembershipprovider"               connectionstringname="adconnectionstring"               attributemapusername="samaccountname" />   </providers> </rolemanager> 

my connection string is:

    <add name="adconnectionstring"           connectionstring="ldap://blah.com:389/dc=blah,dc=wateva,dc=com"/> 

obviously i'm doing wrong doesn't work. want allow access users member of group in ad.

it's no longer necessary implement own attribute functionality in asp.net mvc 3. aspnetwindowstokenroleprovider works active directory users , groups. use authorizeattribute need add following web.config:

<authentication mode="windows" />  <rolemanager enabled="true" defaultprovider="aspnetwindowstokenroleprovider">    <providers>       <clear />       <add            name="aspnetwindowstokenroleprovider"           type="system.web.security.windowstokenroleprovider"            applicationname="/" />    </providers> </rolemanager> 

then, on controllers or action methods, can refer active directory groups so:

[authorize(roles = "yourdomain\\group1, yourdomain\\group2")] 

Comments

Popular posts from this blog

Add email recipient to all new Trac tickets -

400 Bad Request on Apache/PHP AddHandler wrapper -

php - Change action and image src url's with jQuery -