Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeDNN Open Source...DNN Open Source...Provider and Extension ForumsProvider and Extension ForumsAuthenticationAuthenticationCaching and nested-groups mod for AD provider in .net 3.5Caching and nested-groups mod for AD provider in .net 3.5
Previous
 
Next
New Post
6/13/2008 2:08 AM
 
Hi guys,
 
I have made some modifications for the ActiveDirectory provider 1.00.03, and am presenting them here if anyone wants them.
 
Problem:
 
We deployed DotNetNuke as our new Intranet CMS recently, and installed the ActiveDirectory provider. Auto-login, user group->DNN role synchronisation, etc, all worked fine. However, we found that the initial load of the page took up to 10 seconds for each users' session (depending on the number of groups they were in). I installed debug code into the source for the provider, and discovered that up to 3 seconds was being spent interrogating AD, and then up to 6 seconds getting the DNN roles and synchronising them. This was happening even if only 1 user was accessing the system, so it wasn’t a capacity problem: the webserver is a quad-core Xeon 5345 in Windows 2003 R2 64-bit, 4GB RAM.
 
We tried 1.00.04 (1.00.03 installed initially) and it didn't really speed it up - our old Intranet had near-instantaneous load-up so there was pressure to come up with a solution.
 
We also found out that nested groups weren’t coming through. For example, I am in the “IT” user group, which is part of the “All Staff” group. However, I wasn’t being added to the All Staff role, only the IT role. Debugging the code showed that the provider wasn’t getting all of the groups I was in, if they were nested.
 
Solution:
 
We have .Net 3.5 installed, so I decided to convert the module to .Net 3.5, so I could access the new AD functions: System.DirectoryServices.AccountManagement and UserPrinciples.GetAuthorizationGroups which automatically does the recursive look up of groups.
 
I also added use of the Cache object from ASP.NET – now, the DNN roles are retrieved once and then cached for 8 hours – each users' groups are also retrieved from AD and then cached, when they hit the site. I added a CacheDependancy for those cache objects to a file on our server (a small text file) which we can ‘touch’ to make the entire cache become invalidated, and everything re-synced again, if we make changes to a users’ groups or the DNN roles.
 
I made the code changes to 1.00.03, but they should easily come through to 1.00.04.
 
The installation of this module was easy (ie just overwrote DotNetNuke.Authentication.ActiveDirectory.dll with our modded one)
 
Now, although the initial load of the day still takes up to 10 seconds, subsequent loads are near-instantaneous, even for different users, as the biggest speed hit is getting the DNN roles (ie by LoadGroupInfo() in ADSIProvider.vb).
 
If anyone would like the source code and install instructions for this mod we’re running, let me know, I can add them here.
 
New Post
6/13/2008 11:11 AM
 

Good work Speccy. Unfortunately I have to keep the provider .NET 2.0 compliant for the time being (and it's not even all the way there yet, still lots of .NET 1.x stuff there).

I am surprised that you weren't getting the nested groups. Were they Security groups or Distribution groups that weren't coming through. I was just doing some debugging of the code yesterday at work and the TokenGroups procedure (which returns the memberOf portion of the AD account) was return 56 groups for my account. Heck, there were some there that I didn't realize were parent groups for groups I knew I belonged to.

Have you looked at LDAPBrowser (http://www.ldapbrowser.com)? If you run that against your AD and compare the memberOf against what's returned in the provider good when the nested groups are searched you should get the same information.

 
New Post
6/15/2008 6:37 PM
 

Thanks Mike - I figured that the code I've been working on wouldn't be suitable for inclusion- that's fine. It's really just a mod I've put in for our situation, and if it works for people, my stuff only makes it more complicated.

Is the use of TokenGroups a recent thing in 1.00.04? I tested last about a month and a half ago. However, I ran LdapExplorer (I think similar to LdapBrowser) and checked out my account. I see 37 instances of the "memberOf" property - which is not right for nested groups - I have actually ~50 something groups as seen by GetAuthorisationGroups(). Indeed, going through the list, I'm not seeing the parent groups I expected. Perhaps there is a setting in our AD which is differant from the norm. That's definetly possible, I'm not so involved in that aspect of our operation.

 
New Post
6/15/2008 10:49 PM
 

TokenGroups was implemented in the beta that was release about mid-May. I went with TokenGroups based on the advice from one of the authors of The .NET Developers Guide to Directory Services Programming.

Out of those ~50 groups are they all Security groups or are some Distribution groups? I know that TokenGroups doesn't get Distribution groups.

 
New Post
6/15/2008 11:14 PM
 

Ah - the version I tested wouldn't have included TokenGroups then. PS they are definetly all security groups. I'm sure the latest beta will fix my nested group problem.

 
Previous
 
Next
HomeHomeDNN Open Source...DNN Open Source...Provider and Extension ForumsProvider and Extension ForumsAuthenticationAuthenticationCaching and nested-groups mod for AD provider in .net 3.5Caching and nested-groups mod for AD provider in .net 3.5


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out