[java-identity-provider COMMIT] in /trunk: idp-profile-api/src/main/java/net/shibboleth/idp/profile/context/MultiRely...

noreply at shibboleth.net noreply at shibboleth.net
Mon Sep 1 10:58:32 EDT 2014


Author: scantor
Date: Mon Sep  1 10:58:32 2014
New Revision: 6490

URL: http://svn.shibboleth.net/view/java-identity-provider?rev=6490&view=rev
Log:
IDP-224 - checkpoint work on extending RP contexts during logout

Added:
    trunk/idp-session-impl/src/main/java/net/shibboleth/idp/session/impl/PopulateMultiRPContextFromLogoutContext.java   (with props)
    trunk/idp-session-impl/src/main/java/net/shibboleth/idp/session/impl/ProcessLogoutRelyingParties.java   (with props)
    trunk/idp-session-impl/src/test/java/net/shibboleth/idp/session/impl/PopulateMultiRPContextFromLogoutContextTest.java   (with props)
    trunk/idp-session-impl/src/test/java/net/shibboleth/idp/session/impl/ProcessLogoutRelyingPartiesText.java   (with props)
Modified:
    trunk/idp-profile-api/src/main/java/net/shibboleth/idp/profile/context/MultiRelyingPartyContext.java
    trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/saml2/profile/impl/ProcessLogout.java
    trunk/idp-session-api/src/main/java/net/shibboleth/idp/session/SessionManager.java
    trunk/idp-session-api/src/main/java/net/shibboleth/idp/session/context/LogoutContext.java
    trunk/idp-session-impl/src/main/java/net/shibboleth/idp/session/impl/DetectIdentitySwitch.java
    trunk/idp-session-impl/src/main/java/net/shibboleth/idp/session/impl/ProcessLogout.java
    trunk/idp-session-impl/src/main/java/net/shibboleth/idp/session/impl/StorageBackedSessionManager.java
    trunk/idp-session-impl/src/test/java/net/shibboleth/idp/session/impl/StorageBackedSessionManagerTest.java

Modified: trunk/idp-profile-api/src/main/java/net/shibboleth/idp/profile/context/MultiRelyingPartyContext.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-profile-api/src/main/java/net/shibboleth/idp/profile/context/MultiRelyingPartyContext.java?rev=6490&r1=6489&r2=6490&view=diff
==============================================================================
--- trunk/idp-profile-api/src/main/java/net/shibboleth/idp/profile/context/MultiRelyingPartyContext.java (original)
+++ trunk/idp-profile-api/src/main/java/net/shibboleth/idp/profile/context/MultiRelyingPartyContext.java Mon Sep  1 10:58:32 2014
@@ -18,6 +18,7 @@
 package net.shibboleth.idp.profile.context;
 
 import java.util.Collection;
+import java.util.Iterator;
 import java.util.Map;
 
 import javax.annotation.Nonnull;
@@ -43,6 +44,9 @@
  * 
  * <p>The multiple parties may be accessed as a collection, by their name, or by "labels",
  * which are specific to a given profile/scenario.</p>
+ * 
+ * <p>The context also provides state management for flows to iterate over the relying parties
+ * in the context using an iterator and a "current" pointer.
  */
 public final class MultiRelyingPartyContext extends BaseContext {
 
@@ -51,6 +55,12 @@
     
     /** Multimap of RP contexts indexed by role. */
     @Nonnull @NonnullElements private ListMultimap<String,RelyingPartyContext> relyingPartyLabelMap;
+    
+    /** An iterator to track progress through the set of relying parties. */
+    @Nullable private Iterator<RelyingPartyContext> relyingPartyIterator;
+    
+    /** Tracks the context being operated on. */
+    @Nullable private RelyingPartyContext relyingPartyCtx;
     
     /** Constructor. */
     public MultiRelyingPartyContext() {
@@ -89,6 +99,48 @@
      */
     @Nullable public RelyingPartyContext getRelyingPartyContextById(@Nonnull @NotEmpty final String id) {
         return relyingPartyIdMap.get(Constraint.isNotNull(StringSupport.trimOrNull(id), "ID cannot be null or empty"));
+    }
+    
+    /**
+     * Get an iterator over the relying parties contained in the context.
+     * 
+     * <p>The first time this method is called, or if the parameter is set,
+     * it will return a fresh iterator; subsequent calls will return the same iterator.</p>
+     * 
+     * <p>Modification of the underlying collection while iterating is not supported.</p>
+     * 
+     * @param fresh if true, a new iterator will be created and returned
+     * 
+     * @return an iterator over the relying parties contained in the context
+     */
+    @Nonnull public Iterator<RelyingPartyContext> getRelyingPartyContextIterator(final boolean fresh) {
+        if (fresh || relyingPartyIterator == null) {
+            relyingPartyIterator = new RelyingPartyContextIterator(this);
+        }
+        return relyingPartyIterator;
+    }
+
+    /**
+     * Equivalent to calling {@link #getRelyingPartyContextIterator(boolean)} with a parameter of "false".
+     * 
+     * @return an iterator over the relying parties contained in the context
+     */
+    @Nonnull public Iterator<RelyingPartyContext> getRelyingPartyContextIterator() {
+        return getRelyingPartyContextIterator(false);
+    }
+    
+    /**
+     * Get the {@link RelyingPartyContext} pointed to by an iterator.
+     * 
+     * @return  the current position of the last iterator returned by {@link #getRelyingPartyContextIterator()}.
+     */
+    @Nullable public RelyingPartyContext getCurrentRelyingPartyContext() {
+        
+        if (relyingPartyIterator != null) {

[... 229 lines stripped ...]


More information about the commits mailing list