You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ws.apache.org by gi...@apache.org on 2011/10/11 20:03:15 UTC
svn commit: r1181995 [4/26] - in /webservices/wss4j/branches/swssf: ./
cxf-integration/ cxf-integration/src/main/java/org/swssf/cxfIntegration/
cxf-integration/src/main/java/org/swssf/cxfIntegration/interceptor/
cxf-integration/src/main/java/org/swssf/...
Modified: webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/oasis_open/docs/wss/_2004/_01/oasis_200401_wss_wssecurity_secext_1_0/UsernameTokenType.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/oasis_open/docs/wss/_2004/_01/oasis_200401_wss_wssecurity_secext_1_0/UsernameTokenType.java?rev=1181995&r1=1181994&r2=1181995&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/oasis_open/docs/wss/_2004/_01/oasis_200401_wss_wssecurity_secext_1_0/UsernameTokenType.java (original)
+++ webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/oasis_open/docs/wss/_2004/_01/oasis_200401_wss_wssecurity_secext_1_0/UsernameTokenType.java Tue Oct 11 18:03:00 2011
@@ -18,10 +18,11 @@
*/
package org.oasis_open.docs.wss._2004._01.oasis_200401_wss_wssecurity_secext_1_0;
-import org.swssf.ext.Constants;
-import org.swssf.ext.ParseException;
-import org.swssf.ext.Parseable;
-import org.swssf.ext.Utils;
+
+import org.swssf.wss.ext.WSSConstants;
+import org.swssf.wss.ext.WSSUtils;
+import org.swssf.xmlsec.ext.ParseException;
+import org.swssf.xmlsec.ext.Parseable;
import javax.xml.bind.annotation.*;
import javax.xml.bind.annotation.adapters.CollapsedStringAdapter;
@@ -99,7 +100,7 @@ public class UsernameTokenType implement
Iterator<Attribute> attributeIterator = startElement.getAttributes();
while (attributeIterator.hasNext()) {
Attribute attribute = attributeIterator.next();
- if (attribute.getName().equals(Constants.ATT_wsu_Id)) {
+ if (attribute.getName().equals(WSSConstants.ATT_wsu_Id)) {
CollapsedStringAdapter collapsedStringAdapter = new CollapsedStringAdapter();
this.id = collapsedStringAdapter.unmarshal(attribute.getValue());
}
@@ -120,7 +121,7 @@ public class UsernameTokenType implement
switch (xmlEvent.getEventType()) {
case XMLStreamConstants.START_ELEMENT:
StartElement startElement = xmlEvent.asStartElement();
- if (startElement.getName().equals(Constants.TAG_wsse_Username)) {
+ if (startElement.getName().equals(WSSConstants.TAG_wsse_Username)) {
currentParseable = new Parseable() {
public boolean parseXMLEvent(XMLEvent xmlEvent) throws ParseException {
switch (xmlEvent.getEventType()) {
@@ -139,8 +140,8 @@ public class UsernameTokenType implement
public void validate() throws ParseException {
}
};
- } else if (startElement.getName().equals(Constants.TAG_wsse_Password)) {
- Attribute attribute = startElement.getAttributeByName(Constants.ATT_NULL_Type);
+ } else if (startElement.getName().equals(WSSConstants.TAG_wsse_Password)) {
+ Attribute attribute = startElement.getAttributeByName(WSSConstants.ATT_NULL_Type);
if (attribute != null) {
passwordType = attribute.getValue();
}
@@ -162,8 +163,8 @@ public class UsernameTokenType implement
public void validate() throws ParseException {
}
};
- } else if (startElement.getName().equals(Constants.TAG_wsse_Nonce)) {
- Attribute attribute = startElement.getAttributeByName(Constants.ATT_NULL_EncodingType);
+ } else if (startElement.getName().equals(WSSConstants.TAG_wsse_Nonce)) {
+ Attribute attribute = startElement.getAttributeByName(WSSConstants.ATT_NULL_EncodingType);
if (attribute != null) {
nonceEncodingType = attribute.getValue();
}
@@ -185,7 +186,7 @@ public class UsernameTokenType implement
public void validate() throws ParseException {
}
};
- } else if (startElement.getName().equals(Constants.TAG_wsu_Created)) {
+ } else if (startElement.getName().equals(WSSConstants.TAG_wsu_Created)) {
currentParseable = new Parseable() {
public boolean parseXMLEvent(XMLEvent xmlEvent) throws ParseException {
switch (xmlEvent.getEventType()) {
@@ -204,7 +205,7 @@ public class UsernameTokenType implement
public void validate() throws ParseException {
}
};
- } else if (startElement.getName().equals(Constants.TAG_wsse11_Salt)) {
+ } else if (startElement.getName().equals(WSSConstants.TAG_wsse11_Salt)) {
currentParseable = new Parseable() {
public boolean parseXMLEvent(XMLEvent xmlEvent) throws ParseException {
switch (xmlEvent.getEventType()) {
@@ -223,7 +224,7 @@ public class UsernameTokenType implement
public void validate() throws ParseException {
}
};
- } else if (startElement.getName().equals(Constants.TAG_wsse11_Iteration)) {
+ } else if (startElement.getName().equals(WSSConstants.TAG_wsse11_Iteration)) {
currentParseable = new Parseable() {
public boolean parseXMLEvent(XMLEvent xmlEvent) throws ParseException {
switch (xmlEvent.getEventType()) {
@@ -256,7 +257,7 @@ public class UsernameTokenType implement
case XMLStreamConstants.COMMENT:
break;
default:
- throw new ParseException("Unexpected event received " + Utils.getXMLEventAsString(xmlEvent));
+ throw new ParseException("Unexpected event received " + WSSUtils.getXMLEventAsString(xmlEvent));
}
return false;
}
Modified: webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/oasis_open/docs/wss/_2004/_01/oasis_200401_wss_wssecurity_utility_1_0/AttributedDateTime.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/oasis_open/docs/wss/_2004/_01/oasis_200401_wss_wssecurity_utility_1_0/AttributedDateTime.java?rev=1181995&r1=1181994&r2=1181995&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/oasis_open/docs/wss/_2004/_01/oasis_200401_wss_wssecurity_utility_1_0/AttributedDateTime.java (original)
+++ webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/oasis_open/docs/wss/_2004/_01/oasis_200401_wss_wssecurity_utility_1_0/AttributedDateTime.java Tue Oct 11 18:03:00 2011
@@ -18,10 +18,10 @@
*/
package org.oasis_open.docs.wss._2004._01.oasis_200401_wss_wssecurity_utility_1_0;
-import org.swssf.ext.Constants;
-import org.swssf.ext.ParseException;
-import org.swssf.ext.Parseable;
-import org.swssf.ext.Utils;
+import org.swssf.wss.ext.WSSConstants;
+import org.swssf.wss.ext.WSSUtils;
+import org.swssf.xmlsec.ext.ParseException;
+import org.swssf.xmlsec.ext.Parseable;
import javax.xml.bind.annotation.*;
import javax.xml.bind.annotation.adapters.CollapsedStringAdapter;
@@ -80,7 +80,7 @@ public class AttributedDateTime implemen
Iterator<Attribute> attributeIterator = startElement.getAttributes();
while (attributeIterator.hasNext()) {
Attribute attribute = attributeIterator.next();
- if (attribute.getName().equals(Constants.ATT_wsu_Id)) {
+ if (attribute.getName().equals(WSSConstants.ATT_wsu_Id)) {
CollapsedStringAdapter collapsedStringAdapter = new CollapsedStringAdapter();
this.id = collapsedStringAdapter.unmarshal(attribute.getValue());
}
@@ -102,7 +102,7 @@ public class AttributedDateTime implemen
this.value = xmlEvent.asCharacters().getData();
break;
default:
- throw new ParseException("Unexpected event received " + Utils.getXMLEventAsString(xmlEvent));
+ throw new ParseException("Unexpected event received " + WSSUtils.getXMLEventAsString(xmlEvent));
}
return false;
}
Modified: webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/oasis_open/docs/wss/_2004/_01/oasis_200401_wss_wssecurity_utility_1_0/TimestampType.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/oasis_open/docs/wss/_2004/_01/oasis_200401_wss_wssecurity_utility_1_0/TimestampType.java?rev=1181995&r1=1181994&r2=1181995&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/oasis_open/docs/wss/_2004/_01/oasis_200401_wss_wssecurity_utility_1_0/TimestampType.java (original)
+++ webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/oasis_open/docs/wss/_2004/_01/oasis_200401_wss_wssecurity_utility_1_0/TimestampType.java Tue Oct 11 18:03:00 2011
@@ -18,10 +18,10 @@
*/
package org.oasis_open.docs.wss._2004._01.oasis_200401_wss_wssecurity_utility_1_0;
-import org.swssf.ext.Constants;
-import org.swssf.ext.ParseException;
-import org.swssf.ext.Parseable;
-import org.swssf.ext.Utils;
+import org.swssf.wss.ext.WSSConstants;
+import org.swssf.wss.ext.WSSUtils;
+import org.swssf.xmlsec.ext.ParseException;
+import org.swssf.xmlsec.ext.Parseable;
import org.w3c.dom.Element;
import javax.xml.bind.annotation.*;
@@ -91,7 +91,7 @@ public class TimestampType implements Pa
Iterator<Attribute> attributeIterator = startElement.getAttributes();
while (attributeIterator.hasNext()) {
Attribute attribute = attributeIterator.next();
- if (attribute.getName().equals(Constants.ATT_wsu_Id)) {
+ if (attribute.getName().equals(WSSConstants.ATT_wsu_Id)) {
CollapsedStringAdapter collapsedStringAdapter = new CollapsedStringAdapter();
this.id = collapsedStringAdapter.unmarshal(attribute.getValue());
}
@@ -112,9 +112,9 @@ public class TimestampType implements Pa
case XMLStreamConstants.START_ELEMENT:
StartElement startElement = xmlEvent.asStartElement();
- if (startElement.getName().equals(Constants.TAG_wsu_Created)) {
+ if (startElement.getName().equals(WSSConstants.TAG_wsu_Created)) {
currentParseable = this.created = new AttributedDateTime(startElement);
- } else if (startElement.getName().equals(Constants.TAG_wsu_Expires)) {
+ } else if (startElement.getName().equals(WSSConstants.TAG_wsu_Expires)) {
currentParseable = this.expires = new AttributedDateTime(startElement);
} else {
throw new ParseException("Unsupported Element: " + startElement.getName());
@@ -124,12 +124,12 @@ public class TimestampType implements Pa
case XMLStreamConstants.END_ELEMENT:
currentParseable = null;
EndElement endElement = xmlEvent.asEndElement();
- if (endElement.getName().equals(Constants.TAG_wsu_Timestamp)) {
+ if (endElement.getName().equals(WSSConstants.TAG_wsu_Timestamp)) {
return true;
}
break;
default:
- throw new ParseException("Unexpected event received " + Utils.getXMLEventAsString(xmlEvent));
+ throw new ParseException("Unexpected event received " + WSSUtils.getXMLEventAsString(xmlEvent));
}
return false;
}
Modified: webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/oasis_open/docs/wss/oasis_wss_wssecurity_secext_1_1/SignatureConfirmationType.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/oasis_open/docs/wss/oasis_wss_wssecurity_secext_1_1/SignatureConfirmationType.java?rev=1181995&r1=1181994&r2=1181995&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/oasis_open/docs/wss/oasis_wss_wssecurity_secext_1_1/SignatureConfirmationType.java (original)
+++ webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/oasis_open/docs/wss/oasis_wss_wssecurity_secext_1_1/SignatureConfirmationType.java Tue Oct 11 18:03:00 2011
@@ -19,10 +19,10 @@
package org.oasis_open.docs.wss.oasis_wss_wssecurity_secext_1_1;
import org.apache.commons.codec.binary.Base64;
-import org.swssf.ext.Constants;
-import org.swssf.ext.ParseException;
-import org.swssf.ext.Parseable;
-import org.swssf.ext.Utils;
+import org.swssf.wss.ext.WSSConstants;
+import org.swssf.wss.ext.WSSUtils;
+import org.swssf.xmlsec.ext.ParseException;
+import org.swssf.xmlsec.ext.Parseable;
import javax.xml.bind.annotation.*;
import javax.xml.bind.annotation.adapters.CollapsedStringAdapter;
@@ -70,9 +70,9 @@ public class SignatureConfirmationType i
Iterator<Attribute> attributeIterator = startElement.getAttributes();
while (attributeIterator.hasNext()) {
Attribute attribute = attributeIterator.next();
- if (attribute.getName().equals(Constants.ATT_NULL_Value)) {
+ if (attribute.getName().equals(WSSConstants.ATT_NULL_Value)) {
this.value = Base64.decodeBase64(attribute.getValue());
- } else if (attribute.getName().equals(Constants.ATT_wsu_Id)) {
+ } else if (attribute.getName().equals(WSSConstants.ATT_wsu_Id)) {
this.id = attribute.getValue();
}
}
@@ -80,7 +80,7 @@ public class SignatureConfirmationType i
public boolean parseXMLEvent(XMLEvent xmlEvent) throws ParseException {
if (!xmlEvent.isEndElement() && xmlEvent.asEndElement().getName().equals(this.startElement.getName())) {
- throw new ParseException("Unexpected event received " + Utils.getXMLEventAsString(xmlEvent));
+ throw new ParseException("Unexpected event received " + WSSUtils.getXMLEventAsString(xmlEvent));
}
return true;
}
Copied: webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/WSSec.java (from r1179730, webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/WSSec.java)
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/WSSec.java?p2=webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/WSSec.java&p1=webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/WSSec.java&r1=1179730&r2=1181995&rev=1181995&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/WSSec.java (original)
+++ webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/WSSec.java Tue Oct 11 18:03:00 2011
@@ -16,10 +16,13 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.swssf;
+package org.swssf.wss;
-import org.swssf.config.Init;
-import org.swssf.ext.*;
+import org.swssf.wss.ext.*;
+import org.swssf.xmlsec.config.Init;
+import org.swssf.xmlsec.ext.SecurePart;
+import org.swssf.xmlsec.ext.XMLSecurityConstants;
+import org.swssf.xmlsec.ext.XMLSecurityException;
import java.security.Provider;
import java.security.Security;
@@ -56,17 +59,21 @@ public class WSSec {
*
* @param securityProperties The user-defined security configuration
* @return A new OutboundWSSec
- * @throws org.swssf.ext.WSSecurityException
+ * @throws org.swssf.wss.ext.WSSecurityException
* if the initialisation failed
- * @throws org.swssf.ext.WSSConfigurationException
+ * @throws org.swssf.wss.ext.WSSConfigurationException
* if the configuration is invalid
*/
- public static OutboundWSSec getOutboundWSSec(SecurityProperties securityProperties) throws WSSecurityException {
+ public static OutboundWSSec getOutboundWSSec(WSSSecurityProperties securityProperties) throws WSSecurityException {
if (securityProperties == null) {
throw new WSSConfigurationException(WSSecurityException.ErrorCode.FAILURE, "missingSecurityProperties");
}
- Init.init(null);
+ try {
+ Init.init(WSSec.class.getClassLoader().getResource("wss/wss-config.xml"));
+ } catch (XMLSecurityException e) {
+ throw new WSSecurityException(e.getMessage(), e);
+ }
securityProperties = validateAndApplyDefaultsToOutboundSecurityProperties(securityProperties);
return new OutboundWSSec(securityProperties);
@@ -77,17 +84,21 @@ public class WSSec {
*
* @param securityProperties The user-defined security configuration
* @return A new InboundWSSec
- * @throws org.swssf.ext.WSSecurityException
+ * @throws org.swssf.wss.ext.WSSecurityException
* if the initialisation failed
- * @throws org.swssf.ext.WSSConfigurationException
+ * @throws org.swssf.wss.ext.WSSConfigurationException
* if the configuration is invalid
*/
- public static InboundWSSec getInboundWSSec(SecurityProperties securityProperties) throws WSSecurityException {
+ public static InboundWSSec getInboundWSSec(WSSSecurityProperties securityProperties) throws WSSecurityException {
if (securityProperties == null) {
throw new WSSConfigurationException(WSSecurityException.ErrorCode.FAILURE, "missingSecurityProperties");
}
- Init.init(null);
+ try {
+ Init.init(WSSec.class.getClassLoader().getResource("wss/wss-config.xml"));
+ } catch (XMLSecurityException e) {
+ throw new WSSecurityException(e.getMessage(), e);
+ }
securityProperties = validateAndApplyDefaultsToInboundSecurityProperties(securityProperties);
return new InboundWSSec(securityProperties);
@@ -98,234 +109,222 @@ public class WSSec {
*
* @param securityProperties The configuration to validate
* @return The validated configuration
- * @throws org.swssf.ext.WSSConfigurationException
+ * @throws org.swssf.wss.ext.WSSConfigurationException
* if the configuration is invalid
*/
- public static SecurityProperties validateAndApplyDefaultsToOutboundSecurityProperties(SecurityProperties securityProperties) throws WSSConfigurationException {
+ public static WSSSecurityProperties validateAndApplyDefaultsToOutboundSecurityProperties(WSSSecurityProperties securityProperties) throws WSSConfigurationException {
if (securityProperties.getOutAction() == null) {
throw new WSSConfigurationException(WSSecurityException.ErrorCode.FAILURE, "noOutputAction");
}
//todo encrypt sigconf when original signature was encrypted
- int pos = Arrays.binarySearch(securityProperties.getOutAction(), Constants.Action.SIGNATURE_CONFIRMATION);
+ int pos = Arrays.binarySearch(securityProperties.getOutAction(), WSSConstants.SIGNATURE_CONFIRMATION);
if (pos >= 0) {
- if (Arrays.binarySearch(securityProperties.getOutAction(), Constants.Action.SIGNATURE) < 0) {
- List<Constants.Action> actionList = new ArrayList<Constants.Action>(securityProperties.getOutAction().length);
+ if (Arrays.binarySearch(securityProperties.getOutAction(), WSSConstants.SIGNATURE) < 0) {
+ List<XMLSecurityConstants.Action> actionList = new ArrayList<XMLSecurityConstants.Action>(securityProperties.getOutAction().length);
actionList.addAll(Arrays.asList(securityProperties.getOutAction()));
- actionList.add(pos, Constants.Action.SIGNATURE);
- securityProperties.setOutAction(actionList.toArray(new Constants.Action[securityProperties.getOutAction().length + 1]));
+ actionList.add(pos, WSSConstants.SIGNATURE);
+ securityProperties.setOutAction(actionList.toArray(new XMLSecurityConstants.Action[securityProperties.getOutAction().length + 1]));
}
}
for (int i = 0; i < securityProperties.getOutAction().length; i++) {
- Constants.Action action = securityProperties.getOutAction()[i];
- switch (action) {
- case TIMESTAMP:
- if (securityProperties.getTimestampTTL() == null) {
- securityProperties.setTimestampTTL(300);
- }
- break;
- case SIGNATURE:
- if (securityProperties.getSignatureKeyStore() == null) {
- throw new WSSConfigurationException(WSSecurityException.ErrorCode.FAILURE, "signatureKeyStoreNotSet");
- }
- if (securityProperties.getSignatureUser() == null) {
- throw new WSSConfigurationException(WSSecurityException.ErrorCode.FAILURE, "noSignatureUser");
- }
- if (securityProperties.getCallbackHandler() == null) {
- throw new WSSConfigurationException(WSSecurityException.ErrorCode.FAILURE, "noCallback");
- }
- //signature namespace part will be set in SecurityHeaderOutputProcessor
- if (securityProperties.getSignatureSecureParts().isEmpty()) {
- securityProperties.addSignaturePart(new SecurePart("Body", "*", SecurePart.Modifier.Element));
- }
- if (securityProperties.getSignatureAlgorithm() == null) {
- securityProperties.setSignatureAlgorithm("http://www.w3.org/2000/09/xmldsig#rsa-sha1");
- }
- if (securityProperties.getSignatureDigestAlgorithm() == null) {
- securityProperties.setSignatureDigestAlgorithm("http://www.w3.org/2000/09/xmldsig#sha1");
- }
- if (securityProperties.getSignatureCanonicalizationAlgorithm() == null) {
- securityProperties.setSignatureCanonicalizationAlgorithm("http://www.w3.org/2001/10/xml-exc-c14n#");
- }
- if (securityProperties.getSignatureKeyIdentifierType() == null) {
- securityProperties.setSignatureKeyIdentifierType(Constants.KeyIdentifierType.ISSUER_SERIAL);
- }
- break;
-
- case ENCRYPT:
- if (securityProperties.getEncryptionUseThisCertificate() == null
- && securityProperties.getEncryptionKeyStore() == null
- && !securityProperties.isUseReqSigCertForEncryption()) {
- throw new WSSConfigurationException(WSSecurityException.ErrorCode.FAILURE, "encryptionKeyStoreNotSet");
- }
- if (securityProperties.getEncryptionUser() == null
- && securityProperties.getEncryptionUseThisCertificate() == null
- && !securityProperties.isUseReqSigCertForEncryption()) {
- throw new WSSConfigurationException(WSSecurityException.ErrorCode.FAILURE, "noEncryptionUser");
- }
- //encryption namespace part will be set in SecurityHeaderOutputProcessor
- if (securityProperties.getEncryptionSecureParts().isEmpty()) {
- securityProperties.addEncryptionPart(new SecurePart("Body", "*", SecurePart.Modifier.Content));
- }
- if (securityProperties.getEncryptionSymAlgorithm() == null) {
- securityProperties.setEncryptionSymAlgorithm("http://www.w3.org/2001/04/xmlenc#aes256-cbc");
- }
- if (securityProperties.getEncryptionKeyTransportAlgorithm() == null) {
- //@see http://www.w3.org/TR/2002/REC-xmlenc-core-20021210/Overview.html#rsa-1_5 :
- //"RSA-OAEP is RECOMMENDED for the transport of AES keys"
- //@see http://www.w3.org/TR/2002/REC-xmlenc-core-20021210/Overview.html#rsa-oaep-mgf1p
- securityProperties.setEncryptionKeyTransportAlgorithm("http://www.w3.org/2001/04/xmlenc#rsa-oaep-mgf1p");
- }
- if (securityProperties.getEncryptionKeyIdentifierType() == null) {
- securityProperties.setEncryptionKeyIdentifierType(Constants.KeyIdentifierType.ISSUER_SERIAL);
- }
- break;
- case USERNAMETOKEN:
- if (securityProperties.getTokenUser() == null) {
- throw new WSSConfigurationException(WSSecurityException.ErrorCode.FAILURE, "noTokenUser");
- }
- if (securityProperties.getCallbackHandler() == null) {
- throw new WSSConfigurationException(WSSecurityException.ErrorCode.FAILURE, "noCallback");
- }
- if (securityProperties.getUsernameTokenPasswordType() == null) {
- securityProperties.setUsernameTokenPasswordType(Constants.UsernameTokenPasswordType.PASSWORD_DIGEST);
- }
- break;
- case USERNAMETOKEN_SIGNED:
- if (securityProperties.getTokenUser() == null) {
- throw new WSSConfigurationException(WSSecurityException.ErrorCode.FAILURE, "noTokenUser");
- }
- if (securityProperties.getCallbackHandler() == null) {
- throw new WSSConfigurationException(WSSecurityException.ErrorCode.FAILURE, "noCallback");
- }
- //signature namespace part will be set in SecurityHeaderOutputProcessor
- if (securityProperties.getSignatureSecureParts().isEmpty()) {
- securityProperties.addSignaturePart(new SecurePart("Body", "*", SecurePart.Modifier.Element));
- }
- if (securityProperties.getSignatureAlgorithm() == null) {
- securityProperties.setSignatureAlgorithm("http://www.w3.org/2000/09/xmldsig#hmac-sha1");
- }
- if (securityProperties.getSignatureDigestAlgorithm() == null) {
- securityProperties.setSignatureDigestAlgorithm("http://www.w3.org/2000/09/xmldsig#sha1");
- }
- if (securityProperties.getSignatureCanonicalizationAlgorithm() == null) {
- securityProperties.setSignatureCanonicalizationAlgorithm("http://www.w3.org/2001/10/xml-exc-c14n#");
- }
- securityProperties.setSignatureKeyIdentifierType(Constants.KeyIdentifierType.USERNAMETOKEN_REFERENCE);
- if (securityProperties.getUsernameTokenPasswordType() == null) {
- securityProperties.setUsernameTokenPasswordType(Constants.UsernameTokenPasswordType.PASSWORD_DIGEST);
- }
- break;
- case SIGNATURE_CONFIRMATION:
- securityProperties.addSignaturePart(new SecurePart(Constants.TAG_wsse11_SignatureConfirmation.getLocalPart(), Constants.TAG_wsse11_SignatureConfirmation.getNamespaceURI(), SecurePart.Modifier.Element));
- break;
- case SIGNATURE_WITH_DERIVED_KEY:
- if (securityProperties.getCallbackHandler() == null) {
- throw new WSSConfigurationException(WSSecurityException.ErrorCode.FAILURE, "noCallback");
- }
- //signature namespace part will be set in SecurityHeaderOutputProcessor
- if (securityProperties.getSignatureSecureParts().isEmpty()) {
- securityProperties.addSignaturePart(new SecurePart("Body", "*", SecurePart.Modifier.Element));
- }
- if (securityProperties.getSignatureAlgorithm() == null) {
- securityProperties.setSignatureAlgorithm("http://www.w3.org/2000/09/xmldsig#hmac-sha1");
- }
- if (securityProperties.getSignatureDigestAlgorithm() == null) {
- securityProperties.setSignatureDigestAlgorithm("http://www.w3.org/2000/09/xmldsig#sha1");
- }
- if (securityProperties.getSignatureCanonicalizationAlgorithm() == null) {
- securityProperties.setSignatureCanonicalizationAlgorithm("http://www.w3.org/2001/10/xml-exc-c14n#");
- }
- securityProperties.setSignatureKeyIdentifierType(Constants.KeyIdentifierType.EMBEDDED_SECURITY_TOKEN_REF);
- if (securityProperties.getEncryptionSymAlgorithm() == null) {
- securityProperties.setEncryptionSymAlgorithm("http://www.w3.org/2001/04/xmlenc#aes256-cbc");
- }
- if (securityProperties.getEncryptionKeyTransportAlgorithm() == null) {
- //@see http://www.w3.org/TR/2002/REC-xmlenc-core-20021210/Overview.html#rsa-1_5 :
- //"RSA-OAEP is RECOMMENDED for the transport of AES keys"
- //@see http://www.w3.org/TR/2002/REC-xmlenc-core-20021210/Overview.html#rsa-oaep-mgf1p
- securityProperties.setEncryptionKeyTransportAlgorithm("http://www.w3.org/2001/04/xmlenc#rsa-oaep-mgf1p");
- }
- if (securityProperties.getEncryptionKeyIdentifierType() == null) {
- securityProperties.setEncryptionKeyIdentifierType(Constants.KeyIdentifierType.X509_KEY_IDENTIFIER);
- }
- if (securityProperties.getDerivedKeyKeyIdentifierType() == null) {
- securityProperties.setDerivedKeyKeyIdentifierType(Constants.KeyIdentifierType.X509_KEY_IDENTIFIER);
- }
- if (securityProperties.getDerivedKeyTokenReference() == null) {
- securityProperties.setDerivedKeyTokenReference(Constants.DerivedKeyTokenReference.DirectReference);
- }
- if (securityProperties.getDerivedKeyTokenReference() != Constants.DerivedKeyTokenReference.DirectReference) {
- securityProperties.setDerivedKeyKeyIdentifierType(Constants.KeyIdentifierType.EMBEDDED_SECURITY_TOKEN_REF);
- }
- break;
- case ENCRYPT_WITH_DERIVED_KEY:
- if (securityProperties.getCallbackHandler() == null) {
- throw new WSSConfigurationException(WSSecurityException.ErrorCode.FAILURE, "noCallback");
- }
- if (securityProperties.getEncryptionUseThisCertificate() == null
- && securityProperties.getEncryptionKeyStore() == null
- && !securityProperties.isUseReqSigCertForEncryption()) {
- throw new WSSConfigurationException(WSSecurityException.ErrorCode.FAILURE, "encryptionKeyStoreNotSet");
- }
- if (securityProperties.getEncryptionUser() == null
- && securityProperties.getEncryptionUseThisCertificate() == null
- && !securityProperties.isUseReqSigCertForEncryption()) {
- throw new WSSConfigurationException(WSSecurityException.ErrorCode.FAILURE, "noEncryptionUser");
- }
- //encryption namespace part will be set in SecurityHeaderOutputProcessor
- if (securityProperties.getEncryptionSecureParts().isEmpty()) {
- securityProperties.addEncryptionPart(new SecurePart("Body", "*", SecurePart.Modifier.Content));
- }
- if (securityProperties.getEncryptionSymAlgorithm() == null) {
- securityProperties.setEncryptionSymAlgorithm("http://www.w3.org/2001/04/xmlenc#aes256-cbc");
- }
- if (securityProperties.getEncryptionKeyTransportAlgorithm() == null) {
- //@see http://www.w3.org/TR/2002/REC-xmlenc-core-20021210/Overview.html#rsa-1_5 :
- //"RSA-OAEP is RECOMMENDED for the transport of AES keys"
- //@see http://www.w3.org/TR/2002/REC-xmlenc-core-20021210/Overview.html#rsa-oaep-mgf1p
- securityProperties.setEncryptionKeyTransportAlgorithm("http://www.w3.org/2001/04/xmlenc#rsa-oaep-mgf1p");
- }
- if (securityProperties.getEncryptionKeyIdentifierType() == null) {
- securityProperties.setEncryptionKeyIdentifierType(Constants.KeyIdentifierType.X509_KEY_IDENTIFIER);
- }
- if (securityProperties.getDerivedKeyKeyIdentifierType() == null) {
- securityProperties.setDerivedKeyKeyIdentifierType(Constants.KeyIdentifierType.X509_KEY_IDENTIFIER);
- }
- if (securityProperties.getDerivedKeyTokenReference() == null) {
- securityProperties.setDerivedKeyTokenReference(Constants.DerivedKeyTokenReference.EncryptedKey);
- }
- if (securityProperties.getDerivedKeyTokenReference() != Constants.DerivedKeyTokenReference.DirectReference) {
- securityProperties.setDerivedKeyKeyIdentifierType(Constants.KeyIdentifierType.EMBEDDED_SECURITY_TOKEN_REF);
- }
- break;
- case SAML_TOKEN_SIGNED:
- if (securityProperties.getCallbackHandler() == null) {
- throw new WSSConfigurationException(WSSecurityException.ErrorCode.FAILURE, "noCallback");
- }
- //signature namespace part will be set in SecurityHeaderOutputProcessor
- if (securityProperties.getSignatureSecureParts().isEmpty()) {
- securityProperties.addSignaturePart(new SecurePart("Body", "*", SecurePart.Modifier.Element));
- }
- if (securityProperties.getSignatureAlgorithm() == null) {
- securityProperties.setSignatureAlgorithm("http://www.w3.org/2000/09/xmldsig#rsa-sha1");
- }
- if (securityProperties.getSignatureDigestAlgorithm() == null) {
- securityProperties.setSignatureDigestAlgorithm("http://www.w3.org/2000/09/xmldsig#sha1");
- }
- if (securityProperties.getSignatureCanonicalizationAlgorithm() == null) {
- securityProperties.setSignatureCanonicalizationAlgorithm("http://www.w3.org/2001/10/xml-exc-c14n#");
- }
- if (securityProperties.getSignatureKeyIdentifierType() == null) {
- securityProperties.setSignatureKeyIdentifierType(Constants.KeyIdentifierType.EMBEDDED_SECURITY_TOKEN_REF);
- }
- break;
- case SAML_TOKEN_UNSIGNED:
- if (securityProperties.getCallbackHandler() == null) {
- throw new WSSConfigurationException(WSSecurityException.ErrorCode.FAILURE, "noCallback");
- }
- break;
+ XMLSecurityConstants.Action action = securityProperties.getOutAction()[i];
+ if (action.equals(WSSConstants.TIMESTAMP)) {
+ if (securityProperties.getTimestampTTL() == null) {
+ securityProperties.setTimestampTTL(300);
+ }
+ } else if (action.equals(WSSConstants.SIGNATURE)) {
+ if (securityProperties.getSignatureKeyStore() == null) {
+ throw new WSSConfigurationException(WSSecurityException.ErrorCode.FAILURE, "signatureKeyStoreNotSet");
+ }
+ if (securityProperties.getSignatureUser() == null) {
+ throw new WSSConfigurationException(WSSecurityException.ErrorCode.FAILURE, "noSignatureUser");
+ }
+ if (securityProperties.getCallbackHandler() == null) {
+ throw new WSSConfigurationException(WSSecurityException.ErrorCode.FAILURE, "noCallback");
+ }
+ //signature namespace part will be set in SecurityHeaderOutputProcessor
+ if (securityProperties.getSignatureSecureParts().isEmpty()) {
+ securityProperties.addSignaturePart(new SecurePart("Body", "*", SecurePart.Modifier.Element));
+ }
+ if (securityProperties.getSignatureAlgorithm() == null) {
+ securityProperties.setSignatureAlgorithm("http://www.w3.org/2000/09/xmldsig#rsa-sha1");
+ }
+ if (securityProperties.getSignatureDigestAlgorithm() == null) {
+ securityProperties.setSignatureDigestAlgorithm("http://www.w3.org/2000/09/xmldsig#sha1");
+ }
+ if (securityProperties.getSignatureCanonicalizationAlgorithm() == null) {
+ securityProperties.setSignatureCanonicalizationAlgorithm("http://www.w3.org/2001/10/xml-exc-c14n#");
+ }
+ if (securityProperties.getSignatureKeyIdentifierType() == null) {
+ securityProperties.setSignatureKeyIdentifierType(WSSConstants.KeyIdentifierType.ISSUER_SERIAL);
+ }
+ } else if (action.equals(WSSConstants.ENCRYPT)) {
+ if (securityProperties.getEncryptionUseThisCertificate() == null
+ && securityProperties.getEncryptionKeyStore() == null
+ && !securityProperties.isUseReqSigCertForEncryption()) {
+ throw new WSSConfigurationException(WSSecurityException.ErrorCode.FAILURE, "encryptionKeyStoreNotSet");
+ }
+ if (securityProperties.getEncryptionUser() == null
+ && securityProperties.getEncryptionUseThisCertificate() == null
+ && !securityProperties.isUseReqSigCertForEncryption()) {
+ throw new WSSConfigurationException(WSSecurityException.ErrorCode.FAILURE, "noEncryptionUser");
+ }
+ //encryption namespace part will be set in SecurityHeaderOutputProcessor
+ if (securityProperties.getEncryptionSecureParts().isEmpty()) {
+ securityProperties.addEncryptionPart(new SecurePart("Body", "*", SecurePart.Modifier.Content));
+ }
+ if (securityProperties.getEncryptionSymAlgorithm() == null) {
+ securityProperties.setEncryptionSymAlgorithm("http://www.w3.org/2001/04/xmlenc#aes256-cbc");
+ }
+ if (securityProperties.getEncryptionKeyTransportAlgorithm() == null) {
+ //@see http://www.w3.org/TR/2002/REC-xmlenc-core-20021210/Overview.html#rsa-1_5 :
+ //"RSA-OAEP is RECOMMENDED for the transport of AES keys"
+ //@see http://www.w3.org/TR/2002/REC-xmlenc-core-20021210/Overview.html#rsa-oaep-mgf1p
+ securityProperties.setEncryptionKeyTransportAlgorithm("http://www.w3.org/2001/04/xmlenc#rsa-oaep-mgf1p");
+ }
+ if (securityProperties.getEncryptionKeyIdentifierType() == null) {
+ securityProperties.setEncryptionKeyIdentifierType(WSSConstants.KeyIdentifierType.ISSUER_SERIAL);
+ }
+ } else if (action.equals(WSSConstants.USERNAMETOKEN)) {
+ if (securityProperties.getTokenUser() == null) {
+ throw new WSSConfigurationException(WSSecurityException.ErrorCode.FAILURE, "noTokenUser");
+ }
+ if (securityProperties.getCallbackHandler() == null) {
+ throw new WSSConfigurationException(WSSecurityException.ErrorCode.FAILURE, "noCallback");
+ }
+ if (securityProperties.getUsernameTokenPasswordType() == null) {
+ securityProperties.setUsernameTokenPasswordType(WSSConstants.UsernameTokenPasswordType.PASSWORD_DIGEST);
+ }
+ } else if (action.equals(WSSConstants.USERNAMETOKEN_SIGNED)) {
+ if (securityProperties.getTokenUser() == null) {
+ throw new WSSConfigurationException(WSSecurityException.ErrorCode.FAILURE, "noTokenUser");
+ }
+ if (securityProperties.getCallbackHandler() == null) {
+ throw new WSSConfigurationException(WSSecurityException.ErrorCode.FAILURE, "noCallback");
+ }
+ //signature namespace part will be set in SecurityHeaderOutputProcessor
+ if (securityProperties.getSignatureSecureParts().isEmpty()) {
+ securityProperties.addSignaturePart(new SecurePart("Body", "*", SecurePart.Modifier.Element));
+ }
+ if (securityProperties.getSignatureAlgorithm() == null) {
+ securityProperties.setSignatureAlgorithm("http://www.w3.org/2000/09/xmldsig#hmac-sha1");
+ }
+ if (securityProperties.getSignatureDigestAlgorithm() == null) {
+ securityProperties.setSignatureDigestAlgorithm("http://www.w3.org/2000/09/xmldsig#sha1");
+ }
+ if (securityProperties.getSignatureCanonicalizationAlgorithm() == null) {
+ securityProperties.setSignatureCanonicalizationAlgorithm("http://www.w3.org/2001/10/xml-exc-c14n#");
+ }
+ securityProperties.setSignatureKeyIdentifierType(WSSConstants.KeyIdentifierType.USERNAMETOKEN_REFERENCE);
+ if (securityProperties.getUsernameTokenPasswordType() == null) {
+ securityProperties.setUsernameTokenPasswordType(WSSConstants.UsernameTokenPasswordType.PASSWORD_DIGEST);
+ }
+ } else if (action.equals(WSSConstants.SIGNATURE_CONFIRMATION)) {
+ securityProperties.addSignaturePart(new SecurePart(WSSConstants.TAG_wsse11_SignatureConfirmation.getLocalPart(), WSSConstants.TAG_wsse11_SignatureConfirmation.getNamespaceURI(), SecurePart.Modifier.Element));
+ } else if (action.equals(WSSConstants.SIGNATURE_WITH_DERIVED_KEY)) {
+ if (securityProperties.getCallbackHandler() == null) {
+ throw new WSSConfigurationException(WSSecurityException.ErrorCode.FAILURE, "noCallback");
+ }
+ //signature namespace part will be set in SecurityHeaderOutputProcessor
+ if (securityProperties.getSignatureSecureParts().isEmpty()) {
+ securityProperties.addSignaturePart(new SecurePart("Body", "*", SecurePart.Modifier.Element));
+ }
+ if (securityProperties.getSignatureAlgorithm() == null) {
+ securityProperties.setSignatureAlgorithm("http://www.w3.org/2000/09/xmldsig#hmac-sha1");
+ }
+ if (securityProperties.getSignatureDigestAlgorithm() == null) {
+ securityProperties.setSignatureDigestAlgorithm("http://www.w3.org/2000/09/xmldsig#sha1");
+ }
+ if (securityProperties.getSignatureCanonicalizationAlgorithm() == null) {
+ securityProperties.setSignatureCanonicalizationAlgorithm("http://www.w3.org/2001/10/xml-exc-c14n#");
+ }
+ securityProperties.setSignatureKeyIdentifierType(WSSConstants.KeyIdentifierType.EMBEDDED_SECURITY_TOKEN_REF);
+ if (securityProperties.getEncryptionSymAlgorithm() == null) {
+ securityProperties.setEncryptionSymAlgorithm("http://www.w3.org/2001/04/xmlenc#aes256-cbc");
+ }
+ if (securityProperties.getEncryptionKeyTransportAlgorithm() == null) {
+ //@see http://www.w3.org/TR/2002/REC-xmlenc-core-20021210/Overview.html#rsa-1_5 :
+ //"RSA-OAEP is RECOMMENDED for the transport of AES keys"
+ //@see http://www.w3.org/TR/2002/REC-xmlenc-core-20021210/Overview.html#rsa-oaep-mgf1p
+ securityProperties.setEncryptionKeyTransportAlgorithm("http://www.w3.org/2001/04/xmlenc#rsa-oaep-mgf1p");
+ }
+ if (securityProperties.getEncryptionKeyIdentifierType() == null) {
+ securityProperties.setEncryptionKeyIdentifierType(WSSConstants.KeyIdentifierType.X509_KEY_IDENTIFIER);
+ }
+ if (securityProperties.getDerivedKeyKeyIdentifierType() == null) {
+ securityProperties.setDerivedKeyKeyIdentifierType(WSSConstants.KeyIdentifierType.X509_KEY_IDENTIFIER);
+ }
+ if (securityProperties.getDerivedKeyTokenReference() == null) {
+ securityProperties.setDerivedKeyTokenReference(WSSConstants.DerivedKeyTokenReference.DirectReference);
+ }
+ if (securityProperties.getDerivedKeyTokenReference() != WSSConstants.DerivedKeyTokenReference.DirectReference) {
+ securityProperties.setDerivedKeyKeyIdentifierType(WSSConstants.KeyIdentifierType.EMBEDDED_SECURITY_TOKEN_REF);
+ }
+ } else if (action.equals(WSSConstants.ENCRYPT_WITH_DERIVED_KEY)) {
+ if (securityProperties.getCallbackHandler() == null) {
+ throw new WSSConfigurationException(WSSecurityException.ErrorCode.FAILURE, "noCallback");
+ }
+ if (securityProperties.getEncryptionUseThisCertificate() == null
+ && securityProperties.getEncryptionKeyStore() == null
+ && !securityProperties.isUseReqSigCertForEncryption()) {
+ throw new WSSConfigurationException(WSSecurityException.ErrorCode.FAILURE, "encryptionKeyStoreNotSet");
+ }
+ if (securityProperties.getEncryptionUser() == null
+ && securityProperties.getEncryptionUseThisCertificate() == null
+ && !securityProperties.isUseReqSigCertForEncryption()) {
+ throw new WSSConfigurationException(WSSecurityException.ErrorCode.FAILURE, "noEncryptionUser");
+ }
+ //encryption namespace part will be set in SecurityHeaderOutputProcessor
+ if (securityProperties.getEncryptionSecureParts().isEmpty()) {
+ securityProperties.addEncryptionPart(new SecurePart("Body", "*", SecurePart.Modifier.Content));
+ }
+ if (securityProperties.getEncryptionSymAlgorithm() == null) {
+ securityProperties.setEncryptionSymAlgorithm("http://www.w3.org/2001/04/xmlenc#aes256-cbc");
+ }
+ if (securityProperties.getEncryptionKeyTransportAlgorithm() == null) {
+ //@see http://www.w3.org/TR/2002/REC-xmlenc-core-20021210/Overview.html#rsa-1_5 :
+ //"RSA-OAEP is RECOMMENDED for the transport of AES keys"
+ //@see http://www.w3.org/TR/2002/REC-xmlenc-core-20021210/Overview.html#rsa-oaep-mgf1p
+ securityProperties.setEncryptionKeyTransportAlgorithm("http://www.w3.org/2001/04/xmlenc#rsa-oaep-mgf1p");
+ }
+ if (securityProperties.getEncryptionKeyIdentifierType() == null) {
+ securityProperties.setEncryptionKeyIdentifierType(WSSConstants.KeyIdentifierType.X509_KEY_IDENTIFIER);
+ }
+ if (securityProperties.getDerivedKeyKeyIdentifierType() == null) {
+ securityProperties.setDerivedKeyKeyIdentifierType(WSSConstants.KeyIdentifierType.X509_KEY_IDENTIFIER);
+ }
+ if (securityProperties.getDerivedKeyTokenReference() == null) {
+ securityProperties.setDerivedKeyTokenReference(WSSConstants.DerivedKeyTokenReference.EncryptedKey);
+ }
+ if (securityProperties.getDerivedKeyTokenReference() != WSSConstants.DerivedKeyTokenReference.DirectReference) {
+ securityProperties.setDerivedKeyKeyIdentifierType(WSSConstants.KeyIdentifierType.EMBEDDED_SECURITY_TOKEN_REF);
+ }
+ } else if (action.equals(WSSConstants.SAML_TOKEN_SIGNED)) {
+ if (securityProperties.getCallbackHandler() == null) {
+ throw new WSSConfigurationException(WSSecurityException.ErrorCode.FAILURE, "noCallback");
+ }
+ //signature namespace part will be set in SecurityHeaderOutputProcessor
+ if (securityProperties.getSignatureSecureParts().isEmpty()) {
+ securityProperties.addSignaturePart(new SecurePart("Body", "*", SecurePart.Modifier.Element));
+ }
+ if (securityProperties.getSignatureAlgorithm() == null) {
+ securityProperties.setSignatureAlgorithm("http://www.w3.org/2000/09/xmldsig#rsa-sha1");
+ }
+ if (securityProperties.getSignatureDigestAlgorithm() == null) {
+ securityProperties.setSignatureDigestAlgorithm("http://www.w3.org/2000/09/xmldsig#sha1");
+ }
+ if (securityProperties.getSignatureCanonicalizationAlgorithm() == null) {
+ securityProperties.setSignatureCanonicalizationAlgorithm("http://www.w3.org/2001/10/xml-exc-c14n#");
+ }
+ if (securityProperties.getSignatureKeyIdentifierType() == null) {
+ securityProperties.setSignatureKeyIdentifierType(WSSConstants.KeyIdentifierType.EMBEDDED_SECURITY_TOKEN_REF);
+ }
+ } else if (action.equals(WSSConstants.SAML_TOKEN_UNSIGNED)) {
+ if (securityProperties.getCallbackHandler() == null) {
+ throw new WSSConfigurationException(WSSecurityException.ErrorCode.FAILURE, "noCallback");
+ }
}
}
//todo clone securityProperties
@@ -337,10 +336,10 @@ public class WSSec {
*
* @param securityProperties The configuration to validate
* @return The validated configuration
- * @throws org.swssf.ext.WSSConfigurationException
+ * @throws org.swssf.wss.ext.WSSConfigurationException
* if the configuration is invalid
*/
- public static SecurityProperties validateAndApplyDefaultsToInboundSecurityProperties(SecurityProperties securityProperties) throws WSSConfigurationException {
+ public static WSSSecurityProperties validateAndApplyDefaultsToInboundSecurityProperties(WSSSecurityProperties securityProperties) throws WSSConfigurationException {
//todo clone securityProperties
return securityProperties;
}
Modified: webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/ext/InboundWSSec.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/ext/InboundWSSec.java?rev=1181995&r1=1179730&r2=1181995&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/ext/InboundWSSec.java (original)
+++ webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/ext/InboundWSSec.java Tue Oct 11 18:03:00 2011
@@ -16,19 +16,21 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.swssf.ext;
+package org.swssf.wss.ext;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.swssf.impl.DocumentContextImpl;
-import org.swssf.impl.InputProcessorChainImpl;
-import org.swssf.impl.XMLSecurityStreamReader;
-import org.swssf.impl.processor.input.LogInputProcessor;
-import org.swssf.impl.processor.input.SecurityHeaderInputProcessor;
-import org.swssf.impl.processor.input.SignatureConfirmationInputProcessor;
-import org.swssf.impl.processor.input.XMLEventReaderInputProcessor;
-import org.swssf.securityEvent.SecurityEvent;
-import org.swssf.securityEvent.SecurityEventListener;
+import org.swssf.wss.impl.WSSDocumentContextImpl;
+import org.swssf.wss.impl.WSSecurityContextImpl;
+import org.swssf.wss.impl.processor.input.SecurityHeaderInputProcessor;
+import org.swssf.wss.impl.processor.input.SignatureConfirmationInputProcessor;
+import org.swssf.wss.securityEvent.SecurityEvent;
+import org.swssf.wss.securityEvent.SecurityEventListener;
+import org.swssf.xmlsec.ext.InputProcessor;
+import org.swssf.xmlsec.impl.InputProcessorChainImpl;
+import org.swssf.xmlsec.impl.XMLSecurityStreamReader;
+import org.swssf.xmlsec.impl.processor.input.LogInputProcessor;
+import org.swssf.xmlsec.impl.processor.input.XMLEventReaderInputProcessor;
import javax.xml.stream.XMLEventReader;
import javax.xml.stream.XMLInputFactory;
@@ -49,9 +51,9 @@ public class InboundWSSec {
protected static final transient Log log = LogFactory.getLog(InboundWSSec.class);
- private SecurityProperties securityProperties;
+ private WSSSecurityProperties securityProperties;
- public InboundWSSec(SecurityProperties securityProperties) {
+ public InboundWSSec(WSSSecurityProperties securityProperties) {
this.securityProperties = securityProperties;
}
@@ -96,17 +98,17 @@ public class InboundWSSec {
*/
public XMLStreamReader processInMessage(XMLStreamReader xmlStreamReader, List<SecurityEvent> requestSecurityEvents, SecurityEventListener securityEventListener) throws XMLStreamException, WSSecurityException {
- final SecurityContextImpl securityContextImpl = new SecurityContextImpl();
+ final WSSecurityContextImpl securityContextImpl = new WSSecurityContextImpl();
securityContextImpl.putList(SecurityEvent.class, requestSecurityEvents);
securityContextImpl.setSecurityEventListener(securityEventListener);
final XMLInputFactory xmlInputFactory = XMLInputFactory.newFactory();
xmlInputFactory.setProperty(XMLInputFactory.SUPPORT_DTD, false);
xmlInputFactory.setProperty(XMLInputFactory.IS_SUPPORTING_EXTERNAL_ENTITIES, false);
- securityContextImpl.put(Constants.XMLINPUTFACTORY, xmlInputFactory);
+ securityContextImpl.put(WSSConstants.XMLINPUTFACTORY, xmlInputFactory);
final XMLEventReader xmlEventReader = xmlInputFactory.createXMLEventReader(xmlStreamReader);
- DocumentContextImpl documentContext = new DocumentContextImpl();
+ WSSDocumentContextImpl documentContext = new WSSDocumentContextImpl();
documentContext.setEncoding(xmlStreamReader.getEncoding() != null ? xmlStreamReader.getEncoding() : "UTF-8");
InputProcessorChainImpl inputProcessorChain = new InputProcessorChainImpl(securityContextImpl, documentContext);
inputProcessorChain.addProcessor(new XMLEventReaderInputProcessor(securityProperties, xmlEventReader));
@@ -117,7 +119,9 @@ public class InboundWSSec {
}
if (log.isTraceEnabled()) {
- inputProcessorChain.addProcessor(new LogInputProcessor(securityProperties));
+ LogInputProcessor logInputProcessor = new LogInputProcessor(securityProperties);
+ logInputProcessor.getAfterProcessors().add(SecurityHeaderInputProcessor.class.getName());
+ inputProcessorChain.addProcessor(logInputProcessor);
}
List<InputProcessor> additionalInputProcessors = securityProperties.getInputProcessorList();
Modified: webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/ext/OutboundWSSec.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/ext/OutboundWSSec.java?rev=1181995&r1=1179730&r2=1181995&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/ext/OutboundWSSec.java (original)
+++ webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/ext/OutboundWSSec.java Tue Oct 11 18:03:00 2011
@@ -16,14 +16,18 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.swssf.ext;
+package org.swssf.wss.ext;
-import org.swssf.impl.DocumentContextImpl;
-import org.swssf.impl.OutputProcessorChainImpl;
-import org.swssf.impl.XMLSecurityStreamWriter;
-import org.swssf.impl.processor.output.*;
-import org.swssf.securityEvent.SecurityEvent;
-import org.swssf.securityEvent.SecurityEventListener;
+import org.swssf.wss.impl.WSSDocumentContextImpl;
+import org.swssf.wss.impl.WSSecurityContextImpl;
+import org.swssf.wss.impl.processor.output.*;
+import org.swssf.wss.securityEvent.SecurityEvent;
+import org.swssf.wss.securityEvent.SecurityEventListener;
+import org.swssf.xmlsec.ext.XMLSecurityConstants;
+import org.swssf.xmlsec.ext.XMLSecurityException;
+import org.swssf.xmlsec.impl.OutputProcessorChainImpl;
+import org.swssf.xmlsec.impl.XMLSecurityStreamWriter;
+import org.swssf.xmlsec.impl.processor.output.FinalOutputProcessor;
import javax.xml.stream.XMLStreamWriter;
import java.io.OutputStream;
@@ -38,9 +42,9 @@ import java.util.List;
*/
public class OutboundWSSec {
- private SecurityProperties securityProperties;
+ private WSSSecurityProperties securityProperties;
- public OutboundWSSec(SecurityProperties securityProperties) {
+ public OutboundWSSec(WSSSecurityProperties securityProperties) {
this.securityProperties = securityProperties;
}
@@ -66,93 +70,90 @@ public class OutboundWSSec {
*/
public XMLStreamWriter processOutMessage(OutputStream outputStream, String encoding, List<SecurityEvent> requestSecurityEvents, SecurityEventListener securityEventListener) throws WSSecurityException {
- final SecurityContextImpl securityContextImpl = new SecurityContextImpl();
+ final WSSecurityContextImpl securityContextImpl = new WSSecurityContextImpl();
securityContextImpl.putList(SecurityEvent.class, requestSecurityEvents);
securityContextImpl.setSecurityEventListener(securityEventListener);
- final DocumentContextImpl documentContext = new DocumentContextImpl();
+ final WSSDocumentContextImpl documentContext = new WSSDocumentContextImpl();
documentContext.setEncoding(encoding);
OutputProcessorChainImpl processorChain = new OutputProcessorChainImpl(securityContextImpl, documentContext);
- processorChain.addProcessor(new SecurityHeaderOutputProcessor(securityProperties, null));
- //todo some combinations are not possible atm: eg Action.SIGNATURE and Action.USERNAMETOKEN_SIGNED
- //todo they use the same signaure parts
- for (int i = 0; i < securityProperties.getOutAction().length; i++) {
- Constants.Action action = securityProperties.getOutAction()[i];
- switch (action) {
- case TIMESTAMP: {
+
+ try {
+ processorChain.addProcessor(new SecurityHeaderOutputProcessor(securityProperties, null));
+ //todo some combinations are not possible atm: eg Action.SIGNATURE and Action.USERNAMETOKEN_SIGNED
+ //todo they use the same signaure parts
+ for (int i = 0; i < securityProperties.getOutAction().length; i++) {
+ XMLSecurityConstants.Action action = securityProperties.getOutAction()[i];
+ if (action.equals(WSSConstants.TIMESTAMP)) {
processorChain.addProcessor(new TimestampOutputProcessor(securityProperties, action));
- break;
- }
- case SIGNATURE: {
+ } else if (action.equals(WSSConstants.SIGNATURE)) {
processorChain.addProcessor(new BinarySecurityTokenOutputProcessor(securityProperties, action));
SignatureOutputProcessor signatureOutputProcessor = new SignatureOutputProcessor(securityProperties, action);
processorChain.addProcessor(signatureOutputProcessor);
- processorChain.addProcessor(new SignatureEndingOutputProcessor(securityProperties, action, signatureOutputProcessor));
- break;
- }
- case ENCRYPT: {
+ SignatureEndingOutputProcessor signatureEndingOutputProcessor = new SignatureEndingOutputProcessor(securityProperties, action, signatureOutputProcessor);
+ signatureEndingOutputProcessor.getAfterProcessors().add(UsernameTokenOutputProcessor.class.getName());
+ processorChain.addProcessor(signatureEndingOutputProcessor);
+ } else if (action.equals(WSSConstants.ENCRYPT)) {
processorChain.addProcessor(new BinarySecurityTokenOutputProcessor(securityProperties, action));
processorChain.addProcessor(new EncryptedKeyOutputProcessor(securityProperties, action));
processorChain.addProcessor(new EncryptOutputProcessor(securityProperties, action));
- processorChain.addProcessor(new EncryptEndingOutputProcessor(securityProperties, action));
- break;
- }
- case USERNAMETOKEN: {
+ org.swssf.wss.impl.processor.output.EncryptEndingOutputProcessor encryptEndingOutputProcessor = new org.swssf.wss.impl.processor.output.EncryptEndingOutputProcessor(securityProperties, action);
+ encryptEndingOutputProcessor.getAfterProcessors().add(UsernameTokenOutputProcessor.class.getName());
+ processorChain.addProcessor(encryptEndingOutputProcessor);
+ } else if (action.equals(WSSConstants.USERNAMETOKEN)) {
UsernameTokenOutputProcessor usernameTokenOutputProcessor = new UsernameTokenOutputProcessor(securityProperties, action);
processorChain.addProcessor(usernameTokenOutputProcessor);
- break;
- }
- case USERNAMETOKEN_SIGNED: {
+ } else if (action.equals(WSSConstants.USERNAMETOKEN_SIGNED)) {
processorChain.addProcessor(new UsernameTokenOutputProcessor(securityProperties, action));
SignatureOutputProcessor signatureOutputProcessor = new SignatureOutputProcessor(securityProperties, action);
processorChain.addProcessor(signatureOutputProcessor);
- processorChain.addProcessor(new SignatureEndingOutputProcessor(securityProperties, action, signatureOutputProcessor));
- break;
- }
- case SIGNATURE_CONFIRMATION: {
+ SignatureEndingOutputProcessor signatureEndingOutputProcessor = new SignatureEndingOutputProcessor(securityProperties, action, signatureOutputProcessor);
+ signatureEndingOutputProcessor.getAfterProcessors().add(UsernameTokenOutputProcessor.class.getName());
+ processorChain.addProcessor(signatureEndingOutputProcessor);
+ } else if (action.equals(WSSConstants.SIGNATURE_CONFIRMATION)) {
SignatureConfirmationOutputProcessor signatureConfirmationOutputProcessor = new SignatureConfirmationOutputProcessor(securityProperties, action);
processorChain.addProcessor(signatureConfirmationOutputProcessor);
- break;
- }
- case SIGNATURE_WITH_DERIVED_KEY: {
+ } else if (action.equals(WSSConstants.SIGNATURE_WITH_DERIVED_KEY)) {
processorChain.addProcessor(new BinarySecurityTokenOutputProcessor(securityProperties, action));
- if (securityProperties.getDerivedKeyTokenReference() == Constants.DerivedKeyTokenReference.EncryptedKey) {
+ if (securityProperties.getDerivedKeyTokenReference() == WSSConstants.DerivedKeyTokenReference.EncryptedKey) {
processorChain.addProcessor(new EncryptedKeyOutputProcessor(securityProperties, action));
- } else if (securityProperties.getDerivedKeyTokenReference() == Constants.DerivedKeyTokenReference.SecurityContextToken) {
+ } else if (securityProperties.getDerivedKeyTokenReference() == WSSConstants.DerivedKeyTokenReference.SecurityContextToken) {
processorChain.addProcessor(new SecurityContextTokenOutputProcessor(securityProperties, action));
}
processorChain.addProcessor(new DerivedKeyTokenOutputProcessor(securityProperties, action));
SignatureOutputProcessor signatureOutputProcessor = new SignatureOutputProcessor(securityProperties, action);
processorChain.addProcessor(signatureOutputProcessor);
- processorChain.addProcessor(new SignatureEndingOutputProcessor(securityProperties, action, signatureOutputProcessor));
- break;
- }
- case ENCRYPT_WITH_DERIVED_KEY: {
+ SignatureEndingOutputProcessor signatureEndingOutputProcessor = new SignatureEndingOutputProcessor(securityProperties, action, signatureOutputProcessor);
+ signatureEndingOutputProcessor.getAfterProcessors().add(UsernameTokenOutputProcessor.class.getName());
+ processorChain.addProcessor(signatureEndingOutputProcessor);
+ } else if (action.equals(WSSConstants.ENCRYPT_WITH_DERIVED_KEY)) {
processorChain.addProcessor(new BinarySecurityTokenOutputProcessor(securityProperties, action));
- if (securityProperties.getDerivedKeyTokenReference() == Constants.DerivedKeyTokenReference.EncryptedKey) {
+ if (securityProperties.getDerivedKeyTokenReference() == WSSConstants.DerivedKeyTokenReference.EncryptedKey) {
processorChain.addProcessor(new EncryptedKeyOutputProcessor(securityProperties, action));
- } else if (securityProperties.getDerivedKeyTokenReference() == Constants.DerivedKeyTokenReference.SecurityContextToken) {
+ } else if (securityProperties.getDerivedKeyTokenReference() == WSSConstants.DerivedKeyTokenReference.SecurityContextToken) {
processorChain.addProcessor(new SecurityContextTokenOutputProcessor(securityProperties, action));
}
processorChain.addProcessor(new DerivedKeyTokenOutputProcessor(securityProperties, action));
processorChain.addProcessor(new EncryptOutputProcessor(securityProperties, action));
- processorChain.addProcessor(new EncryptEndingOutputProcessor(securityProperties, action));
- break;
- }
- case SAML_TOKEN_SIGNED: {
+ org.swssf.wss.impl.processor.output.EncryptEndingOutputProcessor encryptEndingOutputProcessor = new org.swssf.wss.impl.processor.output.EncryptEndingOutputProcessor(securityProperties, action);
+ encryptEndingOutputProcessor.getAfterProcessors().add(UsernameTokenOutputProcessor.class.getName());
+ processorChain.addProcessor(encryptEndingOutputProcessor);
+ } else if (action.equals(WSSConstants.SAML_TOKEN_SIGNED)) {
processorChain.addProcessor(new SAMLTokenOutputProcessor(securityProperties, action));
SignatureOutputProcessor signatureOutputProcessor = new SignatureOutputProcessor(securityProperties, action);
processorChain.addProcessor(signatureOutputProcessor);
- processorChain.addProcessor(new SignatureEndingOutputProcessor(securityProperties, action, signatureOutputProcessor));
- break;
- }
- case SAML_TOKEN_UNSIGNED: {
+ SignatureEndingOutputProcessor signatureEndingOutputProcessor = new SignatureEndingOutputProcessor(securityProperties, action, signatureOutputProcessor);
+ signatureEndingOutputProcessor.getAfterProcessors().add(UsernameTokenOutputProcessor.class.getName());
+ processorChain.addProcessor(signatureEndingOutputProcessor);
+ } else if (action.equals(WSSConstants.SAML_TOKEN_UNSIGNED)) {
processorChain.addProcessor(new SAMLTokenOutputProcessor(securityProperties, action));
}
}
- }
- processorChain.addProcessor(new FinalOutputProcessor(outputStream, encoding, securityProperties, null));
+ processorChain.addProcessor(new FinalOutputProcessor(outputStream, encoding, securityProperties, null));
+ } catch (XMLSecurityException e) {
+ throw new WSSecurityException(e.getMessage(), e);
+ }
return new XMLSecurityStreamWriter(processorChain);
}
}
Modified: webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/ext/WSPasswordCallback.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/ext/WSPasswordCallback.java?rev=1181995&r1=1179730&r2=1181995&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/ext/WSPasswordCallback.java (original)
+++ webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/ext/WSPasswordCallback.java Tue Oct 11 18:03:00 2011
@@ -17,7 +17,7 @@
* under the License.
*/
-package org.swssf.ext;
+package org.swssf.wss.ext;
import org.w3c.dom.Element;
Modified: webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/ext/WSSConfigurationException.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/ext/WSSConfigurationException.java?rev=1181995&r1=1179730&r2=1181995&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/ext/WSSConfigurationException.java (original)
+++ webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/ext/WSSConfigurationException.java Tue Oct 11 18:03:00 2011
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.swssf.ext;
+package org.swssf.wss.ext;
/**
* Exception when configuration errors are detected
Copied: webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/ext/WSSConstants.java (from r1179730, webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/ext/Constants.java)
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/ext/WSSConstants.java?p2=webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/ext/WSSConstants.java&p1=webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/ext/Constants.java&r1=1179730&r2=1181995&rev=1181995&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/ext/Constants.java (original)
+++ webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/ext/WSSConstants.java Tue Oct 11 18:03:00 2011
@@ -16,49 +16,28 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.swssf.ext;
+package org.swssf.wss.ext;
+
+import org.swssf.xmlsec.ext.XMLSecurityConstants;
import javax.xml.namespace.QName;
-import java.security.NoSuchAlgorithmException;
-import java.security.SecureRandom;
import java.util.EnumSet;
import java.util.HashMap;
import java.util.Map;
/**
- * Constants for global use
+ * WSSConstants for global use
*
* @author $Author$
* @version $Revision$ $Date$
*/
-public class Constants {
-
- private Constants() {
- }
-
- public static final SecureRandom secureRandom;
-
- static {
- try {
- secureRandom = SecureRandom.getInstance("SHA1PRNG");
- secureRandom.setSeed(System.currentTimeMillis());
- } catch (NoSuchAlgorithmException e) {
- throw new RuntimeException(e);
- }
- }
+public class WSSConstants extends XMLSecurityConstants {
- public enum Phase {
- PREPROCESSING,
- PROCESSING,
- POSTPROCESSING,
+ protected WSSConstants() {
}
- public static final String XMLINPUTFACTORY = "XMLInputFactory";
public static final String TIMESTAMP_PROCESSED = "TimestampProcessed";
- public static final String NS_XML = "http://www.w3.org/2000/xmlns/";
- public static final String NS_XMLENC = "http://www.w3.org/2001/04/xmlenc#";
- public static final String NS_DSIG = "http://www.w3.org/2000/09/xmldsig#";
public static final String NS_WSSE10 = "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd";
public static final String NS_WSSE11 = "http://docs.oasis-open.org/wss/oasis-wss-wssecurity-secext-1.1.xsd";
public static final String NS_WSU10 = "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd";
@@ -90,19 +69,6 @@ public class Constants {
public static final String PREFIX_WSSE11 = "wsse11";
public static final QName TAG_wsse_Security = new QName(NS_WSSE10, "Security", PREFIX_WSSE);
- public static final String PREFIX_XENC = "xenc";
- public static final QName TAG_xenc_EncryptedKey = new QName(NS_XMLENC, "EncryptedKey", PREFIX_XENC);
- public static final QName ATT_NULL_Id = new QName(null, "Id");
- public static final QName ATT_NULL_Type = new QName(null, "Type");
- public static final QName ATT_NULL_MimeType = new QName(null, "MimeType");
- public static final QName ATT_NULL_Encoding = new QName(null, "Encoding");
-
- public static final QName TAG_xenc_EncryptionMethod = new QName(NS_XMLENC, "EncryptionMethod", PREFIX_XENC);
- public static final QName ATT_NULL_Algorithm = new QName(null, "Algorithm");
-
- public static final String PREFIX_DSIG = "dsig";
- public static final QName TAG_dsig_KeyInfo = new QName(NS_DSIG, "KeyInfo", PREFIX_DSIG);
-
public static final QName TAG_wsse_SecurityTokenReference = new QName(NS_WSSE10, "SecurityTokenReference", PREFIX_WSSE);
public static final QName TAG_wsse_Reference = new QName(NS_WSSE10, "Reference", PREFIX_WSSE);
public static final QName ATT_wsse_Usage = new QName(NS_WSSE10, "Usage", PREFIX_WSSE);
@@ -112,56 +78,18 @@ public class Constants {
public static final QName ATT_NULL_EncodingType = new QName(null, "EncodingType");
public static final QName ATT_NULL_ValueType = new QName(null, "ValueType");
- public static final QName TAG_xenc_EncryptionProperties = new QName(NS_XMLENC, "EncryptionProperties", PREFIX_XENC);
-
- public static final QName TAG_xenc_CipherData = new QName(NS_XMLENC, "CipherData", PREFIX_XENC);
-
- public static final QName TAG_xenc_CipherValue = new QName(NS_XMLENC, "CipherValue", PREFIX_XENC);
-
- public static final QName TAG_xenc_ReferenceList = new QName(NS_XMLENC, "ReferenceList", PREFIX_XENC);
-
- public static final QName TAG_xenc_DataReference = new QName(NS_XMLENC, "DataReference", PREFIX_XENC);
- public static final QName ATT_NULL_URI = new QName(null, "URI");
-
public static final QName TAG_wsse_BinarySecurityToken = new QName(NS_WSSE10, "BinarySecurityToken", PREFIX_WSSE);
public static final String PREFIX_WSU = "wsu";
public static final QName ATT_wsu_Id = new QName(NS_WSU10, "Id", PREFIX_WSU);
- public static final QName TAG_xenc_EncryptedData = new QName(NS_XMLENC, "EncryptedData", PREFIX_XENC);
-
public static final QName TAG_wsse11_EncryptedHeader = new QName(NS_WSSE11, "EncryptedHeader", PREFIX_WSSE11);
- public static final QName TAG_dsig_Signature = new QName(NS_DSIG, "Signature", PREFIX_DSIG);
-
- public static final QName TAG_dsig_SignedInfo = new QName(NS_DSIG, "SignedInfo", PREFIX_DSIG);
-
- public static final QName TAG_dsig_CanonicalizationMethod = new QName(NS_DSIG, "CanonicalizationMethod", PREFIX_DSIG);
-
- public static final QName TAG_dsig_SignatureMethod = new QName(NS_DSIG, "SignatureMethod", PREFIX_DSIG);
-
- public static final QName TAG_dsig_Reference = new QName(NS_DSIG, "Reference", PREFIX_DSIG);
-
- public static final QName TAG_dsig_Transforms = new QName(NS_DSIG, "Transforms", PREFIX_DSIG);
-
- public static final QName TAG_dsig_Transform = new QName(NS_DSIG, "Transform", PREFIX_DSIG);
-
public static final QName TAG_wsse_TransformationParameters = new QName(NS_WSSE10, "TransformationParameters", PREFIX_WSSE);
- public static final QName TAG_dsig_DigestMethod = new QName(NS_DSIG, "DigestMethod", PREFIX_DSIG);
-
- public static final QName TAG_dsig_DigestValue = new QName(NS_DSIG, "DigestValue", PREFIX_DSIG);
-
- public static final QName TAG_dsig_SignatureValue = new QName(NS_DSIG, "SignatureValue", PREFIX_DSIG);
-
public static final QName TAG_wsu_Timestamp = new QName(NS_WSU10, "Timestamp", PREFIX_WSU);
public static final QName TAG_wsu_Created = new QName(NS_WSU10, "Created", PREFIX_WSU);
public static final QName TAG_wsu_Expires = new QName(NS_WSU10, "Expires", PREFIX_WSU);
- public static final QName TAG_dsig_X509Data = new QName(NS_DSIG, "X509Data", PREFIX_DSIG);
- public static final QName TAG_dsig_X509IssuerSerial = new QName(NS_DSIG, "X509IssuerSerial", PREFIX_DSIG);
- public static final QName TAG_dsig_X509IssuerName = new QName(NS_DSIG, "X509IssuerName", PREFIX_DSIG);
- public static final QName TAG_dsig_X509SerialNumber = new QName(NS_DSIG, "X509SerialNumber", PREFIX_DSIG);
-
public static final String NS10_SOAPMESSAGE_SECURITY = "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0";
public static final String NS11_SOAPMESSAGE_SECURITY = "http://docs.oasis-open.org/wss/oasis-wss-soap-message-security-1.1";
@@ -191,8 +119,6 @@ public class Constants {
public static final String NS_C14N_EXCL = "http://www.w3.org/2001/10/xml-exc-c14n#";
public static final String PREFIX_C14N_EXCL = "c14nEx";
- public static final QName ATT_NULL_PrefixList = new QName(null, "PrefixList");
- public static final QName TAG_c14nExcl_InclusiveNamespaces = new QName(NS_C14N_EXCL, "InclusiveNamespaces", PREFIX_C14N_EXCL);
public static final QName TAG_wst_BinarySecret = new QName(NS_WST, "BinarySecret");
@@ -258,17 +184,61 @@ public class Constants {
public static final int WSE_DERIVED_KEY_LEN = 16;
public static final String LABEL_FOR_DERIVED_KEY = "WS-Security";
- public enum Action {
- TIMESTAMP,
- SIGNATURE,
- ENCRYPT,
- USERNAMETOKEN,
- USERNAMETOKEN_SIGNED,
- SIGNATURE_CONFIRMATION,
- SIGNATURE_WITH_DERIVED_KEY,
- ENCRYPT_WITH_DERIVED_KEY,
- SAML_TOKEN_SIGNED,
- SAML_TOKEN_UNSIGNED,
+ public static final Action SIGNATURE = new Action(XMLSecurityConstants.SIGNATURE.toString());
+ public static final Action ENCRYPT = new Action(XMLSecurityConstants.ENCRYPT.toString());
+ public static final Action TIMESTAMP = new Action("TIMESTAMP");
+ public static final Action USERNAMETOKEN = new Action("USERNAMETOKEN");
+ public static final Action USERNAMETOKEN_SIGNED = new Action("USERNAMETOKEN_SIGNED");
+ public static final Action SIGNATURE_CONFIRMATION = new Action("SIGNATURE_CONFIRMATION");
+ public static final Action SIGNATURE_WITH_DERIVED_KEY = new Action("SIGNATURE_WITH_DERIVED_KEY");
+ public static final Action ENCRYPT_WITH_DERIVED_KEY = new Action("ENCRYPT_WITH_DERIVED_KEY");
+ public static final Action SAML_TOKEN_SIGNED = new Action("SAML_TOKEN_SIGNED");
+ public static final Action SAML_TOKEN_UNSIGNED = new Action("SAML_TOKEN_UNSIGNED");
+
+ public static class Action extends XMLSecurityConstants.Action {
+ protected Action(String name) {
+ super(name);
+ }
+ }
+
+ public static final KeyUsage Sym_Sig = new KeyUsage(XMLSecurityConstants.Sym_Sig.toString());
+ public static final KeyUsage Asym_Sig = new KeyUsage(XMLSecurityConstants.Asym_Sig.toString());
+ public static final KeyUsage Enc = new KeyUsage(XMLSecurityConstants.Enc.toString());
+ public static final KeyUsage Dig = new KeyUsage("Dig");
+ public static final KeyUsage Sym_Key_Wrap = new KeyUsage("Sym_Key_Wrap");
+ public static final KeyUsage Asym_Key_Wrap = new KeyUsage("Asym_Key_Wrap");
+ public static final KeyUsage Comp_Key = new KeyUsage("Comp_Key");
+ public static final KeyUsage Enc_KD = new KeyUsage("Enc_KD");
+ public static final KeyUsage Sig_KD = new KeyUsage("Sig_KD");
+ public static final KeyUsage C14n = new KeyUsage("C14n");
+ public static final KeyUsage Soap_Norm = new KeyUsage("Soap_Norm");
+ public static final KeyUsage STR_Trans = new KeyUsage("STR_Trans");
+ public static final KeyUsage XPath = new KeyUsage("XPath");
+
+ public static class KeyUsage extends XMLSecurityConstants.KeyUsage {
+ protected KeyUsage(String name) {
+ super(name);
+ }
+ }
+
+ public static final TokenType EncryptedKeyToken = new TokenType("EncryptedKeyToken");
+ public static final TokenType X509V3Token = new TokenType("X509V3Token");
+ public static final TokenType X509V1Token = new TokenType("X509V1Token");
+ public static final TokenType X509Pkcs7Token = new TokenType("X509Pkcs7Token");
+ public static final TokenType X509PkiPathV1Token = new TokenType("X509PkiPathV1Token");
+ public static final TokenType UsernameToken = new TokenType("UsernameToken");
+ public static final TokenType SecurityContextToken = new TokenType("SecurityContextToken");
+ public static final TokenType Saml10Token = new TokenType("Saml10Token");
+ public static final TokenType Saml11Token = new TokenType("Saml11Token");
+ public static final TokenType Saml20Token = new TokenType("Saml20Token");
+ public static final TokenType IssuedToken = new TokenType("IssuedToken");
+ public static final TokenType SecureConversationToken = new TokenType("SecureConversationToken");
+ public static final TokenType HttpsToken = new TokenType("HttpsToken");
+
+ public static class TokenType extends XMLSecurityConstants.TokenType {
+ protected TokenType(String name) {
+ super(name);
+ }
}
public enum KeyIdentifierType {
@@ -284,23 +254,6 @@ public class Constants {
USERNAMETOKEN_REFERENCE,
}
- public enum TokenType {
- EncryptedKeyToken,
- X509V3Token,
- X509V1Token,
- X509Pkcs7Token,
- X509PkiPathV1Token,
- UsernameToken,
- SecurityContextToken,
- Saml10Token,
- Saml11Token,
- Saml20Token,
- IssuedToken,
- SecureConversationToken,
- HttpsToken,
-
- }
-
public enum DerivedKeyTokenReference {
DirectReference,
EncryptedKey,
@@ -377,20 +330,4 @@ public class Constants {
* The message has expired
*/
public static final QName MESSAGE_EXPIRED = new QName(NS_WSSE10, "MessageExpired");
-
- public enum KeyUsage {
- Sym_Sig,
- Asym_Sig,
- Dig,
- Enc,
- Sym_Key_Wrap,
- Asym_Key_Wrap,
- Comp_Key,
- Enc_KD,
- Sig_KD,
- C14n,
- Soap_Norm,
- STR_Trans,
- XPath,
- }
}
Copied: webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/ext/WSSDocumentContext.java (from r1179730, webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/ext/DocumentContext.java)
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/ext/WSSDocumentContext.java?p2=webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/ext/WSSDocumentContext.java&p1=webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/ext/DocumentContext.java&r1=1179730&r2=1181995&rev=1181995&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/ext/DocumentContext.java (original)
+++ webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/ext/WSSDocumentContext.java Tue Oct 11 18:03:00 2011
@@ -16,10 +16,9 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.swssf.ext;
+package org.swssf.wss.ext;
-import javax.xml.namespace.QName;
-import java.util.List;
+import org.swssf.xmlsec.ext.DocumentContext;
/**
* This class holds per document, context informations
@@ -27,12 +26,7 @@ import java.util.List;
* @author $Author$
* @version $Revision$ $Date$
*/
-public interface DocumentContext {
-
- /**
- * @return The Encoding of the Document
- */
- public String getEncoding();
+public interface WSSDocumentContext extends DocumentContext {
/**
* @return The SOAP Version used
@@ -40,33 +34,6 @@ public interface DocumentContext {
public String getSOAPMessageVersionNamespace();
/**
- * Adds a Element to the path
- *
- * @param qName The QName of the path element
- */
- public void addPathElement(QName qName);
-
- /**
- * Removes a element from the path
- *
- * @return the removed element
- */
- public QName removePathElement();
-
- /**
- * @return The actual path in the xml
- */
- public List<QName> getPath();
-
- /**
- * Returns the parent element of the actual eventtype
- *
- * @param eventType current event type
- * @return the name of the parent element
- */
- public QName getParentElement(int eventType);
-
- /**
* Indicates if we are currently processing the soap header
*
* @return true if we stay in the soap header, false otherwise
@@ -81,11 +48,6 @@ public interface DocumentContext {
public boolean isInSOAPBody();
/**
- * @return The current level in the document
- */
- public int getDocumentLevel();
-
- /**
* Indicates if we are currently processing the security header
*
* @return true if we stay in the security header, false otherwise
@@ -99,33 +61,4 @@ public interface DocumentContext {
*/
public void setInSecurityHeader(boolean inSecurityHeader);
- /**
- * Indicates if we currently stay in an encrypted content
- */
- public void setIsInEncryptedContent();
-
- /**
- * unset when we leave the encrypted content
- */
- public void unsetIsInEncryptedContent();
-
- /**
- * @return true if we currently stay in encrypted content
- */
- public boolean isInEncryptedContent();
-
- /**
- * Indicates if we currently stay in a signed content
- */
- public void setIsInSignedContent();
-
- /**
- * unset when we leave the signed content
- */
- public void unsetIsInSignedContent();
-
- /**
- * @return true if we currently stay in signed content
- */
- public boolean isInSignedContent();
}