[java-identity-provider] branch main updated: IDP-1674 - Allow override of table name on StoredId connector

Scott Cantor cantor.2 at osu.edu
Tue Oct 20 16:53:32 UTC 2020


This is an automated email from the git hooks/post-receive script.

scantor pushed a commit to branch main
in repository java-identity-provider.

View the commit online:
http://git.shibboleth.net/view/?p=java-identity-provider.git;a=commit;h=aa13d7ed59022ac0ce016a22f99d03e72489a1a9

The following commit(s) were added to refs/heads/main by this push:
       new  aa13d7ed5 IDP-1674 - Allow override of table name on StoredId connector
aa13d7ed5 is described below

commit aa13d7ed59022ac0ce016a22f99d03e72489a1a9
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Tue Oct 20 12:53:28 2020 -0400

    IDP-1674 - Allow override of table name on StoredId connector
    
    https://issues.shibboleth.net/jira/browse/IDP-1674
---
 .../shibboleth/idp/attribute/impl/JDBCPairwiseIdStore.java    | 11 +++++++++++
 .../resolver/spring/dc/impl/StoredIdDataConnectorParser.java  |  5 +++++
 .../resolver/spring/dc/StoredIdDataConnectorParserTest.java   |  2 ++
 .../attribute/resolver/spring/dc/resolver/storedNoSalt.xml    |  3 ++-
 .../main/resources/schema/shibboleth-attribute-resolver.xsd   | 11 +++++++++--
 5 files changed, 29 insertions(+), 3 deletions(-)

diff --git a/idp-attribute-impl/src/main/java/net/shibboleth/idp/attribute/impl/JDBCPairwiseIdStore.java b/idp-attribute-impl/src/main/java/net/shibboleth/idp/attribute/impl/JDBCPairwiseIdStore.java
index b32a77b2e..8b966dac7 100644
--- a/idp-attribute-impl/src/main/java/net/shibboleth/idp/attribute/impl/JDBCPairwiseIdStore.java
+++ b/idp-attribute-impl/src/main/java/net/shibboleth/idp/attribute/impl/JDBCPairwiseIdStore.java
@@ -269,6 +269,17 @@ public class JDBCPairwiseIdStore extends AbstractInitializableComponent implemen
         
         verifyDatabase = flag;
     }
+    
+    /**
+     * Gets the table name.
+     * 
+     * @return table name
+     * 
+     * @since 4.1.0
+     */
+    @Nonnull @NotEmpty public String getTableName() {
+        return tableName;
+    }
 
     /**
      * Set the table name.
diff --git a/idp-attribute-resolver-spring/src/main/java/net/shibboleth/idp/attribute/resolver/spring/dc/impl/StoredIdDataConnectorParser.java b/idp-attribute-resolver-spring/src/main/java/net/shibboleth/idp/attribute/resolver/spring/dc/impl/StoredIdDataConnectorParser.java
index 5c19d8612..8814c76ab 100644
--- a/idp-attribute-resolver-spring/src/main/java/net/shibboleth/idp/attribute/resolver/spring/dc/impl/StoredIdDataConnectorParser.java
+++ b/idp-attribute-resolver-spring/src/main/java/net/shibboleth/idp/attribute/resolver/spring/dc/impl/StoredIdDataConnectorParser.java
@@ -84,6 +84,11 @@ public class StoredIdDataConnectorParser extends ComputedIdDataConnectorParser {
             builder.addPropertyValue("transactionRetries",
                     StringSupport.trimOrNull(config.getAttributeNS(null, "transactionRetries")));
         }
+        
+        if (config.hasAttributeNS(null, "tableName")) {
+            builder.addPropertyValue("tableName",
+                    StringSupport.trimOrNull(config.getAttributeNS(null, "tableName")));
+        }
 
         if (config.hasAttributeNS(null, "failFast")) {
             // V4 Deprecation
diff --git a/idp-attribute-resolver-spring/src/test/java/net/shibboleth/idp/attribute/resolver/spring/dc/StoredIdDataConnectorParserTest.java b/idp-attribute-resolver-spring/src/test/java/net/shibboleth/idp/attribute/resolver/spring/dc/StoredIdDataConnectorParserTest.java
index 644d6e353..985bdf63e 100644
--- a/idp-attribute-resolver-spring/src/test/java/net/shibboleth/idp/attribute/resolver/spring/dc/StoredIdDataConnectorParserTest.java
+++ b/idp-attribute-resolver-spring/src/test/java/net/shibboleth/idp/attribute/resolver/spring/dc/StoredIdDataConnectorParserTest.java
@@ -110,5 +110,7 @@ public class StoredIdDataConnectorParserTest extends BaseAttributeDefinitionPars
         final ResolverAttributeDefinitionDependency attrib = connector.getAttributeDependencies().iterator().next();
         assertEquals(attrib.getDependencyPluginId(), "theSourceRemainsTheSame");
         testIt(connector);
+        final JDBCPairwiseIdStore store = (JDBCPairwiseIdStore) connector.getPairwiseIdStore();
+        assertEquals(store.getTableName(), "testtable");
     }
 }
diff --git a/idp-attribute-resolver-spring/src/test/resources/net/shibboleth/idp/attribute/resolver/spring/dc/resolver/storedNoSalt.xml b/idp-attribute-resolver-spring/src/test/resources/net/shibboleth/idp/attribute/resolver/spring/dc/resolver/storedNoSalt.xml
index 15bc931d1..808896095 100644
--- a/idp-attribute-resolver-spring/src/test/resources/net/shibboleth/idp/attribute/resolver/spring/dc/resolver/storedNoSalt.xml
+++ b/idp-attribute-resolver-spring/src/test/resources/net/shibboleth/idp/attribute/resolver/spring/dc/resolver/storedNoSalt.xml
@@ -5,8 +5,9 @@
 	
     failFast="false"
     queryTimeout="PT5S"
-    transactionRetries="5"
+    transactionRetries="5"    
     retryableErrors="25000 25001"
+    tableName="testtable"
 	generatedAttributeID="jenny"
 	xsi:schemaLocation="urn:mace:shibboleth:2.0:resolver http://shibboleth.net/schema/idp/shibboleth-attribute-resolver.xsd">
 	<InputAttributeDefinition ref="theSourceRemainsTheSame"/>
diff --git a/idp-schema/src/main/resources/schema/shibboleth-attribute-resolver.xsd b/idp-schema/src/main/resources/schema/shibboleth-attribute-resolver.xsd
index 769ac5df4..ebfdc7784 100644
--- a/idp-schema/src/main/resources/schema/shibboleth-attribute-resolver.xsd
+++ b/idp-schema/src/main/resources/schema/shibboleth-attribute-resolver.xsd
@@ -1486,7 +1486,7 @@
     <complexType name="StoredId">
         <annotation>
             <documentation>
-                A connector that either generates a persistent ID by hashing or by looking it up in a database.
+                A connector that retrieves a pairwise ID from a database.
             </documentation>
         </annotation>
         <complexContent>
@@ -1527,10 +1527,17 @@
                         </documentation>
                     </annotation>
                 </attribute>
+                <attribute name="tableName" type="resolver:string">
+                    <annotation>
+                        <documentation>
+                            Overrides name of database table to use.
+                        </documentation>
+                    </annotation>
+                </attribute>
                 <attribute name="failFast" type="resolver:string">
                     <annotation>
                         <documentation>
-			  Deprecated, use failFastInitialize
+       	                    Deprecated, use failFastInitialize
                         </documentation>
                     </annotation>
                 </attribute>

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the commits mailing list