[java-opensaml COMMIT] in /trunk: opensaml-storage-api/src/main/java/org/opensaml/storage/RequestScopedStorageService...

noreply at shibboleth.net noreply at shibboleth.net
Mon Oct 28 22:17:09 EDT 2013


Author: scantor
Date: Mon Oct 28 22:17:09 2013
New Revision: 3489

URL: http://svn.shibboleth.net/view/java-opensaml?rev=3489&view=rev
Log:
Internalize cookie handling within storage plugin, simplify load/save API.

Modified:
    trunk/opensaml-storage-api/src/main/java/org/opensaml/storage/RequestScopedStorageService.java
    trunk/opensaml-storage-impl/src/main/java/org/opensaml/storage/impl/JSONRequestScopedStorageService.java
    trunk/opensaml-storage-impl/src/test/java/org/opensaml/storage/impl/JSONRequestScopedStorageServiceTest.java

Modified: trunk/opensaml-storage-api/src/main/java/org/opensaml/storage/RequestScopedStorageService.java
URL: http://svn.shibboleth.net/view/java-opensaml/trunk/opensaml-storage-api/src/main/java/org/opensaml/storage/RequestScopedStorageService.java?rev=3489&r1=3488&r2=3489&view=diff
==============================================================================
--- trunk/opensaml-storage-api/src/main/java/org/opensaml/storage/RequestScopedStorageService.java (original)
+++ trunk/opensaml-storage-api/src/main/java/org/opensaml/storage/RequestScopedStorageService.java Mon Oct 28 22:17:09 2013
@@ -36,27 +36,16 @@
 public interface RequestScopedStorageService extends StorageService {
 
     /**
-     * Reconstitute stored data from source.
-     * 
-     * @param source the data to load, if any
+     * Reconstitute stored data.
      * 
      * @throws IOException  if an error occurs reconstituting the data
      */
-    public void load(@Nullable final String source) throws IOException;
+    public void load() throws IOException;
     
     /**
-     * Writes stored data to a string.
-     * 
-     * @return  the serialized data, or null if no data exists
+     * Write/preserve stored data for subsequent requests.
      * 
      * @throws IOException  if an error occurs preserving the data
      */
-    @Nullable public String save() throws IOException;
-    
-    /**
-     * Gets the dirty indicator, if the underlying data has been modified since the last load.
-     * 
-     * @return  true iff the data has been modified since the last load
-     */
-    public boolean isDirty();
+    @Nullable public void save() throws IOException;
 }

Modified: trunk/opensaml-storage-impl/src/main/java/org/opensaml/storage/impl/JSONRequestScopedStorageService.java
URL: http://svn.shibboleth.net/view/java-opensaml/trunk/opensaml-storage-impl/src/main/java/org/opensaml/storage/impl/JSONRequestScopedStorageService.java?rev=3489&r1=3488&r2=3489&view=diff
==============================================================================
--- trunk/opensaml-storage-impl/src/main/java/org/opensaml/storage/impl/JSONRequestScopedStorageService.java (original)
+++ trunk/opensaml-storage-impl/src/main/java/org/opensaml/storage/impl/JSONRequestScopedStorageService.java Mon Oct 28 22:17:09 2013
@@ -20,6 +20,7 @@
 import java.io.IOException;
 import java.io.StringReader;
 import java.io.StringWriter;
+import java.util.Arrays;
 import java.util.Map;
 import java.util.TimerTask;
 import java.util.concurrent.TimeUnit;
@@ -36,7 +37,9 @@
 import javax.json.JsonStructure;
 import javax.json.JsonValue;
 import javax.json.stream.JsonGenerator;
-import javax.servlet.ServletRequest;
+import javax.servlet.http.Cookie;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
 
 import net.shibboleth.utilities.java.support.annotation.constraint.Live;
 import net.shibboleth.utilities.java.support.annotation.constraint.NonnullAfterInit;
@@ -46,6 +49,9 @@
 import net.shibboleth.utilities.java.support.component.ComponentInitializationException;
 import net.shibboleth.utilities.java.support.component.ComponentSupport;
 import net.shibboleth.utilities.java.support.logic.Constraint;
+import net.shibboleth.utilities.java.support.net.CookieManager;
+import net.shibboleth.utilities.java.support.net.UriSupport;
+import net.shibboleth.utilities.java.support.primitive.StringSupport;
 import net.shibboleth.utilities.java.support.security.DataSealer;
 import net.shibboleth.utilities.java.support.security.DataSealerException;
 
@@ -56,6 +62,9 @@
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import com.google.common.base.Optional;
+import com.google.common.base.Predicate;
+import com.google.common.collect.Iterables;
 import com.google.common.collect.Maps;
 
 
@@ -73,6 +82,9 @@
     /** Name of request attribute used as a dirty bit. */
     @Nonnull private static final String DIRTY_BIT_ATTRIBUTE =
             "org.opensaml.storage.impl.JSONRequestScopedStorageService.dirty";
+
+    /** Default cookie name for storage tracking. */
+    @Nonnull @NotEmpty private static final String DEFAULT_COOKIE_NAME = "shib_idp_json_ss";
     
     /** A dummy lock implementation. */
     @Nonnull private static final ReadWriteLock DUMMY_LOCK;
@@ -81,11 +93,27 @@
     @Nonnull private final Logger log = LoggerFactory.getLogger(JSONRequestScopedStorageService.class);
 
     /** Servlet request. */
-    @NonnullAfterInit private ServletRequest servletRequest;

[... 318 lines stripped ...]


More information about the commits mailing list