[java-opensaml COMMIT] in /trunk: opensaml-saml-api/src/main/java/org/opensaml/saml/common/binding/SAMLBindingSupport...
noreply at shibboleth.net
noreply at shibboleth.net
Wed Feb 6 19:16:47 EST 2013
Author: putmanb
Date: Wed Feb 6 19:16:47 2013
New Revision: 3210
URL: http://svn.shibboleth.net/view/java-opensaml?rev=3210&view=rev
Log:
Some refactoring of the SAML received message endpoint check support.
Modified:
trunk/opensaml-saml-api/src/main/java/org/opensaml/saml/common/binding/SAMLBindingSupport.java
trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml/common/binding/security/ReceivedEndpointSecurityHandler.java
Modified: trunk/opensaml-saml-api/src/main/java/org/opensaml/saml/common/binding/SAMLBindingSupport.java
URL: http://svn.shibboleth.net/view/java-opensaml/trunk/opensaml-saml-api/src/main/java/org/opensaml/saml/common/binding/SAMLBindingSupport.java?rev=3210&r1=3209&r2=3210&view=diff
==============================================================================
--- trunk/opensaml-saml-api/src/main/java/org/opensaml/saml/common/binding/SAMLBindingSupport.java (original)
+++ trunk/opensaml-saml-api/src/main/java/org/opensaml/saml/common/binding/SAMLBindingSupport.java Wed Feb 6 19:16:47 2013
@@ -23,7 +23,6 @@
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
-import net.shibboleth.utilities.java.support.annotation.constraint.NotEmpty;
import net.shibboleth.utilities.java.support.logic.Constraint;
import net.shibboleth.utilities.java.support.primitive.StringSupport;
@@ -38,9 +37,6 @@
import org.opensaml.saml.common.messaging.context.SamlProtocolContext;
import org.opensaml.saml.saml2.core.StatusResponseType;
import org.opensaml.saml.saml2.metadata.Endpoint;
-import org.opensaml.util.net.BasicUrlComparator;
-import org.opensaml.util.net.UriComparator;
-import org.opensaml.util.net.UriException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -165,8 +161,8 @@
public static boolean isMessageSigned(@Nonnull final MessageContext<SAMLObject> messageContext) {
SAMLObject samlMessage = Constraint.isNotNull(messageContext.getMessage(),
"SAML message was not present in message context");
- if (samlMessage instanceof SignableSAMLObject) {
- return ((SignableSAMLObject)samlMessage).isSigned();
+ if (samlMessage instanceof SignableSAMLObject && ((SignableSAMLObject)samlMessage).isSigned()) {
+ return true;
} else {
SamlBindingContext bindingContext = messageContext.getSubcontext(SamlBindingContext.class, false);
if (bindingContext != null) {
@@ -227,7 +223,7 @@
// don't treat as an error, just return null
return null;
} else {
- LOG.error("Invalid SAML message type encountered: {}", samlMessage.getElementQName().toString());
+ LOG.error("Unknown SAML message type encountered: {}", samlMessage.getElementQName().toString());
throw new MessageException("Invalid SAML message type encountered");
}
return messageDestination;
@@ -252,102 +248,4 @@
return requestContext.getHttpServletRequest().getRequestURL().toString();
}
- /**
- * Compare the message endpoint URI's specified.
- *
- * <p>The comparison is performed using {@link BasicUrlComparator}.</p>
- *
- * <p>Subclasses should override if binding-specific behavior is required.
- * In this case, see also {@link #getActualReceiverEndpointUri(SAMLMessageContext)}.</p>
- *
- * @param messageDestination the intended message destination endpoint URI
- * @param receiverEndpoint the endpoint URI at which the message was received
- *
- * @return true if the endpoints are equivalent, false otherwise
- *
- * @throws UriException if one of the URI's to evaluate is invalid
- */
- public static boolean compareEndpointUris(@Nonnull @NotEmpty final String messageDestination,
- @Nonnull @NotEmpty final String receiverEndpoint) throws UriException {
- return compareEndpointUris(messageDestination, receiverEndpoint, new BasicUrlComparator());
- }
-
- /**
- * Compare the message endpoint URI's specified.
- *
- * <p>The comparison is performed using the specified instance of {@link UriComparator}.</p>
- *
- * @param messageDestination the intended message destination endpoint URI
- * @param receiverEndpoint the endpoint URI at which the message was received
- * @param comparator the comparator instance to use
- *
- * @return true if the endpoints are equivalent, false otherwise
- *
- * @throws UriException if one of the URI's to evaluate is invalid
- */
- public static boolean compareEndpointUris(@Nonnull @NotEmpty final String messageDestination,
- @Nonnull @NotEmpty final String receiverEndpoint,
- @Nonnull final UriComparator comparator) throws UriException {
- Constraint.isNotNull(messageDestination, "Message destination URI was null");
- Constraint.isNotNull(receiverEndpoint, "Receiver endpoint URI was null");
- Constraint.isNotNull(comparator, "UriComparator was null");
[... 193 lines stripped ...]
More information about the commits
mailing list