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/15 23:29:03 UTC

svn commit: r1092818 - in /incubator/lcf/branches/CONNECTORS-32: ./ connectors/activedirectory/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/activedirectory/ActiveDirectoryAuthority.java

Author: kwright
Date: Fri Apr 15 21:29:02 2011
New Revision: 1092818

URL: http://svn.apache.org/viewvc?rev=1092818&view=rev
Log:
Create the object description class.

Modified:
    incubator/lcf/branches/CONNECTORS-32/   (props changed)
    incubator/lcf/branches/CONNECTORS-32/connectors/activedirectory/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/activedirectory/ActiveDirectoryAuthority.java

Propchange: incubator/lcf/branches/CONNECTORS-32/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Apr 15 21:29:02 2011
@@ -1,3 +1,3 @@
 /incubator/lcf/branches/CONNECTORS-151-branch:1063444-1071206
 /incubator/lcf/branches/CONNECTORS-160-branch:1071241-1071534
-/incubator/lcf/trunk:1092566,1092568,1092631
+/incubator/lcf/trunk:1092566,1092568,1092631,1092805,1092813

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=1092818&r1=1092817&r2=1092818&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 Fri Apr 15 21:29:02 2011
@@ -562,6 +562,75 @@ public class ActiveDirectoryAuthority ex
     return strSID.toString();
   }
 
+  protected static long responseLifetime = 300000L;
+  protected static int LRUsize = 1000;
+  protected static StringSet emptyStringSet = new StringSet();
+  
+  /** This is the cache object descriptor for cached access tokens from
+  * this connector.
+  */
+  protected static class AuthorizationResponseDescription extends org.apache.manifoldcf.core.cachemanager.BaseDescription
+  {
+    /** The user name associated with the access tokens */
+    protected String userName;
+    /** The domain controller associated with the access tokens */
+    protected String domainControllerName;
+    /** The admin user name */
+    protected String adminUserName;
+    /** The admin password */
+    protected String adminPassword;
+    /** The expiration time */
+    protected long expirationTime = -1;
+    
+    /** Constructor. */
+    public AuthorizationResponseDescription(String userName, String domainControllerName,
+      String adminUserName, String adminPassword)
+    {
+      super("ActiveDirectoryAuthority",LRUsize);
+      this.userName = userName;
+      this.domainControllerName = domainControllerName;
+      this.adminUserName = adminUserName;
+      this.adminPassword = adminPassword;
+    }
+
+    /** Return the invalidation keys for this object. */
+    public StringSet getObjectKeys()
+    {
+      return emptyStringSet;
+    }
+
+    /** Get the critical section name, used for synchronizing the creation of the object */
+    public String getCriticalSectionName()
+    {
+      return getClass().getName() + "-" + userName + "-" + domainControllerName +
+        "-" + adminUserName + "-" + adminPassword;
+    }
+
+    /** Return the object expiration interval */
+    public long getObjectExpirationTime(long currentTime)
+    {
+      if (expirationTime == -1)
+        expirationTime = currentTime + responseLifetime;
+      return expirationTime;
+    }
+
+    public int hashCode()
+    {
+      return userName.hashCode() + domainControllerName.hashCode() + adminUserName.hashCode() +
+        adminPassword.hashCode();
+    }
+    
+    public boolean equals(Object o)
+    {
+      if (!(o instanceof AuthorizationResponseDescription))
+        return false;
+      AuthorizationResponseDescription ard = (AuthorizationResponseDescription)o;
+      return ard.userName.equals(userName) && ard.domainControllerName.equals(domainControllerName) &&
+        ard.adminUserName.equals(adminUserName) && ard.adminPassword.equals(adminPassword);
+    }
+    
+  }
+  
 }