[java-opensaml COMMIT] in /trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml: saml1/profile/impl/AddResponseSh...
noreply at shibboleth.net
noreply at shibboleth.net
Thu Apr 10 13:04:49 EDT 2014
Author: scantor
Date: Thu Apr 10 13:04:49 2014
New Revision: 3777
URL: http://svn.shibboleth.net/view/java-opensaml?rev=3777&view=rev
Log:
Allow response shell creation to overwrite existing msg
Modified:
trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/profile/impl/AddResponseShell.java
trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/profile/impl/AddResponseShell.java
Modified: trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/profile/impl/AddResponseShell.java
URL: http://svn.shibboleth.net/view/java-opensaml/trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/profile/impl/AddResponseShell.java?rev=3777&r1=3776&r2=3777&view=diff
==============================================================================
--- trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/profile/impl/AddResponseShell.java (original)
+++ trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/profile/impl/AddResponseShell.java Thu Apr 10 13:04:49 2014
@@ -70,8 +70,22 @@
/** Strategy used to locate the {@link IdentifierGenerationStrategy} to use. */
@NonnullAfterInit private Function<ProfileRequestContext, IdentifierGenerationStrategy> idGeneratorLookupStrategy;
+ /** Overwrite an existing message? */
+ private boolean overwriteExisting;
+
/** The generator to use. */
@Nullable private IdentifierGenerationStrategy idGenerator;
+
+ /**
+ * Set whether to overwrite an existing message.
+ *
+ * @param flag flag to set
+ */
+ public synchronized void setOverwriteExisting(final boolean flag) {
+ ComponentSupport.ifInitializedThrowUnmodifiabledComponentException(this);
+
+ overwriteExisting = flag;
+ }
/**
* Set the strategy used to locate the {@link IdentifierGenerationStrategy} to use.
@@ -105,18 +119,20 @@
log.debug("{} No outbound message context", getLogPrefix());
ActionSupport.buildEvent(profileRequestContext, EventIds.INVALID_MSG_CTX);
return false;
- } else if (outboundMessageCtx.getMessage() != null) {
+ } else if (!overwriteExisting && outboundMessageCtx.getMessage() != null) {
log.debug("{} Outbound message context already contains a Response", getLogPrefix());
ActionSupport.buildEvent(profileRequestContext, EventIds.INVALID_MSG_CTX);
return false;
}
-
+
idGenerator = idGeneratorLookupStrategy.apply(profileRequestContext);
if (idGenerator == null) {
log.debug("{} No identifier generation strategy", getLogPrefix());
ActionSupport.buildEvent(profileRequestContext, EventIds.INVALID_PROFILE_CTX);
return false;
}
+
+ outboundMessageCtx.setMessage(null);
return super.doPreExecute(profileRequestContext);
}
@@ -153,7 +169,7 @@
messageMetadata.setMessageId(response.getID());
messageMetadata.setMessageIssueInstant(response.getIssueInstant().getMillis());
- profileRequestContext.getOutboundMessageContext().addSubcontext(messageMetadata);
+ profileRequestContext.getOutboundMessageContext().addSubcontext(messageMetadata, true);
}
}
Modified: trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/profile/impl/AddResponseShell.java
URL: http://svn.shibboleth.net/view/java-opensaml/trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/profile/impl/AddResponseShell.java?rev=3777&r1=3776&r2=3777&view=diff
==============================================================================
--- trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/profile/impl/AddResponseShell.java (original)
+++ trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/profile/impl/AddResponseShell.java Thu Apr 10 13:04:49 2014
@@ -73,6 +73,9 @@
/** Class logger. */
@Nonnull private Logger log = LoggerFactory.getLogger(AddResponseShell.class);
+ /** Overwrite an existing message? */
+ private boolean overwriteExisting;
+
/** Strategy used to locate the {@link IdentifierGenerationStrategy} to use. */
@NonnullAfterInit private Function<ProfileRequestContext,IdentifierGenerationStrategy> idGeneratorLookupStrategy;
@@ -84,6 +87,17 @@
/** EntityID to populate into Issuer element. */
@Nullable private String issuerId;
+
+ /**
+ * Set whether to overwrite an existing message.
+ *
+ * @param flag flag to set
+ */
+ public synchronized void setOverwriteExisting(final boolean flag) {
+ ComponentSupport.ifInitializedThrowUnmodifiabledComponentException(this);
+
+ overwriteExisting = flag;
+ }
/**
* Set the strategy used to locate the {@link IdentifierGenerationStrategy} to use.
@@ -129,7 +143,7 @@
log.debug("{} No Outbound message context", getLogPrefix());
ActionSupport.buildEvent(profileRequestContext, EventIds.INVALID_MSG_CTX);
return false;
[... 24 lines stripped ...]
More information about the commits
mailing list