[java-opensaml COMMIT] in /trunk/opensaml-storage-impl/src: main/java/org/opensaml/storage/impl/client/ClientStorageS...
noreply at shibboleth.net
noreply at shibboleth.net
Fri Aug 21 20:35:17 EDT 2015
Author: scantor
Date: Fri Aug 21 20:35:17 2015
New Revision: 4326
URL: http://svn.shibboleth.net/view/java-opensaml?rev=4326&view=rev
Log:
IDP-594 - Checkpoint client storage save context/action, bug fixes to storage service
Added:
trunk/opensaml-storage-impl/src/main/java/org/opensaml/storage/impl/client/ClientStorageSaveContext.java (with props)
trunk/opensaml-storage-impl/src/main/java/org/opensaml/storage/impl/client/PopulateClientStorageSaveContext.java (with props)
trunk/opensaml-storage-impl/src/test/java/org/opensaml/storage/impl/client/PopulateClientStorageSaveContextTest.java (with props)
Modified:
trunk/opensaml-storage-impl/src/main/java/org/opensaml/storage/impl/client/ClientStorageService.java
trunk/opensaml-storage-impl/src/main/java/org/opensaml/storage/impl/client/ClientStorageServiceStore.java
trunk/opensaml-storage-impl/src/main/java/org/opensaml/storage/impl/client/LoadClientStorageServices.java
trunk/opensaml-storage-impl/src/main/java/org/opensaml/storage/impl/client/PopulateClientStorageLoadContext.java
trunk/opensaml-storage-impl/src/test/java/org/opensaml/storage/impl/client/LoadClientStorageServicesTest.java
trunk/opensaml-storage-impl/src/test/java/org/opensaml/storage/impl/client/PopulateClientStorageLoadContextTest.java
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=4326&r1=4325&r2=4326&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 Fri Aug 21 20:35:17 2015
@@ -338,7 +338,7 @@
*
* @return if dirty, the serialized data (or null if no data exists), if not dirty, an absent value
*/
- @Nonnull Optional<String> save() {
+ @Nonnull Optional<Pair<ClientStorageSource, String>> save() {
log.trace("{} Preserving storage state from session", getLogPrefix());
@@ -364,16 +364,25 @@
log.trace("{} Saving updated storage data to a string", getLogPrefix());
try {
final Pair<String,Long> toEncrypt = storageObject.save();
+ if (toEncrypt.getFirst() == null) {
+ log.trace("{} Data is empty", getLogPrefix());
+ storageObject.setDirty(false);
+ return Optional.<Pair<ClientStorageSource,String>>of(
+ new Pair((ClientStorageSource) session.getAttribute(SOURCE_ATTRIBUTE + '.' + storageName),
+ null));
+ }
+
log.trace("{} Size of data before encryption is {}", getLogPrefix(), toEncrypt.getFirst().length());
log.trace("{} Data before encryption is {}", getLogPrefix(), toEncrypt.getFirst());
-
try {
final String wrapped = dataSealer.wrap(toEncrypt.getFirst(),
toEncrypt.getSecond() > 0 ? toEncrypt.getSecond()
: System.currentTimeMillis() + 24 * 60 * 60 * 1000);
log.trace("{} Size of data after encryption is {}", getLogPrefix(), wrapped.length());
storageObject.setDirty(false);
- return Optional.of(wrapped);
+ return Optional.<Pair<ClientStorageSource,String>>of(
+ new Pair((ClientStorageSource) session.getAttribute(SOURCE_ATTRIBUTE + '.' + storageName),
+ wrapped));
} catch (final DataSealerException e) {
throw new IOException(e);
}
Modified: trunk/opensaml-storage-impl/src/main/java/org/opensaml/storage/impl/client/ClientStorageServiceStore.java
URL: http://svn.shibboleth.net/view/java-opensaml/trunk/opensaml-storage-impl/src/main/java/org/opensaml/storage/impl/client/ClientStorageServiceStore.java?rev=4326&r1=4325&r2=4326&view=diff
==============================================================================
--- trunk/opensaml-storage-impl/src/main/java/org/opensaml/storage/impl/client/ClientStorageServiceStore.java (original)
+++ trunk/opensaml-storage-impl/src/main/java/org/opensaml/storage/impl/client/ClientStorageServiceStore.java Fri Aug 21 20:35:17 2015
@@ -54,7 +54,6 @@
/** Constructor. */
public ClientStorageServiceStore() {
contextMap = new HashMap<>();
- dirty = true;
}
/**
Modified: trunk/opensaml-storage-impl/src/main/java/org/opensaml/storage/impl/client/LoadClientStorageServices.java
[... 133 lines stripped ...]
More information about the commits
mailing list