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

noreply at shibboleth.net noreply at shibboleth.net
Wed Aug 26 15:57:08 EDT 2015


Author: scantor
Date: Wed Aug 26 15:57:08 2015
New Revision: 4333

URL: http://svn.shibboleth.net/view/java-opensaml?rev=4333&view=rev
Log:
IDP-594 - Add sizing information to cookie and storage plugins and deprecate old interface.

Modified:
    trunk/opensaml-storage-api/src/main/java/org/opensaml/storage/RequestScopedStorageService.java
    trunk/opensaml-storage-impl/src/main/java/org/opensaml/storage/impl/ServletRequestScopedStorageService.java
    trunk/opensaml-storage-impl/src/main/java/org/opensaml/storage/impl/client/ClientStorageService.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=4333&r1=4332&r2=4333&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	Wed Aug 26 15:57:08 2015
@@ -30,6 +30,7 @@
  * state.</p> 
  */
 @ThreadSafe
+ at Deprecated
 public interface RequestScopedStorageService extends StorageService {
 
 }

Modified: trunk/opensaml-storage-impl/src/main/java/org/opensaml/storage/impl/ServletRequestScopedStorageService.java
URL: http://svn.shibboleth.net/view/java-opensaml/trunk/opensaml-storage-impl/src/main/java/org/opensaml/storage/impl/ServletRequestScopedStorageService.java?rev=4333&r1=4332&r2=4333&view=diff
==============================================================================
--- trunk/opensaml-storage-impl/src/main/java/org/opensaml/storage/impl/ServletRequestScopedStorageService.java	(original)
+++ trunk/opensaml-storage-impl/src/main/java/org/opensaml/storage/impl/ServletRequestScopedStorageService.java	Wed Aug 26 15:57:08 2015
@@ -102,6 +102,9 @@
     /** Class logger. */
     @Nonnull private final Logger log = LoggerFactory.getLogger(ServletRequestScopedStorageService.class);
 
+    /** Size to report for context, key, and value limits. */
+    private int capabilitySize;
+    
     /** Servlet request. */
     @NonnullAfterInit private HttpServletRequest httpServletRequest;
 
@@ -123,6 +126,7 @@
     /** Constructor. */
     public ServletRequestScopedStorageService() {
         cookieName = DEFAULT_COOKIE_NAME;
+        capabilitySize = 4096;
     }
 
     /** {@inheritDoc} */
@@ -130,6 +134,20 @@
     public synchronized void setCleanupInterval(final long interval) {
         // Don't allow a cleanup task.
         super.setCleanupInterval(0);
+    }
+    
+    /**
+     * Set the size to report via the {@link org.opensaml.storage.StorageCapabilities} interface for
+     * context, key, and value maximums.
+     * 
+     * <p>Defaults to 4096 to reflect the limitations of cookies on Safari.</p>
+     * 
+     * @param size size in characters to report
+     */
+    public void setCapabilitySize(final int size) {
+        ComponentSupport.ifInitializedThrowUnmodifiabledComponentException(this);
+        
+        capabilitySize = size;
     }
     
     /**
@@ -217,6 +235,10 @@
         } else if (dataSealer == null || cookieManager == null) {
             throw new ComponentInitializationException("DataSealer and CookieManager must be set");
         }
+        
+        setContextSize(capabilitySize);
+        setKeySize(capabilitySize);
+        setValueSize(capabilitySize);
     }
 
     /** {@inheritDoc} */

Modified: trunk/opensaml-storage-impl/src/main/java/org/opensaml/storage/impl/client/ClientStorageService.java
URL: http://svn.shibboleth.net/view/java-opensaml/trunk/opensaml-storage-impl/src/main/java/org/opensaml/storage/impl/client/ClientStorageService.java?rev=4333&r1=4332&r2=4333&view=diff
==============================================================================
--- trunk/opensaml-storage-impl/src/main/java/org/opensaml/storage/impl/client/ClientStorageService.java	(original)
+++ trunk/opensaml-storage-impl/src/main/java/org/opensaml/storage/impl/client/ClientStorageService.java	Wed Aug 26 15:57:08 2015
@@ -98,6 +98,9 @@
     /** Class logger. */
     @Nonnull private final Logger log = LoggerFactory.getLogger(ClientStorageService.class);
 
+    /** Sizes to report for context, key, and value limits when particular sources are used. */
+    @Nonnull @NotEmpty private Map<ClientStorageSource,Integer> capabilityMap; 
+
     /** Servlet request. */
     @NonnullAfterInit private HttpServletRequest httpServletRequest;
     
@@ -116,6 +119,9 @@
     /** Constructor. */
     public ClientStorageService() {
         storageName = DEFAULT_STORAGE_NAME;
+        capabilityMap = new HashMap<>(2);
+        capabilityMap.put(ClientStorageSource.COOKIE, 4096);
+        capabilityMap.put(ClientStorageSource.HTML_LOCAL_STORAGE, 1024 * 1024);
     }
 
     /** {@inheritDoc} */
@@ -123,6 +129,25 @@
     public synchronized void setCleanupInterval(final long interval) {
         // Don't allow a cleanup task.

[... 81 lines stripped ...]


More information about the commits mailing list