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 2014/11/20 21:37:40 UTC

svn commit: r1640805 - in /manifoldcf/trunk: CHANGES.txt connectors/jdbc/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/jdbc/JDBCAuthority.java

Author: kwright
Date: Thu Nov 20 20:37:40 2014
New Revision: 1640805

URL: http://svn.apache.org/r1640805
Log:
Fix for CONNECTORS-1109.

Modified:
    manifoldcf/trunk/CHANGES.txt
    manifoldcf/trunk/connectors/jdbc/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/jdbc/JDBCAuthority.java

Modified: manifoldcf/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/CHANGES.txt?rev=1640805&r1=1640804&r2=1640805&view=diff
==============================================================================
--- manifoldcf/trunk/CHANGES.txt (original)
+++ manifoldcf/trunk/CHANGES.txt Thu Nov 20 20:37:40 2014
@@ -3,6 +3,9 @@ $Id$
 
 ======================= 2.0-dev =====================
 
+CONNECTORS-1109: Bad cache key for JDBC authority.
+(Alejandro Calbazana, Karl Wright)
+
 CONNECTORS-1108: Turn most jobs logging messages from DEBUG
 to INFO.
 (Aeham Abushwashi)

Modified: manifoldcf/trunk/connectors/jdbc/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/jdbc/JDBCAuthority.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/connectors/jdbc/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/jdbc/JDBCAuthority.java?rev=1640805&r1=1640804&r2=1640805&view=diff
==============================================================================
--- manifoldcf/trunk/connectors/jdbc/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/jdbc/JDBCAuthority.java (original)
+++ manifoldcf/trunk/connectors/jdbc/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/jdbc/JDBCAuthority.java Thu Nov 20 20:37:40 2014
@@ -185,7 +185,7 @@ public class JDBCAuthority extends BaseA
   public AuthorizationResponse getAuthorizationResponse(String userName)
     throws ManifoldCFException {
     // Construct a cache description object
-    ICacheDescription objectDescription = new JdbcAuthorizationResponseDescription(userName, createCacheConnectionString(), this.responseLifetime, this.LRUsize);
+    ICacheDescription objectDescription = new JdbcAuthorizationResponseDescription(userName, createCacheConnectionString(), idQuery, tokenQuery, this.responseLifetime, this.LRUsize);
 
     // Enter the cache
     ICacheHandle ch = cacheManager.enterCache(new ICacheDescription[]{objectDescription}, null, null);
@@ -813,15 +813,19 @@ public class JDBCAuthority extends BaseA
     /**
      * The user name
      */
-    protected String userName;
+    protected final String userName;
     /**
      * LDAP connection string with server name and base DN
      */
-    protected String connectionString;
+    protected final String connectionString;
+    /** The user query. */
+    protected final String userQuery;
+    /** The token query. */
+    protected final String tokenQuery;
     /**
      * The response lifetime
      */
-    protected long responseLifetime;
+    protected final long responseLifetime;
     /**
      * The expiration time
      */
@@ -830,10 +834,12 @@ public class JDBCAuthority extends BaseA
     /**
      * Constructor.
      */
-    public JdbcAuthorizationResponseDescription(String userName, String connectionString, long responseLifetime, int LRUsize) {
+    public JdbcAuthorizationResponseDescription(String userName, String connectionString, String userQuery, String tokenQuery, long responseLifetime, int LRUsize) {
       super("JDBCAuthority", LRUsize);
       this.userName = userName;
       this.connectionString = connectionString;
+      this.userQuery = userQuery;
+      this.tokenQuery = tokenQuery;
       this.responseLifetime = responseLifetime;
     }
 
@@ -850,7 +856,8 @@ public class JDBCAuthority extends BaseA
      */
     public String getCriticalSectionName() {
       StringBuilder sb = new StringBuilder(getClass().getName());
-      sb.append("-").append(userName).append("-").append(connectionString);
+      sb.append("-").append(userName).append("-").append(connectionString).append("-")
+        .append(userQuery).append("-").append(tokenQuery);
       return sb.toString();
     }
 
@@ -867,7 +874,8 @@ public class JDBCAuthority extends BaseA
 
     @Override
     public int hashCode() {
-      return userName.hashCode() + connectionString.hashCode();
+      return userName.hashCode() + connectionString.hashCode() +
+        userQuery.hashCode() + tokenQuery.hashCode();
     }
 
     @Override
@@ -882,6 +890,12 @@ public class JDBCAuthority extends BaseA
       if (!ard.connectionString.equals(connectionString)) {
         return false;
       }
+      if (!ard.userQuery.equals(userQuery)) {
+        return false;
+      }
+      if (!ard.tokenQuery.equals(tokenQuery)) {
+        return false;
+      }
       return true;
     }
   }