incubator-connectors-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kwri...@apache.org
Subject svn commit: r1093954 - in /incubator/lcf/branches/CONNECTORS-32: CHANGES.txt connectors/activedirectory/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/activedirectory/ActiveDirectoryAuthority.java
Date Sat, 16 Apr 2011 09:45:40 GMT
Author: kwright
Date: Sat Apr 16 09:45:40 2011
New Revision: 1093954

URL: http://svn.apache.org/viewvc?rev=1093954&view=rev
Log:
Add access-token caching to active directory authority

Modified:
    incubator/lcf/branches/CONNECTORS-32/CHANGES.txt
    incubator/lcf/branches/CONNECTORS-32/connectors/activedirectory/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/activedirectory/ActiveDirectoryAuthority.java

Modified: incubator/lcf/branches/CONNECTORS-32/CHANGES.txt
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/CONNECTORS-32/CHANGES.txt?rev=1093954&r1=1093953&r2=1093954&view=diff
==============================================================================
--- incubator/lcf/branches/CONNECTORS-32/CHANGES.txt (original)
+++ incubator/lcf/branches/CONNECTORS-32/CHANGES.txt Sat Apr 16 09:45:40 2011
@@ -2,6 +2,9 @@ ManifoldCF Change Log
 $Id$
 
 ======================= 0.3-dev =========================
+CONNECTORS-32: Add access token caching to the Active Directory
+authority connector.
+(Shinichiro Abe, Karl Wright)
 
 CONNECTORS-181: Fix the way timed expiration works to agree with
 the description, and pass in a current time parameter to make it

Modified: incubator/lcf/branches/CONNECTORS-32/connectors/activedirectory/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/activedirectory/ActiveDirectoryAuthority.java
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/CONNECTORS-32/connectors/activedirectory/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/activedirectory/ActiveDirectoryAuthority.java?rev=1093954&r1=1093953&r2=1093954&view=diff
==============================================================================
--- incubator/lcf/branches/CONNECTORS-32/connectors/activedirectory/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/activedirectory/ActiveDirectoryAuthority.java
(original)
+++ incubator/lcf/branches/CONNECTORS-32/connectors/activedirectory/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/activedirectory/ActiveDirectoryAuthority.java
Sat Apr 16 09:45:40 2011
@@ -160,8 +160,36 @@ public class ActiveDirectoryAuthority ex
   public AuthorizationResponse getAuthorizationResponse(String userName)
     throws ManifoldCFException
   {
-    // MHL
-    return getAuthorizationResponseUncached(userName);
+    // Construct a cache description object
+    ICacheDescription objectDescription = new AuthorizationResponseDescription(userName,domainControllerName,this.userName,this.password);
+    
+    // Enter the cache
+    ICacheHandle ch = cacheManager.enterCache(new ICacheDescription[]{objectDescription},null,null);
+    try
+    {
+      ICacheCreateHandle createHandle = cacheManager.enterCreateSection(ch);
+      try
+      {
+        // Lookup the object
+        AuthorizationResponse response = (AuthorizationResponse)cacheManager.lookupObject(createHandle,objectDescription);
+        if (response != null)
+          return response;
+        // Create the object.
+        response = getAuthorizationResponseUncached(userName);
+        // Save it in the cache
+        cacheManager.saveObject(createHandle,objectDescription,response);
+        // And return it...
+        return response;
+      }
+      finally
+      {
+        cacheManager.leaveCreateSection(createHandle);
+      }
+    }
+    finally
+    {
+      cacheManager.leaveCache(ch);
+    }
   }
   
   /** Obtain the access tokens for a given user name, uncached.



Mime
View raw message