You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@manifoldcf.apache.org by kw...@apache.org on 2011/04/16 11:45:40 UTC
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
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.