[java-identity-provider COMMIT] in /trunk: idp-attribute-resolver-api/src/main/java/net/shibboleth/idp/attribute/reso...

noreply at shibboleth.net noreply at shibboleth.net
Wed May 6 06:34:56 EDT 2015


Author: rdw
Date: Wed May  6 06:34:56 2015
New Revision: 7496

URL: http://svn.shibboleth.net/view/java-identity-provider?rev=7496&view=rev
Log:
IDP703 Copy resolved attributes from the failover connector to the failed

Modified:
    trunk/idp-attribute-resolver-api/src/main/java/net/shibboleth/idp/attribute/resolver/context/AttributeResolverWorkContext.java
    trunk/idp-attribute-resolver-impl/src/main/java/net/shibboleth/idp/attribute/resolver/impl/AttributeResolverImpl.java
    trunk/idp-attribute-resolver-impl/src/test/java/net/shibboleth/idp/attribute/resolver/impl/AttributeResolverImplTest.java

Modified: trunk/idp-attribute-resolver-api/src/main/java/net/shibboleth/idp/attribute/resolver/context/AttributeResolverWorkContext.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-attribute-resolver-api/src/main/java/net/shibboleth/idp/attribute/resolver/context/AttributeResolverWorkContext.java?rev=7496&r1=7495&r2=7496&view=diff
==============================================================================
--- trunk/idp-attribute-resolver-api/src/main/java/net/shibboleth/idp/attribute/resolver/context/AttributeResolverWorkContext.java	(original)
+++ trunk/idp-attribute-resolver-api/src/main/java/net/shibboleth/idp/attribute/resolver/context/AttributeResolverWorkContext.java	Wed May  6 06:34:56 2015
@@ -40,11 +40,12 @@
 import com.google.common.collect.MapConstraints;
 
 /**
- * A context which carries and collects information through the attribute resolution process,
- * and coordinates data between the resolver implementation and the various resolver plugin
- * implementations.
- * 
- * <p>This should be considered a private API limited to plugin implementations.</p>
+ * A context which carries and collects information through the attribute resolution process, and coordinates data
+ * between the resolver implementation and the various resolver plugin implementations.
+ *
+ * <p>
+ * This should be considered a private API limited to plugin implementations.
+ * </p>
  */
 @NotThreadSafe
 public class AttributeResolverWorkContext extends BaseContext {
@@ -127,5 +128,35 @@
         final ResolvedDataConnector wrapper = new ResolvedDataConnector(connector, attributes);
         resolvedDataConnectors.put(connector.getId(), wrapper);
     }
-    
+
+    /**
+     * Transfer the attributes from a failover dataconnector to a failed one. This allows up stream processing to
+     * pretend that the failed connector worked OK. The inherent duplication is OK since the code which exploits this
+     * does the dedupe.
+     *
+     * @param failedConnector the connector which failed and provoked the failover.
+     * @param failoverConnector the failover connector which did resolve OK.
+     * @throws ResolutionException if badness ocurrs
+     */
+    public void recordFailoverResolution(@Nonnull final DataConnector failedConnector,
+            @Nonnull final DataConnector failoverConnector) throws ResolutionException {
+
+        if (failoverConnector == null) {
+            return;
+        }
+
+        if (resolvedDataConnectors.containsKey(failedConnector.getId())) {
+            throw new ResolutionException("The resolution of data connector " + failedConnector.getId()
+                    + " has already been recorded");
+        }
+
+        final ResolvedDataConnector resolvedFailoverConector = resolvedDataConnectors.get(failoverConnector.getId());
+        if (null == resolvedFailoverConector) {
+            throw new ResolutionException("The resolution of failover conector" + failoverConnector.getId()
+                    + " was not recorded");
+        }
+        final ResolvedDataConnector wrapper =
+                new ResolvedDataConnector(failedConnector, resolvedFailoverConector.getResolvedAttributes());
+        resolvedDataConnectors.put(failedConnector.getId(), wrapper);
+    }
 }

Modified: trunk/idp-attribute-resolver-impl/src/main/java/net/shibboleth/idp/attribute/resolver/impl/AttributeResolverImpl.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-attribute-resolver-impl/src/main/java/net/shibboleth/idp/attribute/resolver/impl/AttributeResolverImpl.java?rev=7496&r1=7495&r2=7496&view=diff
==============================================================================
--- trunk/idp-attribute-resolver-impl/src/main/java/net/shibboleth/idp/attribute/resolver/impl/AttributeResolverImpl.java	(original)
+++ trunk/idp-attribute-resolver-impl/src/main/java/net/shibboleth/idp/attribute/resolver/impl/AttributeResolverImpl.java	Wed May  6 06:34:56 2015
@@ -315,6 +315,7 @@
                         + " connector '{}'.  Reason for failure:", logPrefix, connectorId,
                         failoverDataConnectorId, e);
                 resolveDataConnector(failoverDataConnectorId, resolutionContext);
+                workContext.recordFailoverResolution(connector, dataConnectors.get(failoverDataConnectorId));
                 return;
             } else {
                 // Pass it on. Do not look at propagateException because this is handled in the
@@ -365,7 +366,7 @@

[... 24 lines stripped ...]


More information about the commits mailing list