You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ws.apache.org by co...@apache.org on 2015/06/18 16:37:20 UTC
svn commit: r1686237 - in /webservices/wss4j/trunk:
ws-security-dom/src/main/java/org/apache/wss4j/dom/action/
ws-security-dom/src/main/java/org/apache/wss4j/dom/handler/
ws-security-dom/src/main/java/org/apache/wss4j/dom/message/
ws-security-dom/src/m...
Author: coheigea
Date: Thu Jun 18 14:37:19 2015
New Revision: 1686237
URL: http://svn.apache.org/r1686237
Log:
Some changes following static code analysis
Modified:
webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/action/SignatureConfirmationAction.java
webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/action/SignatureDerivedAction.java
webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/handler/WSHandler.java
webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/WSSecSignatureBase.java
webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/token/DerivedKeyToken.java
webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/token/SecurityContextToken.java
webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/str/DerivedKeyTokenSTRParser.java
webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/str/EncryptedKeySTRParser.java
webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/str/SecurityTokenRefSTRParser.java
webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/str/SignatureSTRParser.java
webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/ConfigurationConverter.java
webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/output/EncryptOutputProcessor.java
webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/output/WSSSignatureOutputProcessor.java
webservices/wss4j/trunk/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/AbstractTestBase.java
Modified: webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/action/SignatureConfirmationAction.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/action/SignatureConfirmationAction.java?rev=1686237&r1=1686236&r2=1686237&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/action/SignatureConfirmationAction.java (original)
+++ webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/action/SignatureConfirmationAction.java Thu Jun 18 14:37:19 2015
@@ -73,11 +73,13 @@ public class SignatureConfirmationAction
List<WSSecurityEngineResult> resultList = wshResult.getResults();
for (WSSecurityEngineResult result : resultList) {
- int resultAction = (Integer) result.get(WSSecurityEngineResult.TAG_ACTION);
+ Integer resultAction = (Integer) result.get(WSSecurityEngineResult.TAG_ACTION);
// See if it's a signature action
- if (WSConstants.SIGN == resultAction || WSConstants.ST_SIGNED == resultAction
- || WSConstants.UT_SIGN == resultAction) {
+ if (resultAction != null
+ && (WSConstants.SIGN == resultAction.intValue()
+ || WSConstants.ST_SIGNED == resultAction.intValue()
+ || WSConstants.UT_SIGN == resultAction.intValue())) {
byte[] sigVal = (byte[]) result.get(WSSecurityEngineResult.TAG_SIGNATURE_VALUE);
wsc.build(doc, sigVal, reqData.getSecHeader());
signatureParts.add(new WSEncryptionPart(wsc.getId()));
Modified: webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/action/SignatureDerivedAction.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/action/SignatureDerivedAction.java?rev=1686237&r1=1686236&r2=1686237&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/action/SignatureDerivedAction.java (original)
+++ webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/action/SignatureDerivedAction.java Thu Jun 18 14:37:19 2015
@@ -162,7 +162,7 @@ public class SignatureDerivedAction exte
key = passwordCallback.getKey();
} else if (signatureToken.getKey() != null) {
key = signatureToken.getKey();
- } else {
+ } else if (signatureToken.getCrypto() != null) {
Crypto crypto = signatureToken.getCrypto();
key = crypto.getPrivateKey(signatureToken.getUser(), passwordCallback.getPassword()).getEncoded();
}
Modified: webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/handler/WSHandler.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/handler/WSHandler.java?rev=1686237&r1=1686236&r2=1686237&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/handler/WSHandler.java (original)
+++ webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/handler/WSHandler.java Thu Jun 18 14:37:19 2015
@@ -351,13 +351,15 @@ public abstract class WSHandler {
int ai = 0;
for (WSSecurityEngineResult result : wsResult) {
final Integer actInt = (Integer) result.get(WSSecurityEngineResult.TAG_ACTION);
- int act = actInt;
- if (act == WSConstants.SC || act == WSConstants.BST) {
- continue;
- }
-
- if (ai >= size || actions.get(ai++) != act) {
- return false;
+ if (actInt != null) {
+ int act = actInt;
+ if (act == WSConstants.SC || act == WSConstants.BST) {
+ continue;
+ }
+
+ if (ai >= size || actions.get(ai++) != act) {
+ return false;
+ }
}
}
@@ -378,18 +380,20 @@ public abstract class WSHandler {
for (WSSecurityEngineResult result : wsResult) {
final Integer actInt = (Integer) result.get(WSSecurityEngineResult.TAG_ACTION);
- int act = actInt;
- if (act == WSConstants.SC || act == WSConstants.BST) {
- continue;
- } else if (act == WSConstants.ENCR
- && (result.get(WSSecurityEngineResult.TAG_DATA_REF_URIS) == null
- || ((List<?>)result.get(WSSecurityEngineResult.TAG_DATA_REF_URIS)).isEmpty())) {
- continue;
- }
+ if (actInt != null) {
+ int act = actInt;
+ if (act == WSConstants.SC || act == WSConstants.BST) {
+ continue;
+ } else if (act == WSConstants.ENCR
+ && (result.get(WSSecurityEngineResult.TAG_DATA_REF_URIS) == null
+ || ((List<?>)result.get(WSSecurityEngineResult.TAG_DATA_REF_URIS)).isEmpty())) {
+ continue;
+ }
+
-
- if (!recordedActions.remove(actInt)) {
- return false;
+ if (!recordedActions.remove(actInt)) {
+ return false;
+ }
}
}
@@ -434,21 +438,20 @@ public abstract class WSHandler {
WSSecurityEngineResult.TAG_SIGNATURE_CONFIRMATION
);
- byte[] sigVal = sc.getSignatureValue();
- if (sigVal != null) {
+ if (sc != null && sc.getSignatureValue() != null) {
if (savedSignatures == null || savedSignatures.size() == 0) {
//
// If there are no stored signature values, and we've received a
// SignatureConfirmation element then throw an Exception
//
- if (sigVal.length != 0) {
+ if (sc.getSignatureValue().length != 0) {
throw new WSSecurityException(WSSecurityException.ErrorCode.INVALID_SECURITY, "empty",
new Object[] {"Received a SignatureConfirmation element, but there are no stored"
+ " signature values"}
);
}
} else {
- Integer hash = Arrays.hashCode(sigVal);
+ Integer hash = Arrays.hashCode(sc.getSignatureValue());
if (savedSignatures.contains(hash)) {
savedSignatures.remove(hash);
} else {
@@ -1260,9 +1263,8 @@ public abstract class WSHandler {
* encryption action :-).
*/
for (WSSecurityEngineResult wser : wsSecEngineResults) {
- int wserAction =
- (Integer) wser.get(WSSecurityEngineResult.TAG_ACTION);
- if (wserAction == WSConstants.SIGN) {
+ Integer wserAction = (Integer) wser.get(WSSecurityEngineResult.TAG_ACTION);
+ if (wserAction != null && wserAction.intValue() == WSConstants.SIGN) {
X509Certificate cert =
(X509Certificate)wser.get(WSSecurityEngineResult.TAG_X509_CERTIFICATE);
actionToken.setCertificate(cert);
Modified: webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/WSSecSignatureBase.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/WSSecSignatureBase.java?rev=1686237&r1=1686236&r2=1686237&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/WSSecSignatureBase.java (original)
+++ webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/WSSecSignatureBase.java Thu Jun 18 14:37:19 2015
@@ -239,33 +239,35 @@ public class WSSecSignatureBase extends
}
List<javax.xml.crypto.dsig.Reference> attachmentReferenceList = new ArrayList<>();
- for (Attachment attachment : attachmentRequestCallback.getAttachments()) {
- try {
- List<Transform> transforms = new ArrayList<>();
-
- AttachmentTransformParameterSpec attachmentTransformParameterSpec =
- new AttachmentTransformParameterSpec(
- attachmentCallbackHandler, attachment
- );
-
- String attachmentSignatureTransform = WSConstants.SWA_ATTACHMENT_CONTENT_SIG_TRANS;
- if ("Element".equals(encPart.getEncModifier())) {
- attachmentSignatureTransform = WSConstants.SWA_ATTACHMENT_COMPLETE_SIG_TRANS;
+ if (attachmentRequestCallback.getAttachments() != null) {
+ for (Attachment attachment : attachmentRequestCallback.getAttachments()) {
+ try {
+ List<Transform> transforms = new ArrayList<>();
+
+ AttachmentTransformParameterSpec attachmentTransformParameterSpec =
+ new AttachmentTransformParameterSpec(
+ attachmentCallbackHandler, attachment
+ );
+
+ String attachmentSignatureTransform = WSConstants.SWA_ATTACHMENT_CONTENT_SIG_TRANS;
+ if ("Element".equals(encPart.getEncModifier())) {
+ attachmentSignatureTransform = WSConstants.SWA_ATTACHMENT_COMPLETE_SIG_TRANS;
+ }
+
+ transforms.add(
+ signatureFactory.newTransform(
+ attachmentSignatureTransform, attachmentTransformParameterSpec)
+ );
+
+ javax.xml.crypto.dsig.Reference reference =
+ signatureFactory.newReference(
+ "cid:" + attachment.getId(), digestMethod, transforms, null, null
+ );
+
+ attachmentReferenceList.add(reference);
+ } catch (InvalidAlgorithmParameterException | NoSuchAlgorithmException e) {
+ throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, e);
}
-
- transforms.add(
- signatureFactory.newTransform(
- attachmentSignatureTransform, attachmentTransformParameterSpec)
- );
-
- javax.xml.crypto.dsig.Reference reference =
- signatureFactory.newReference(
- "cid:" + attachment.getId(), digestMethod, transforms, null, null
- );
-
- attachmentReferenceList.add(reference);
- } catch (InvalidAlgorithmParameterException | NoSuchAlgorithmException e) {
- throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, e);
}
}
Modified: webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/token/DerivedKeyToken.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/token/DerivedKeyToken.java?rev=1686237&r1=1686236&r2=1686237&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/token/DerivedKeyToken.java (original)
+++ webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/token/DerivedKeyToken.java Thu Jun 18 14:37:19 2015
@@ -257,7 +257,9 @@ public class DerivedKeyToken {
XMLUtils.findElement(elementProperties, propertyName, ns);
if (node != null) { //If the node is not null
Text node1 = getFirstNode(node);
- node1.setData(properties.get(propertyName));
+ if (node1 != null) {
+ node1.setData(properties.get(propertyName));
+ }
} else {
addProperty(propertyName, properties.get(propertyName));
}
@@ -272,7 +274,9 @@ public class DerivedKeyToken {
while (node != null) {
if (Node.ELEMENT_NODE == node.getNodeType()) {
Text text = getFirstNode((Element) node);
- table.put(node.getNodeName(), text.getData());
+ if (text != null) {
+ table.put(node.getNodeName(), text.getData());
+ }
}
node = node.getNextSibling();
}
@@ -299,7 +303,10 @@ public class DerivedKeyToken {
public int getLength() {
if (elementLength != null) {
- return Integer.parseInt(getFirstNode(elementLength).getData());
+ Text text = getFirstNode(elementLength);
+ if (text != null) {
+ return Integer.parseInt(text.getData());
+ }
}
return 32;
}
@@ -328,7 +335,10 @@ public class DerivedKeyToken {
public int getOffset() {
if (elementOffset != null) {
- return Integer.parseInt(getFirstNode(elementOffset).getData());
+ Text text = getFirstNode(elementOffset);
+ if (text != null) {
+ return Integer.parseInt(text.getData());
+ }
}
return 0;
}
@@ -356,7 +366,10 @@ public class DerivedKeyToken {
public int getGeneration() {
if (elementGeneration != null) {
- return Integer.parseInt(getFirstNode(elementGeneration).getData());
+ Text text = getFirstNode(elementGeneration);
+ if (text != null) {
+ return Integer.parseInt(text.getData());
+ }
}
return -1;
}
@@ -396,7 +409,10 @@ public class DerivedKeyToken {
*/
public String getLabel() {
if (elementLabel != null) {
- return getFirstNode(elementLabel).getData();
+ Text text = getFirstNode(elementLabel);
+ if (text != null) {
+ return text.getData();
+ }
}
return null;
}
@@ -408,7 +424,10 @@ public class DerivedKeyToken {
*/
public String getNonce() {
if (elementNonce != null) {
- return getFirstNode(elementNonce).getData();
+ Text text = getFirstNode(elementNonce);
+ if (text != null) {
+ return text.getData();
+ }
}
return null;
}
@@ -471,7 +490,7 @@ public class DerivedKeyToken {
*/
public String getAlgorithm() {
String algo = element.getAttributeNS(ns, "Algorithm");
- if (algo == null || algo.equals("")) {
+ if ("".equals(algo)) {
return ConversationConstants.DerivationAlgorithm.P_SHA_1;
} else {
return algo;
@@ -491,10 +510,10 @@ public class DerivedKeyToken {
String basetokenId = null;
SecurityTokenReference securityTokenReference = getSecurityTokenReference();
- if (securityTokenReference.containsReference()) {
+ if (securityTokenReference != null && securityTokenReference.getReference() != null) {
basetokenId = securityTokenReference.getReference().getURI();
basetokenId = XMLUtils.getIDFromReference(basetokenId);
- } else {
+ } else if (securityTokenReference != null) {
// KeyIdentifier
basetokenId = securityTokenReference.getKeyIdentifierValue();
}
@@ -606,7 +625,9 @@ public class DerivedKeyToken {
return false;
}
try {
- if (!getSecurityTokenReference().equals(token.getSecurityTokenReference())) {
+ if (getSecurityTokenReference() != null
+ && !getSecurityTokenReference().equals(token.getSecurityTokenReference())
+ || getSecurityTokenReference() == null && token.getSecurityTokenReference() != null) {
return false;
}
} catch (WSSecurityException e) {
Modified: webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/token/SecurityContextToken.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/token/SecurityContextToken.java?rev=1686237&r1=1686236&r2=1686237&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/token/SecurityContextToken.java (original)
+++ webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/token/SecurityContextToken.java Thu Jun 18 14:37:19 2015
@@ -167,7 +167,10 @@ public class SecurityContextToken {
*/
public String getIdentifier() {
if (elementIdentifier != null) {
- return getFirstNode(elementIdentifier).getData();
+ Text text = getFirstNode(elementIdentifier);
+ if (text != null) {
+ return text.getData();
+ }
}
return null;
}
Modified: webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/str/DerivedKeyTokenSTRParser.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/str/DerivedKeyTokenSTRParser.java?rev=1686237&r1=1686236&r2=1686237&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/str/DerivedKeyTokenSTRParser.java (original)
+++ webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/str/DerivedKeyTokenSTRParser.java Thu Jun 18 14:37:19 2015
@@ -64,7 +64,7 @@ public class DerivedKeyTokenSTRParser im
new SecurityTokenReference(parameters.getStrElement(), parameters.getData().getBSPEnforcer());
String uri = null;
- if (secRef.containsReference()) {
+ if (secRef.getReference() != null) {
uri = secRef.getReference().getURI();
uri = XMLUtils.getIDFromReference(uri);
} else if (secRef.containsKeyIdentifier()) {
@@ -90,19 +90,21 @@ public class DerivedKeyTokenSTRParser im
STRParserResult parserResult = new STRParserResult();
RequestData data = parameters.getData();
- int action = ((Integer)result.get(WSSecurityEngineResult.TAG_ACTION));
- if (WSConstants.UT_NOPASSWORD == action || WSConstants.UT == action) {
+ Integer action = ((Integer)result.get(WSSecurityEngineResult.TAG_ACTION));
+ if (action != null
+ && (WSConstants.UT_NOPASSWORD == action.intValue() || WSConstants.UT == action.intValue())) {
STRParserUtil.checkUsernameTokenBSPCompliance(secRef, data.getBSPEnforcer());
byte[] secretKey = (byte[])result.get(WSSecurityEngineResult.TAG_SECRET);
parserResult.setSecretKey(secretKey);
- } else if (WSConstants.ENCR == action) {
+ } else if (action != null && WSConstants.ENCR == action.intValue()) {
STRParserUtil.checkEncryptedKeyBSPCompliance(secRef, data.getBSPEnforcer());
byte[] secretKey = (byte[])result.get(WSSecurityEngineResult.TAG_SECRET);
parserResult.setSecretKey(secretKey);
- } else if (WSConstants.SCT == action || WSConstants.BST == action) {
+ } else if (action != null && (WSConstants.SCT == action.intValue() || WSConstants.BST == action.intValue())) {
byte[] secretKey = (byte[])result.get(WSSecurityEngineResult.TAG_SECRET);
parserResult.setSecretKey(secretKey);
- } else if (WSConstants.ST_UNSIGNED == action || WSConstants.ST_SIGNED == action) {
+ } else if (action != null
+ && (WSConstants.ST_UNSIGNED == action.intValue() || WSConstants.ST_SIGNED == action.intValue())) {
SamlAssertionWrapper samlAssertion =
(SamlAssertionWrapper)result.get(WSSecurityEngineResult.TAG_SAML_ASSERTION);
STRParserUtil.checkSamlTokenBSPCompliance(secRef, samlAssertion, data.getBSPEnforcer());
@@ -171,7 +173,7 @@ public class DerivedKeyTokenSTRParser im
}
parserResult.setSecretKey(secretKey);
} else {
- if (keyIdentifierValueType.equals(SecurityTokenReference.ENC_KEY_SHA1_URI)) {
+ if (SecurityTokenReference.ENC_KEY_SHA1_URI.equals(keyIdentifierValueType)) {
STRParserUtil.checkEncryptedKeyBSPCompliance(secRef, data.getBSPEnforcer());
}
Crypto crypto = data.getDecCrypto();
Modified: webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/str/EncryptedKeySTRParser.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/str/EncryptedKeySTRParser.java?rev=1686237&r1=1686236&r2=1686237&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/str/EncryptedKeySTRParser.java (original)
+++ webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/str/EncryptedKeySTRParser.java Thu Jun 18 14:37:19 2015
@@ -66,7 +66,7 @@ public class EncryptedKeySTRParser imple
new SecurityTokenReference(parameters.getStrElement(), parameters.getData().getBSPEnforcer());
String uri = null;
- if (secRef.containsReference()) {
+ if (secRef.getReference() != null) {
uri = secRef.getReference().getURI();
uri = XMLUtils.getIDFromReference(uri);
} else if (secRef.containsKeyIdentifier()) {
@@ -92,8 +92,8 @@ public class EncryptedKeySTRParser imple
STRParserResult parserResult = new STRParserResult();
RequestData data = parameters.getData();
- int action = (Integer) result.get(WSSecurityEngineResult.TAG_ACTION);
- if (WSConstants.BST == action) {
+ Integer action = (Integer) result.get(WSSecurityEngineResult.TAG_ACTION);
+ if (action != null && WSConstants.BST == action.intValue()) {
BinarySecurity token =
(BinarySecurity)result.get(
WSSecurityEngineResult.TAG_BINARY_SECURITY_TOKEN
@@ -104,7 +104,8 @@ public class EncryptedKeySTRParser imple
WSSecurityEngineResult.TAG_X509_CERTIFICATES
);
parserResult.setCerts(certs);
- } else if (WSConstants.ST_UNSIGNED == action || WSConstants.ST_SIGNED == action) {
+ } else if (action != null
+ && (WSConstants.ST_UNSIGNED == action.intValue() || WSConstants.ST_SIGNED == action.intValue())) {
SamlAssertionWrapper samlAssertion =
(SamlAssertionWrapper)result.get(WSSecurityEngineResult.TAG_SAML_ASSERTION);
STRParserUtil.checkSamlTokenBSPCompliance(secRef, samlAssertion, data.getBSPEnforcer());
Modified: webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/str/SecurityTokenRefSTRParser.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/str/SecurityTokenRefSTRParser.java?rev=1686237&r1=1686236&r2=1686237&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/str/SecurityTokenRefSTRParser.java (original)
+++ webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/str/SecurityTokenRefSTRParser.java Thu Jun 18 14:37:19 2015
@@ -71,7 +71,7 @@ public class SecurityTokenRefSTRParser i
new SecurityTokenReference(parameters.getStrElement(), parameters.getData().getBSPEnforcer());
String uri = null;
- if (secRef.containsReference()) {
+ if (secRef.getReference() != null) {
uri = secRef.getReference().getURI();
uri = XMLUtils.getIDFromReference(uri);
} else if (secRef.containsKeyIdentifier()) {
@@ -120,12 +120,12 @@ public class SecurityTokenRefSTRParser i
STRParserResult parserResult = new STRParserResult();
RequestData data = parameters.getData();
- int action = (Integer) result.get(WSSecurityEngineResult.TAG_ACTION);
- if (WSConstants.ENCR == action) {
+ Integer action = (Integer) result.get(WSSecurityEngineResult.TAG_ACTION);
+ if (action != null && WSConstants.ENCR == action.intValue()) {
STRParserUtil.checkEncryptedKeyBSPCompliance(secRef, data.getBSPEnforcer());
byte[] secretKey = (byte[])result.get(WSSecurityEngineResult.TAG_SECRET);
parserResult.setSecretKey(secretKey);
- } else if (WSConstants.DKT == action) {
+ } else if (action != null && WSConstants.DKT == action.intValue()) {
DerivedKeyToken dkt =
(DerivedKeyToken)result.get(WSSecurityEngineResult.TAG_DERIVED_KEY_TOKEN);
byte[] secret =
@@ -133,16 +133,19 @@ public class SecurityTokenRefSTRParser i
byte[] secretKey = dkt.deriveKey(parameters.getDerivationKeyLength(), secret);
parserResult.setSecretKey(secretKey);
parserResult.setPrincipal(dkt.createPrincipal());
- } else if (WSConstants.ST_UNSIGNED == action || WSConstants.ST_SIGNED == action) {
+ } else if (action != null
+ && (WSConstants.ST_UNSIGNED == action.intValue() || WSConstants.ST_SIGNED == action.intValue())) {
SamlAssertionWrapper samlAssertion =
(SamlAssertionWrapper)result.get(WSSecurityEngineResult.TAG_SAML_ASSERTION);
byte[] secretKey =
getSecretKeyFromAssertion(samlAssertion, secRef, data, parameters.getWsDocInfo());
parserResult.setSecretKey(secretKey);
- } else if (WSConstants.SCT == action || WSConstants.BST == action) {
+ } else if (action != null
+ && (WSConstants.SCT == action.intValue() || WSConstants.BST == action.intValue())) {
byte[] secretKey = (byte[])result.get(WSSecurityEngineResult.TAG_SECRET);
parserResult.setSecretKey(secretKey);
- } else if (WSConstants.UT_NOPASSWORD == action || WSConstants.UT == action) {
+ } else if (action != null
+ && (WSConstants.UT_NOPASSWORD == action.intValue() || WSConstants.UT == action.intValue())) {
STRParserUtil.checkUsernameTokenBSPCompliance(secRef, data.getBSPEnforcer());
UsernameToken usernameToken =
(UsernameToken)result.get(WSSecurityEngineResult.TAG_USERNAME_TOKEN);
Modified: webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/str/SignatureSTRParser.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/str/SignatureSTRParser.java?rev=1686237&r1=1686236&r2=1686237&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/str/SignatureSTRParser.java (original)
+++ webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/str/SignatureSTRParser.java Thu Jun 18 14:37:19 2015
@@ -86,7 +86,7 @@ public class SignatureSTRParser implemen
// detected BST that may be used later during dereferencing.
//
String uri = null;
- if (secRef.containsReference()) {
+ if (secRef.getReference() != null) {
uri = secRef.getReference().getURI();
uri = XMLUtils.getIDFromReference(uri);
} else if (secRef.containsKeyIdentifier()) {
@@ -257,8 +257,9 @@ public class SignatureSTRParser implemen
STRParserResult parserResult = new STRParserResult();
RequestData data = parameters.getData();
- int action = (Integer) result.get(WSSecurityEngineResult.TAG_ACTION);
- if (WSConstants.UT_NOPASSWORD == action || WSConstants.UT == action) {
+ Integer action = (Integer) result.get(WSSecurityEngineResult.TAG_ACTION);
+ if (action != null
+ && (WSConstants.UT_NOPASSWORD == action.intValue() || WSConstants.UT == action.intValue())) {
STRParserUtil.checkUsernameTokenBSPCompliance(secRef, data.getBSPEnforcer());
UsernameToken usernameToken =
@@ -268,7 +269,7 @@ public class SignatureSTRParser implemen
parserResult.setSecretKey((byte[])result.get(WSSecurityEngineResult.TAG_SECRET));
parserResult.setPrincipal(usernameToken.createPrincipal());
- } else if (WSConstants.BST == action) {
+ } else if (action != null && WSConstants.BST == action.intValue()) {
BinarySecurity token =
(BinarySecurity)result.get(
WSSecurityEngineResult.TAG_BINARY_SECURITY_TOKEN
@@ -283,20 +284,20 @@ public class SignatureSTRParser implemen
if (validatedToken) {
parserResult.setTrustedCredential(true);
}
- } else if (WSConstants.ENCR == action) {
+ } else if (action != null && WSConstants.ENCR == action.intValue()) {
STRParserUtil.checkEncryptedKeyBSPCompliance(secRef, data.getBSPEnforcer());
parserResult.setSecretKey((byte[])result.get(WSSecurityEngineResult.TAG_SECRET));
String id = (String)result.get(WSSecurityEngineResult.TAG_ID);
parserResult.setPrincipal(new CustomTokenPrincipal(id));
- } else if (WSConstants.SCT == action) {
+ } else if (action != null && WSConstants.SCT == action.intValue()) {
parserResult.setSecretKey((byte[])result.get(WSSecurityEngineResult.TAG_SECRET));
SecurityContextToken sct =
(SecurityContextToken)result.get(
WSSecurityEngineResult.TAG_SECURITY_CONTEXT_TOKEN
);
parserResult.setPrincipal(new CustomTokenPrincipal(sct.getIdentifier()));
- } else if (WSConstants.DKT == action) {
+ } else if (action != null && WSConstants.DKT == action.intValue()) {
DerivedKeyToken dkt =
(DerivedKeyToken)result.get(WSSecurityEngineResult.TAG_DERIVED_KEY_TOKEN);
int keyLength = dkt.getLength();
@@ -308,7 +309,8 @@ public class SignatureSTRParser implemen
((WSDerivedKeyTokenPrincipal)principal).setSecret(secret);
parserResult.setPrincipal(principal);
parserResult.setSecretKey(dkt.deriveKey(keyLength, secret));
- } else if (WSConstants.ST_UNSIGNED == action || WSConstants.ST_SIGNED == action) {
+ } else if (action != null
+ && (WSConstants.ST_UNSIGNED == action.intValue() || WSConstants.ST_SIGNED == action.intValue())) {
SamlAssertionWrapper samlAssertion =
(SamlAssertionWrapper)result.get(WSSecurityEngineResult.TAG_SAML_ASSERTION);
STRParserUtil.checkSamlTokenBSPCompliance(secRef, samlAssertion, data.getBSPEnforcer());
Modified: webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/ConfigurationConverter.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/ConfigurationConverter.java?rev=1686237&r1=1686236&r2=1686237&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/ConfigurationConverter.java (original)
+++ webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/ConfigurationConverter.java Thu Jun 18 14:37:19 2015
@@ -295,7 +295,9 @@ public final class ConfigurationConverte
} else {
crypto = properties.getEncryptionCrypto();
}
- return crypto.getDefaultX509Identifier();
+ if (crypto != null) {
+ return crypto.getDefaultX509Identifier();
+ }
} catch (WSSecurityException e) {
LOG.debug(e.getMessage(), e);
}
Modified: webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/output/EncryptOutputProcessor.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/output/EncryptOutputProcessor.java?rev=1686237&r1=1686236&r2=1686237&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/output/EncryptOutputProcessor.java (original)
+++ webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/output/EncryptOutputProcessor.java Thu Jun 18 14:37:19 2015
@@ -224,67 +224,69 @@ public class EncryptOutputProcessor exte
}
List<Attachment> attachments = attachmentRequestCallback.getAttachments();
- for (int i = 0; i < attachments.size(); i++) {
- final Attachment attachment = attachments.get(i);
- final String attachmentId = attachment.getId();
-
- String tokenId = outputProcessorChain.getSecurityContext().get(WSSConstants.PROP_USE_THIS_TOKEN_ID_FOR_ENCRYPTION);
- SecurityTokenProvider<OutboundSecurityToken> securityTokenProvider =
- outputProcessorChain.getSecurityContext().getSecurityTokenProvider(tokenId);
- OutboundSecurityToken securityToken = securityTokenProvider.getSecurityToken();
- EncryptionPartDef encryptionPartDef = new EncryptionPartDef();
- encryptionPartDef.setSecurePart(attachmentSecurePart);
- encryptionPartDef.setModifier(attachmentSecurePart.getModifier());
- encryptionPartDef.setCipherReferenceId(attachment.getId());
- encryptionPartDef.setMimeType(attachment.getMimeType());
- encryptionPartDef.setEncRefId(IDGenerator.generateID(null));
- encryptionPartDef.setKeyId(securityTokenProvider.getId());
- encryptionPartDef.setSymmetricKey(securityToken.getSecretKey(getSecurityProperties().getEncryptionSymAlgorithm()));
- outputProcessorChain.getSecurityContext().putAsList(EncryptionPartDef.class, encryptionPartDef);
-
- final Attachment resultAttachment = new Attachment();
- resultAttachment.setId(attachmentId);
- resultAttachment.setMimeType("application/octet-stream");
-
- String encryptionSymAlgorithm = getSecurityProperties().getEncryptionSymAlgorithm();
- String jceAlgorithm = JCEAlgorithmMapper.translateURItoJCEID(encryptionSymAlgorithm);
- if (jceAlgorithm == null) {
- throw new XMLSecurityException("algorithms.NoSuchMap", encryptionSymAlgorithm);
- }
- //initialize the cipher
- Cipher cipher = null;
- try {
- cipher = Cipher.getInstance(jceAlgorithm);
-
- // The Spec mandates a 96-bit IV for GCM algorithms
- if ("AES/GCM/NoPadding".equals(cipher.getAlgorithm())) {
- byte[] temp = XMLSecurityConstants.generateBytes(12);
- IvParameterSpec ivParameterSpec = new IvParameterSpec(temp);
- cipher.init(Cipher.ENCRYPT_MODE, encryptionPartDef.getSymmetricKey(), ivParameterSpec);
- } else {
- cipher.init(Cipher.ENCRYPT_MODE, encryptionPartDef.getSymmetricKey());
+ if (attachments != null) {
+ for (int i = 0; i < attachments.size(); i++) {
+ final Attachment attachment = attachments.get(i);
+ final String attachmentId = attachment.getId();
+
+ String tokenId = outputProcessorChain.getSecurityContext().get(WSSConstants.PROP_USE_THIS_TOKEN_ID_FOR_ENCRYPTION);
+ SecurityTokenProvider<OutboundSecurityToken> securityTokenProvider =
+ outputProcessorChain.getSecurityContext().getSecurityTokenProvider(tokenId);
+ OutboundSecurityToken securityToken = securityTokenProvider.getSecurityToken();
+ EncryptionPartDef encryptionPartDef = new EncryptionPartDef();
+ encryptionPartDef.setSecurePart(attachmentSecurePart);
+ encryptionPartDef.setModifier(attachmentSecurePart.getModifier());
+ encryptionPartDef.setCipherReferenceId(attachment.getId());
+ encryptionPartDef.setMimeType(attachment.getMimeType());
+ encryptionPartDef.setEncRefId(IDGenerator.generateID(null));
+ encryptionPartDef.setKeyId(securityTokenProvider.getId());
+ encryptionPartDef.setSymmetricKey(securityToken.getSecretKey(getSecurityProperties().getEncryptionSymAlgorithm()));
+ outputProcessorChain.getSecurityContext().putAsList(EncryptionPartDef.class, encryptionPartDef);
+
+ final Attachment resultAttachment = new Attachment();
+ resultAttachment.setId(attachmentId);
+ resultAttachment.setMimeType("application/octet-stream");
+
+ String encryptionSymAlgorithm = getSecurityProperties().getEncryptionSymAlgorithm();
+ String jceAlgorithm = JCEAlgorithmMapper.translateURItoJCEID(encryptionSymAlgorithm);
+ if (jceAlgorithm == null) {
+ throw new XMLSecurityException("algorithms.NoSuchMap", encryptionSymAlgorithm);
+ }
+ //initialize the cipher
+ Cipher cipher = null;
+ try {
+ cipher = Cipher.getInstance(jceAlgorithm);
+
+ // The Spec mandates a 96-bit IV for GCM algorithms
+ if ("AES/GCM/NoPadding".equals(cipher.getAlgorithm())) {
+ byte[] temp = XMLSecurityConstants.generateBytes(12);
+ IvParameterSpec ivParameterSpec = new IvParameterSpec(temp);
+ cipher.init(Cipher.ENCRYPT_MODE, encryptionPartDef.getSymmetricKey(), ivParameterSpec);
+ } else {
+ cipher.init(Cipher.ENCRYPT_MODE, encryptionPartDef.getSymmetricKey());
+ }
+ } catch (Exception e) {
+ throw new WSSecurityException(WSSecurityException.ErrorCode.FAILED_ENCRYPTION, e);
+ }
+
+ final Map<String, String> headers = new HashMap<>();
+ headers.putAll(attachment.getHeaders());
+ resultAttachment.setSourceStream(
+ AttachmentUtils.setupAttachmentEncryptionStream(
+ cipher,
+ SecurePart.Modifier.Element == encryptionPartDef.getModifier(),
+ attachment, headers
+ ));
+ resultAttachment.addHeaders(headers);
+
+ final AttachmentResultCallback attachmentResultCallback = new AttachmentResultCallback();
+ attachmentResultCallback.setAttachmentId(attachmentId);
+ attachmentResultCallback.setAttachment(resultAttachment);
+ try {
+ attachmentCallbackHandler.handle(new Callback[]{attachmentResultCallback});
+ } catch (Exception e) {
+ throw new WSSecurityException(WSSecurityException.ErrorCode.FAILED_ENCRYPTION, e);
}
- } catch (Exception e) {
- throw new WSSecurityException(WSSecurityException.ErrorCode.FAILED_ENCRYPTION, e);
- }
-
- final Map<String, String> headers = new HashMap<>();
- headers.putAll(attachment.getHeaders());
- resultAttachment.setSourceStream(
- AttachmentUtils.setupAttachmentEncryptionStream(
- cipher,
- SecurePart.Modifier.Element == encryptionPartDef.getModifier(),
- attachment, headers
- ));
- resultAttachment.addHeaders(headers);
-
- final AttachmentResultCallback attachmentResultCallback = new AttachmentResultCallback();
- attachmentResultCallback.setAttachmentId(attachmentId);
- attachmentResultCallback.setAttachment(resultAttachment);
- try {
- attachmentCallbackHandler.handle(new Callback[]{attachmentResultCallback});
- } catch (Exception e) {
- throw new WSSecurityException(WSSecurityException.ErrorCode.FAILED_ENCRYPTION, e);
}
}
}
Modified: webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/output/WSSSignatureOutputProcessor.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/output/WSSSignatureOutputProcessor.java?rev=1686237&r1=1686236&r2=1686237&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/output/WSSSignatureOutputProcessor.java (original)
+++ webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/output/WSSSignatureOutputProcessor.java Thu Jun 18 14:37:19 2015
@@ -171,76 +171,78 @@ public class WSSSignatureOutputProcessor
);
}
List<Attachment> attachments = attachmentRequestCallback.getAttachments();
- for (int i = 0; i < attachments.size(); i++) {
- final Attachment attachment = attachments.get(i);
-
- SignaturePartDef signaturePartDef = new SignaturePartDef();
- signaturePartDef.setSecurePart(securePart);
- signaturePartDef.setSigRefId("cid:" + attachment.getId());
- signaturePartDef.setExternalResource(true);
- signaturePartDef.setTransforms(securePart.getTransforms());
- if (signaturePartDef.getTransforms() == null) {
- if (securePart.getModifier() == SecurePart.Modifier.Element) {
- signaturePartDef.setTransforms(new String[]{WSSConstants.SWA_ATTACHMENT_COMPLETE_SIG_TRANS});
- } else {
- signaturePartDef.setTransforms(new String[]{WSSConstants.SWA_ATTACHMENT_CONTENT_SIG_TRANS});
+ if (attachments != null) {
+ for (int i = 0; i < attachments.size(); i++) {
+ final Attachment attachment = attachments.get(i);
+
+ SignaturePartDef signaturePartDef = new SignaturePartDef();
+ signaturePartDef.setSecurePart(securePart);
+ signaturePartDef.setSigRefId("cid:" + attachment.getId());
+ signaturePartDef.setExternalResource(true);
+ signaturePartDef.setTransforms(securePart.getTransforms());
+ if (signaturePartDef.getTransforms() == null) {
+ if (securePart.getModifier() == SecurePart.Modifier.Element) {
+ signaturePartDef.setTransforms(new String[]{WSSConstants.SWA_ATTACHMENT_COMPLETE_SIG_TRANS});
+ } else {
+ signaturePartDef.setTransforms(new String[]{WSSConstants.SWA_ATTACHMENT_CONTENT_SIG_TRANS});
+ }
}
+ signaturePartDef.setExcludeVisibleC14Nprefixes(true);
+ signaturePartDef.setDigestAlgo(securePart.getDigestMethod());
+ if (signaturePartDef.getDigestAlgo() == null) {
+ signaturePartDef.setDigestAlgo(getSecurityProperties().getSignatureDigestAlgorithm());
+ }
+
+ DigestOutputStream digestOutputStream = createMessageDigestOutputStream(signaturePartDef.getDigestAlgo());
+ InputStream inputStream = attachment.getSourceStream();
+ if (!inputStream.markSupported()) {
+ inputStream = new BufferedInputStream(inputStream);
+ }
+ inputStream.mark(Integer.MAX_VALUE); //we can process at maximum 2G with the standard jdk streams
+
+ try {
+ Transformer transformer = buildTransformerChain(digestOutputStream, signaturePartDef, null);
+
+ Map<String, Object> transformerProperties = new HashMap<>(2);
+ transformerProperties.put(
+ AttachmentContentSignatureTransform.ATTACHMENT, attachment);
+ transformer.setProperties(transformerProperties);
+ transformer.transform(inputStream);
+ transformer.doFinal();
+
+ digestOutputStream.close();
+
+ //reset the inputStream to be able to reuse it
+ inputStream.reset();
+ } catch (IOException | XMLStreamException e) {
+ throw new WSSecurityException(WSSecurityException.ErrorCode.FAILED_SIGNATURE, e);
+ }
+
+ String calculatedDigest = Base64.encode(digestOutputStream.getDigestValue());
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Calculated Digest: " + calculatedDigest);
+ }
+
+ signaturePartDef.setDigestValue(calculatedDigest);
+
+ //create a new attachment and do the result callback
+ Attachment resultAttachment = new Attachment();
+ resultAttachment.setId(attachment.getId());
+ resultAttachment.setMimeType(attachment.getMimeType());
+ resultAttachment.addHeaders(attachment.getHeaders());
+ resultAttachment.setSourceStream(inputStream);
+
+ AttachmentResultCallback attachmentResultCallback = new AttachmentResultCallback();
+ attachmentResultCallback.setAttachmentId(resultAttachment.getId());
+ attachmentResultCallback.setAttachment(resultAttachment);
+ try {
+ attachmentCallbackHandler.handle(new Callback[]{attachmentResultCallback});
+ } catch (Exception e) {
+ throw new WSSecurityException(WSSecurityException.ErrorCode.FAILED_SIGNATURE, e);
+ }
+
+ getSignaturePartDefList().add(signaturePartDef);
}
- signaturePartDef.setExcludeVisibleC14Nprefixes(true);
- signaturePartDef.setDigestAlgo(securePart.getDigestMethod());
- if (signaturePartDef.getDigestAlgo() == null) {
- signaturePartDef.setDigestAlgo(getSecurityProperties().getSignatureDigestAlgorithm());
- }
-
- DigestOutputStream digestOutputStream = createMessageDigestOutputStream(signaturePartDef.getDigestAlgo());
- InputStream inputStream = attachment.getSourceStream();
- if (!inputStream.markSupported()) {
- inputStream = new BufferedInputStream(inputStream);
- }
- inputStream.mark(Integer.MAX_VALUE); //we can process at maximum 2G with the standard jdk streams
-
- try {
- Transformer transformer = buildTransformerChain(digestOutputStream, signaturePartDef, null);
-
- Map<String, Object> transformerProperties = new HashMap<>(2);
- transformerProperties.put(
- AttachmentContentSignatureTransform.ATTACHMENT, attachment);
- transformer.setProperties(transformerProperties);
- transformer.transform(inputStream);
- transformer.doFinal();
-
- digestOutputStream.close();
-
- //reset the inputStream to be able to reuse it
- inputStream.reset();
- } catch (IOException | XMLStreamException e) {
- throw new WSSecurityException(WSSecurityException.ErrorCode.FAILED_SIGNATURE, e);
- }
-
- String calculatedDigest = Base64.encode(digestOutputStream.getDigestValue());
- if (LOG.isDebugEnabled()) {
- LOG.debug("Calculated Digest: " + calculatedDigest);
- }
-
- signaturePartDef.setDigestValue(calculatedDigest);
-
- //create a new attachment and do the result callback
- Attachment resultAttachment = new Attachment();
- resultAttachment.setId(attachment.getId());
- resultAttachment.setMimeType(attachment.getMimeType());
- resultAttachment.addHeaders(attachment.getHeaders());
- resultAttachment.setSourceStream(inputStream);
-
- AttachmentResultCallback attachmentResultCallback = new AttachmentResultCallback();
- attachmentResultCallback.setAttachmentId(resultAttachment.getId());
- attachmentResultCallback.setAttachment(resultAttachment);
- try {
- attachmentCallbackHandler.handle(new Callback[]{attachmentResultCallback});
- } catch (Exception e) {
- throw new WSSecurityException(WSSecurityException.ErrorCode.FAILED_SIGNATURE, e);
- }
-
- getSignaturePartDefList().add(signaturePartDef);
}
} else {
super.digestExternalReference(outputProcessorChain, securePart);
Modified: webservices/wss4j/trunk/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/AbstractTestBase.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/AbstractTestBase.java?rev=1686237&r1=1686236&r2=1686237&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/AbstractTestBase.java (original)
+++ webservices/wss4j/trunk/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/AbstractTestBase.java Thu Jun 18 14:37:19 2015
@@ -572,12 +572,16 @@ public abstract class AbstractTestBase e
int ai = 0;
for (WSSecurityEngineResult result : wsSecurityEngineResults) {
final Integer act = (Integer) result.get(WSSecurityEngineResult.TAG_ACTION);
- if (act == WSConstants.SC || act == WSConstants.BST || act == WSConstants.DKT || act == WSConstants.SCT || act == WSConstants.UT_NOPASSWORD) {
- continue;
- }
-
- if (ai >= size || actions.get(ai++).intValue() != act) {
- return false;
+ if (act != null) {
+ if (act.intValue() == WSConstants.SC || act.intValue() == WSConstants.BST
+ || act.intValue() == WSConstants.DKT || act.intValue() == WSConstants.SCT
+ || act.intValue() == WSConstants.UT_NOPASSWORD) {
+ continue;
+ }
+
+ if (ai >= size || actions.get(ai++).intValue() != act) {
+ return false;
+ }
}
}
/*