[java-opensaml COMMIT] in /trunk: opensaml-saml-api/src/main/java/org/opensaml/saml/common/messaging/SAMLMessageSecur...
noreply at shibboleth.net
noreply at shibboleth.net
Tue Feb 4 16:17:06 EST 2014
Author: tzeller
Date: Tue Feb 4 16:17:05 2014
New Revision: 3594
URL: http://svn.shibboleth.net/view/java-opensaml?rev=3594&view=rev
Log:
Sign SignableXMLObject instead of SignableSAMLObject and move to SignatureSupport.
Modified:
trunk/opensaml-saml-api/src/main/java/org/opensaml/saml/common/messaging/SAMLMessageSecuritySupport.java
trunk/opensaml-xmlsec-api/src/main/java/org/opensaml/xmlsec/signature/support/SignatureSupport.java
Modified: trunk/opensaml-saml-api/src/main/java/org/opensaml/saml/common/messaging/SAMLMessageSecuritySupport.java
URL: http://svn.shibboleth.net/view/java-opensaml/trunk/opensaml-saml-api/src/main/java/org/opensaml/saml/common/messaging/SAMLMessageSecuritySupport.java?rev=3594&r1=3593&r2=3594&view=diff
==============================================================================
--- trunk/opensaml-saml-api/src/main/java/org/opensaml/saml/common/messaging/SAMLMessageSecuritySupport.java (original)
+++ trunk/opensaml-saml-api/src/main/java/org/opensaml/saml/common/messaging/SAMLMessageSecuritySupport.java Tue Feb 4 16:17:05 2014
@@ -23,21 +23,16 @@
import net.shibboleth.utilities.java.support.annotation.constraint.NotEmpty;
import net.shibboleth.utilities.java.support.logic.Constraint;
-import org.opensaml.core.xml.XMLObjectBuilder;
-import org.opensaml.core.xml.config.XMLObjectProviderRegistrySupport;
-import org.opensaml.core.xml.io.Marshaller;
import org.opensaml.core.xml.io.MarshallingException;
import org.opensaml.messaging.context.MessageContext;
import org.opensaml.saml.common.SAMLObject;
-import org.opensaml.saml.common.SignableSAMLObject;
import org.opensaml.saml.config.SAMLConfigurationSupport;
import org.opensaml.security.SecurityException;
import org.opensaml.xmlsec.SignatureSigningParameters;
import org.opensaml.xmlsec.messaging.SecurityParametersContext;
-import org.opensaml.xmlsec.signature.Signature;
+import org.opensaml.xmlsec.signature.SignableXMLObject;
import org.opensaml.xmlsec.signature.support.SignatureException;
import org.opensaml.xmlsec.signature.support.SignatureSupport;
-import org.opensaml.xmlsec.signature.support.Signer;
/** A support class for SAML security-related message handler operations. */
public final class SAMLMessageSecuritySupport {
@@ -48,7 +43,7 @@
}
/**
- * Signs the SAML message represented in the message context if it a {@link SignableSAMLObject}
+ * Signs the SAML message represented in the message context if it is a {@link SignableXMLObject}
* and the message context contains signing parameters as determined
* by {@link #getContextSigningParameters(MessageContext)}.
*
@@ -66,40 +61,9 @@
final SAMLObject outboundSAML = messageContext.getMessage();
final SignatureSigningParameters parameters = getContextSigningParameters(messageContext);
- if (outboundSAML instanceof SignableSAMLObject && parameters != null) {
- SAMLMessageSecuritySupport.signObject((SignableSAMLObject) outboundSAML, parameters);
+ if (outboundSAML instanceof SignableXMLObject && parameters != null) {
+ SignatureSupport.signObject((SignableXMLObject) outboundSAML, parameters);
}
- }
-
- /**
- * Signs a {@link SignableSAMLObject}.
- *
- * @param signable the signable SAMLObject to sign
- * @param parameters the signing parameters to use
- *
- * @throws SecurityException if there is a problem preparing the signature
- * @throws MarshallingException if there is a problem marshalling the SAMLObject
- * @throws SignatureException if there is a problem with the signature operation
- */
- public static void signObject(@Nonnull final SignableSAMLObject signable,
- @Nonnull final SignatureSigningParameters parameters) throws SecurityException, MarshallingException,
- SignatureException {
- Constraint.isNotNull(signable, "Signable SAMLObject cannot be null");
- Constraint.isNotNull(parameters, "Signature signing parameters cannot be null");
-
- XMLObjectBuilder<Signature> signatureBuilder =
- (XMLObjectBuilder<Signature>) XMLObjectProviderRegistrySupport.getBuilderFactory().getBuilder(
- Signature.DEFAULT_ELEMENT_NAME);
- Signature signature = signatureBuilder.buildObject(Signature.DEFAULT_ELEMENT_NAME);
-
- signable.setSignature(signature);
-
- SignatureSupport.prepareSignatureParams(signature, parameters);
-
- Marshaller marshaller = XMLObjectProviderRegistrySupport.getMarshallerFactory().getMarshaller(signable);
- marshaller.marshall(signable);
-
- Signer.signObject(signature);
}
/**
Modified: trunk/opensaml-xmlsec-api/src/main/java/org/opensaml/xmlsec/signature/support/SignatureSupport.java
URL: http://svn.shibboleth.net/view/java-opensaml/trunk/opensaml-xmlsec-api/src/main/java/org/opensaml/xmlsec/signature/support/SignatureSupport.java?rev=3594&r1=3593&r2=3594&view=diff
==============================================================================
[... 60 lines stripped ...]
More information about the commits
mailing list