You are viewing a plain text version of this content. The canonical link for it is here.
Posted to wss4j-dev@ws.apache.org by co...@apache.org on 2009/05/19 11:55:04 UTC
svn commit: r776253 [1/2] - in /webservices/wss4j/trunk:
src/org/apache/ws/axis/security/ src/org/apache/ws/security/
src/org/apache/ws/security/components/crypto/
src/org/apache/ws/security/handler/ src/org/apache/ws/security/processor/
src/org/apache...
Author: coheigea
Date: Tue May 19 09:55:03 2009
New Revision: 776253
URL: http://svn.apache.org/viewvc?rev=776253&view=rev
Log:
[WSS-190] - Replaced all Vector references with Lists
- Moved some constants in WSSecurityEngine to be upper-case as well
- Moved all dummy handler implementations from the unit tests into a single class.
Added:
webservices/wss4j/trunk/test/wssec/MyHandler.java (with props)
Modified:
webservices/wss4j/trunk/src/org/apache/ws/axis/security/WSDoAllReceiver.java
webservices/wss4j/trunk/src/org/apache/ws/axis/security/WSDoAllSender.java
webservices/wss4j/trunk/src/org/apache/ws/security/WSDocInfo.java
webservices/wss4j/trunk/src/org/apache/ws/security/WSSConfig.java
webservices/wss4j/trunk/src/org/apache/ws/security/WSSecurityEngine.java
webservices/wss4j/trunk/src/org/apache/ws/security/components/crypto/CryptoBase.java
webservices/wss4j/trunk/src/org/apache/ws/security/handler/RequestData.java
webservices/wss4j/trunk/src/org/apache/ws/security/handler/WSHandler.java
webservices/wss4j/trunk/src/org/apache/ws/security/handler/WSS4JHandler.java
webservices/wss4j/trunk/src/org/apache/ws/security/processor/BinarySecurityTokenProcessor.java
webservices/wss4j/trunk/src/org/apache/ws/security/processor/DerivedKeyTokenProcessor.java
webservices/wss4j/trunk/src/org/apache/ws/security/processor/EncryptedDataProcessor.java
webservices/wss4j/trunk/src/org/apache/ws/security/processor/EncryptedKeyProcessor.java
webservices/wss4j/trunk/src/org/apache/ws/security/processor/Processor.java
webservices/wss4j/trunk/src/org/apache/ws/security/processor/ReferenceListProcessor.java
webservices/wss4j/trunk/src/org/apache/ws/security/processor/SAMLTokenProcessor.java
webservices/wss4j/trunk/src/org/apache/ws/security/processor/SecurityContextTokenProcessor.java
webservices/wss4j/trunk/src/org/apache/ws/security/processor/SignatureConfirmationProcessor.java
webservices/wss4j/trunk/src/org/apache/ws/security/processor/SignatureProcessor.java
webservices/wss4j/trunk/src/org/apache/ws/security/processor/TimestampProcessor.java
webservices/wss4j/trunk/src/org/apache/ws/security/processor/UsernameTokenProcessor.java
webservices/wss4j/trunk/src/org/apache/ws/security/util/WSSecurityUtil.java
webservices/wss4j/trunk/test/wssec/MyProcessor.java
webservices/wss4j/trunk/test/wssec/SignatureConfirmationTest.java
webservices/wss4j/trunk/test/wssec/SignatureKeyValueTest.java
webservices/wss4j/trunk/test/wssec/TestWSSecurityDataRef.java
webservices/wss4j/trunk/test/wssec/TestWSSecurityDataRef1.java
webservices/wss4j/trunk/test/wssec/TestWSSecurityEncryptionParts.java
webservices/wss4j/trunk/test/wssec/TestWSSecurityGetPassword.java
webservices/wss4j/trunk/test/wssec/TestWSSecurityNew14.java
webservices/wss4j/trunk/test/wssec/TestWSSecurityNew17.java
webservices/wss4j/trunk/test/wssec/TestWSSecurityNew18.java
webservices/wss4j/trunk/test/wssec/TestWSSecurityNewST1.java
webservices/wss4j/trunk/test/wssec/TestWSSecurityNewST2.java
webservices/wss4j/trunk/test/wssec/TestWSSecurityNewST3.java
webservices/wss4j/trunk/test/wssec/TestWSSecurityResultsOrder.java
webservices/wss4j/trunk/test/wssec/TestWSSecuritySignatureParts.java
webservices/wss4j/trunk/test/wssec/TestWSSecurityTimestamp.java
webservices/wss4j/trunk/test/wssec/TestWSSecurityUTDK.java
webservices/wss4j/trunk/test/wssec/TestWSSecurityUTSignature.java
webservices/wss4j/trunk/test/wssec/TestWSSecurityUserProcessor.java
webservices/wss4j/trunk/test/wssec/TestWSSecurityWSS40.java
Modified: webservices/wss4j/trunk/src/org/apache/ws/axis/security/WSDoAllReceiver.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/org/apache/ws/axis/security/WSDoAllReceiver.java?rev=776253&r1=776252&r2=776253&view=diff
==============================================================================
--- webservices/wss4j/trunk/src/org/apache/ws/axis/security/WSDoAllReceiver.java (original)
+++ webservices/wss4j/trunk/src/org/apache/ws/axis/security/WSDoAllReceiver.java Tue May 19 09:55:03 2009
@@ -51,6 +51,7 @@
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.Iterator;
+import java.util.List;
import java.util.Vector;
public class WSDoAllReceiver extends WSDoAllHandler {
@@ -88,7 +89,7 @@
try {
reqData.setMsgContext(msgContext);
- Vector actions = new Vector();
+ List actions = new Vector();
String action = null;
if ((action = (String) getOption(WSHandlerConstants.ACTION)) == null) {
action = (String) msgContext
@@ -154,7 +155,7 @@
* they may be used for encryption too.
*/
doReceiverAction(doAction, reqData);
- Vector wsResult = null;
+ List wsResult = null;
if (tlog.isDebugEnabled()) {
t1 = System.currentTimeMillis();
}
@@ -307,8 +308,8 @@
* All ok up to this point. Now construct and setup the security
* result structure. The service may fetch this and check it.
*/
- Vector results = null;
- if ((results = (Vector) msgContext
+ List results = null;
+ if ((results = (List) msgContext
.getProperty(WSHandlerConstants.RECV_RESULTS)) == null) {
results = new Vector();
msgContext
Modified: webservices/wss4j/trunk/src/org/apache/ws/axis/security/WSDoAllSender.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/org/apache/ws/axis/security/WSDoAllSender.java?rev=776253&r1=776252&r2=776253&view=diff
==============================================================================
--- webservices/wss4j/trunk/src/org/apache/ws/axis/security/WSDoAllSender.java (original)
+++ webservices/wss4j/trunk/src/org/apache/ws/axis/security/WSDoAllSender.java Tue May 19 09:55:03 2009
@@ -36,6 +36,7 @@
import java.io.ByteArrayOutputStream;
import java.io.UnsupportedEncodingException;
+import java.util.List;
import java.util.Vector;
/**
@@ -79,7 +80,7 @@
/*
* Get the action first.
*/
- Vector actions = new Vector();
+ List actions = new Vector();
String action = getString(WSHandlerConstants.ACTION, mc);
if (action == null) {
throw new AxisFault("WSDoAllSender: No action defined");
Modified: webservices/wss4j/trunk/src/org/apache/ws/security/WSDocInfo.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/org/apache/ws/security/WSDocInfo.java?rev=776253&r1=776252&r2=776253&view=diff
==============================================================================
--- webservices/wss4j/trunk/src/org/apache/ws/security/WSDocInfo.java (original)
+++ webservices/wss4j/trunk/src/org/apache/ws/security/WSDocInfo.java Tue May 19 09:55:03 2009
@@ -39,15 +39,16 @@
import org.w3c.dom.Document;
import org.w3c.dom.Element;
-import java.util.Enumeration;
+import java.util.Iterator;
+import java.util.List;
import java.util.Vector;
public class WSDocInfo {
Document doc = null;
Crypto crypto = null;
- Vector bst = null;
+ List bst = null;
Element assertion = null;
- Vector processors = null;
+ List processors = null;
public WSDocInfo(Document doc) {
this.doc = doc;
@@ -60,10 +61,10 @@
crypto = null;
assertion = null;
if (bst != null && bst.size() > 0) {
- bst.removeAllElements();
+ bst.clear();
}
if (processors != null && processors.size() > 0) {
- processors.removeAllElements();
+ processors.clear();
}
bst = null;
@@ -84,8 +85,8 @@
Element elem = null;
if (bst != null) {
- for (Enumeration e = bst.elements(); e.hasMoreElements();) {
- elem = (Element) e.nextElement();
+ for (Iterator iter = bst.iterator(); iter.hasNext();) {
+ elem = (Element) iter.next();
String cId = elem.getAttribute("Id");
if (id.equals(cId)) {
break;
@@ -108,8 +109,8 @@
Processor p = null;
if (processors != null) {
- for (Enumeration e = processors.elements(); e.hasMoreElements();) {
- p = (Processor) e.nextElement();
+ for (Iterator iter = processors.iterator(); iter.hasNext();) {
+ p = (Processor) iter.next();
String cId = p.getId();
if (id.equals(cId)) {
return p;
Modified: webservices/wss4j/trunk/src/org/apache/ws/security/WSSConfig.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/org/apache/ws/security/WSSConfig.java?rev=776253&r1=776252&r2=776253&view=diff
==============================================================================
--- webservices/wss4j/trunk/src/org/apache/ws/security/WSSConfig.java (original)
+++ webservices/wss4j/trunk/src/org/apache/ws/security/WSSConfig.java Tue May 19 09:55:03 2009
@@ -120,11 +120,11 @@
org.apache.ws.security.processor.SignatureProcessor.class.getName()
);
tmp.put(
- WSSecurityEngine.timeStamp,
+ WSSecurityEngine.TIMESTAMP,
org.apache.ws.security.processor.TimestampProcessor.class.getName()
);
tmp.put(
- WSSecurityEngine.usernameToken,
+ WSSecurityEngine.USERNAME_TOKEN,
org.apache.ws.security.processor.UsernameTokenProcessor.class.getName()
);
tmp.put(
@@ -132,7 +132,7 @@
org.apache.ws.security.processor.ReferenceListProcessor.class.getName()
);
tmp.put(
- WSSecurityEngine.signatureConfirmation,
+ WSSecurityEngine.SIGNATURE_CONFIRMATION,
org.apache.ws.security.processor.SignatureConfirmationProcessor.class.getName()
);
tmp.put(
@@ -152,7 +152,7 @@
tmp.get(WSSecurityEngine.SECURITY_CONTEXT_TOKEN_05_02)
);
tmp.put(
- WSSecurityEngine.binaryToken,
+ WSSecurityEngine.BINARY_TOKEN,
org.apache.ws.security.processor.BinarySecurityTokenProcessor.class.getName()
);
tmp.put(
Modified: webservices/wss4j/trunk/src/org/apache/ws/security/WSSecurityEngine.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/org/apache/ws/security/WSSecurityEngine.java?rev=776253&r1=776252&r2=776253&view=diff
==============================================================================
--- webservices/wss4j/trunk/src/org/apache/ws/security/WSSecurityEngine.java (original)
+++ webservices/wss4j/trunk/src/org/apache/ws/security/WSSecurityEngine.java Tue May 19 09:55:03 2009
@@ -33,6 +33,7 @@
import javax.security.auth.callback.CallbackHandler;
import javax.xml.namespace.QName;
+import java.util.List;
import java.util.Vector;
/**
@@ -59,22 +60,22 @@
/**
* <code>wsse:BinarySecurityToken</code> as defined by WS Security specification
*/
- public static final QName binaryToken =
+ public static final QName BINARY_TOKEN =
new QName(WSConstants.WSSE_NS, WSConstants.BINARY_TOKEN_LN);
/**
* <code>wsse:UsernameToken</code> as defined by WS Security specification
*/
- public static final QName usernameToken =
+ public static final QName USERNAME_TOKEN =
new QName(WSConstants.WSSE_NS, WSConstants.USERNAME_TOKEN_LN);
/**
* <code>wsu:Timestamp</code> as defined by OASIS WS Security specification,
*/
- public static final QName timeStamp =
+ public static final QName TIMESTAMP =
new QName(WSConstants.WSU_NS, WSConstants.TIMESTAMP_TOKEN_LN);
/**
* <code>wsse11:signatureConfirmation</code> as defined by OASIS WS Security specification,
*/
- public static final QName signatureConfirmation =
+ public static final QName SIGNATURE_CONFIRMATION =
new QName(WSConstants.WSSE11_NS, WSConstants.SIGNATURE_CONFIRMATION_LN);
/**
* <code>ds:Signature</code> as defined by XML Signature specification,
@@ -181,16 +182,17 @@
* encryption and {@link UsernameToken} handling
* @param crypto the object that implements the access to the keystore and the
* handling of certificates.
- * @return a result vector
+ * @return a result list
* @throws WSSecurityException
* @see WSSecurityEngine#processSecurityHeader(Element securityHeader, CallbackHandler cb,
* Crypto sigCrypto, Crypto decCrypto)
*/
- public Vector processSecurityHeader(Document doc,
- String actor,
- CallbackHandler cb,
- Crypto crypto)
- throws WSSecurityException {
+ public List processSecurityHeader(
+ Document doc,
+ String actor,
+ CallbackHandler cb,
+ Crypto crypto
+ ) throws WSSecurityException {
return processSecurityHeader(doc, actor, cb, crypto, crypto);
}
@@ -211,18 +213,18 @@
* handling of certificates for Signature
* @param decCrypto the object that implements the access to the keystore and the
* handling of certificates for Decryption
- * @return a result vector
+ * @return a result list
* @throws WSSecurityException
* @see WSSecurityEngine#processSecurityHeader(
* Element securityHeader, CallbackHandler cb, Crypto sigCrypto, Crypto decCrypto)
*/
- public Vector processSecurityHeader(Document doc,
- String actor,
- CallbackHandler cb,
- Crypto sigCrypto,
- Crypto decCrypto)
- throws WSSecurityException {
-
+ public List processSecurityHeader(
+ Document doc,
+ String actor,
+ CallbackHandler cb,
+ Crypto sigCrypto,
+ Crypto decCrypto
+ ) throws WSSecurityException {
doDebug = log.isDebugEnabled();
if (doDebug) {
log.debug("enter processSecurityHeader()");
@@ -231,7 +233,7 @@
if (actor == null) {
actor = "";
}
- Vector wsResult = null;
+ List wsResult = null;
Element elem = WSSecurityUtil.getSecurityHeader(doc, actor);
if (elem != null) {
if (doDebug) {
@@ -274,34 +276,36 @@
* handling of certificates used for Signature
* @param decCrypto the object that implements the access to the keystore and the
* handling of certificates used for Decryption
- * @return a Vector of {@link WSSecurityEngineResult}. Each element in the
- * the Vector represents the result of a security action. The elements
+ * @return a List of {@link WSSecurityEngineResult}. Each element in the
+ * the List represents the result of a security action. The elements
* are ordered according to the sequence of the security actions in the
- * wsse:Signature header. The Vector maybe empty if no security processing
+ * wsse:Signature header. The List may be empty if no security processing
* was performed.
* @throws WSSecurityException
*/
- protected Vector processSecurityHeader(Element securityHeader,
- CallbackHandler cb,
- Crypto sigCrypto,
- Crypto decCrypto) throws WSSecurityException {
+ protected List processSecurityHeader(
+ Element securityHeader,
+ CallbackHandler cb,
+ Crypto sigCrypto,
+ Crypto decCrypto
+ ) throws WSSecurityException {
long t0 = 0, t1 = 0, t2 = 0;
if (tlog.isDebugEnabled()) {
t0 = System.currentTimeMillis();
}
- /*
- * Gather some info about the document to process and store
- * it for retrieval. Store the implementation of signature crypto
- * (no need for encryption --- yet)
- */
+ //
+ // Gather some info about the document to process and store
+ // it for retrieval. Store the implementation of signature crypto
+ // (no need for encryption --- yet)
+ //
WSDocInfo wsDocInfo = new WSDocInfo(securityHeader.getOwnerDocument());
wsDocInfo.setCrypto(sigCrypto);
if (tlog.isDebugEnabled()) {
t1 = System.currentTimeMillis();
}
- Vector returnResults = new Vector();
+ List returnResults = new Vector();
final WSSConfig cfg = getWssConfig();
Node node = securityHeader.getFirstChild();
while (node != null) {
Modified: webservices/wss4j/trunk/src/org/apache/ws/security/components/crypto/CryptoBase.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/org/apache/ws/security/components/crypto/CryptoBase.java?rev=776253&r1=776252&r2=776253&view=diff
==============================================================================
--- webservices/wss4j/trunk/src/org/apache/ws/security/components/crypto/CryptoBase.java (original)
+++ webservices/wss4j/trunk/src/org/apache/ws/security/components/crypto/CryptoBase.java Tue May 19 09:55:03 2009
@@ -204,9 +204,9 @@
return (PrivateKey) keyTmp;
}
- protected Vector splitAndTrim(String inString) {
+ protected List splitAndTrim(String inString) {
X509NameTokenizer nmTokens = new X509NameTokenizer(inString);
- Vector vr = new Vector();
+ List vr = new Vector();
while (nmTokens.hasMoreTokens()) {
vr.add(nmTokens.nextToken());
@@ -577,7 +577,7 @@
* for each alias. Then the DN of the certificate is compared with the parameters.
*
* @param subjectDN The DN of subject to look for in the keystore
- * @return Vector with all alias of certificates with the same DN as given in the parameters
+ * @return Array with all alias of certificates with the same DN as given in the parameters
* @throws org.apache.ws.security.WSSecurityException
*
*/
@@ -585,7 +585,7 @@
// The DN to search the keystore for
X500Principal subjectRDN = new X500Principal(subjectDN);
- Vector aliases = getAlias(subjectRDN, keystore);
+ List aliases = getAlias(subjectRDN, keystore);
//If we can't find the issuer in the keystore then look at cacerts
if (aliases.size() == 0 && cacerts != null) {
@@ -595,7 +595,7 @@
// Convert the vector into an array
String[] result = new String[aliases.size()];
for (int i = 0; i < aliases.size(); i++) {
- result[i] = (String) aliases.elementAt(i);
+ result[i] = (String) aliases.get(i);
}
return result;
@@ -614,10 +614,10 @@
*/
public byte[] getCertificateData(boolean reverse, X509Certificate[] certs)
throws WSSecurityException {
- Vector list = new Vector();
+ List list = new Vector();
for (int i = 0; i < certs.length; i++) {
if (reverse) {
- list.insertElementAt(certs[i], 0);
+ list.add(0, certs[i]);
} else {
list.add(certs[i]);
}
@@ -755,9 +755,9 @@
return true;
}
- private Vector getAlias(X500Principal subjectRDN, KeyStore store) throws WSSecurityException {
+ private List getAlias(X500Principal subjectRDN, KeyStore store) throws WSSecurityException {
// Store the aliases found
- Vector aliases = new Vector();
+ List aliases = new Vector();
Certificate cert = null;
try {
Modified: webservices/wss4j/trunk/src/org/apache/ws/security/handler/RequestData.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/org/apache/ws/security/handler/RequestData.java?rev=776253&r1=776252&r2=776253&view=diff
==============================================================================
--- webservices/wss4j/trunk/src/org/apache/ws/security/handler/RequestData.java (original)
+++ webservices/wss4j/trunk/src/org/apache/ws/security/handler/RequestData.java Tue May 19 09:55:03 2009
@@ -57,7 +57,7 @@
private X509Certificate encCert = null;
private int timeToLive = 300; // Timestamp: time in seconds between creation and expiry
private WSSConfig wssConfig = null;
- private Vector signatureValues = new Vector();
+ private List signatureValues = new Vector();
private WSSecHeader secHeader = null;
private boolean encSymmetricEncryptionKey = true;
@@ -258,9 +258,9 @@
}
/**
- * @return Returns the vector of stored signature values.
+ * @return Returns the list of stored signature values.
*/
- public Vector getSignatureValues() {
+ public List getSignatureValues() {
return signatureValues;
}
Modified: webservices/wss4j/trunk/src/org/apache/ws/security/handler/WSHandler.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/org/apache/ws/security/handler/WSHandler.java?rev=776253&r1=776252&r2=776253&view=diff
==============================================================================
--- webservices/wss4j/trunk/src/org/apache/ws/security/handler/WSHandler.java (original)
+++ webservices/wss4j/trunk/src/org/apache/ws/security/handler/WSHandler.java Tue May 19 09:55:03 2009
@@ -73,7 +73,7 @@
* @param doAction a set defining the actions to do
* @param doc the request as DOM document
* @param reqData a data storage to pass values around between methods
- * @param actions a vector holding the actions to do in the order defined
+ * @param actions a list holding the actions to do in the order defined
* in the deployment file or property
* @throws WSSecurityException
*/
@@ -81,7 +81,7 @@
int doAction,
Document doc,
RequestData reqData,
- Vector actions,
+ List actions,
boolean isRequest
) throws WSSecurityException {
@@ -273,12 +273,10 @@
}
}
- protected boolean checkReceiverResults(Vector wsResult, Vector actions) {
- int resultActions = wsResult.size();
+ protected boolean checkReceiverResults(List wsResult, List actions) {
int size = actions.size();
-
int ai = 0;
- for (int i = 0; i < resultActions; i++) {
+ for (int i = 0; i < wsResult.size(); i++) {
final Integer actInt = (Integer) ((WSSecurityEngineResult) wsResult
.get(i)).get(WSSecurityEngineResult.TAG_ACTION);
int act = actInt.intValue();
@@ -297,11 +295,10 @@
return true;
}
- protected boolean checkReceiverResultsAnyOrder(Vector wsResult, Vector actions) {
- int resultActions = wsResult.size();
- Vector actionsClone = (Vector)actions.clone();
+ protected boolean checkReceiverResultsAnyOrder(List wsResult, List actions) {
- for (int i = 0; i < resultActions; i++) {
+ int ai = 0;
+ for (int i = 0; i < wsResult.size(); i++) {
final Integer actInt = (Integer) ((WSSecurityEngineResult) wsResult
.get(i)).get(WSSecurityEngineResult.TAG_ACTION);
int act = actInt.intValue();
@@ -309,15 +306,13 @@
continue;
}
- int foundIndex = actionsClone.indexOf(actInt);
- if (foundIndex == -1) {
+ if (actions.indexOf(actInt) == -1) {
return false;
- } else {
- actionsClone.remove(foundIndex);
}
+ ai++;
}
- if (!actionsClone.isEmpty()) {
+ if (ai != actions.size()) {
return false;
}
@@ -902,8 +897,8 @@
if (!WSHandlerConstants.USE_REQ_SIG_CERT.equals(reqData.getEncUser())) {
return;
}
- Vector results =
- (Vector) getProperty(reqData.getMsgContext(), WSHandlerConstants.RECV_RESULTS);
+ List results =
+ (List) getProperty(reqData.getMsgContext(), WSHandlerConstants.RECV_RESULTS);
if (results == null) {
return;
}
@@ -1128,7 +1123,6 @@
// SECOND step
// Search for the issuer of the transmitted certificate in the keystore
-
// Search the keystore for the alias of the transmitted certificates issuer
try {
aliases = reqData.getSigCrypto().getAliasesForDN(issuerString);
Modified: webservices/wss4j/trunk/src/org/apache/ws/security/handler/WSS4JHandler.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/org/apache/ws/security/handler/WSS4JHandler.java?rev=776253&r1=776252&r2=776253&view=diff
==============================================================================
--- webservices/wss4j/trunk/src/org/apache/ws/security/handler/WSS4JHandler.java (original)
+++ webservices/wss4j/trunk/src/org/apache/ws/security/handler/WSS4JHandler.java Tue May 19 09:55:03 2009
@@ -52,6 +52,7 @@
import java.io.UnsupportedEncodingException;
import java.security.cert.X509Certificate;
import java.util.Iterator;
+import java.util.List;
import java.util.Vector;
/**
@@ -189,7 +190,7 @@
/*
* Get the action first.
*/
- Vector actions = new Vector();
+ List actions = new Vector();
String action = (String) getOption(WSHandlerConstants.SEND + '.' + WSHandlerConstants.ACTION);
if (action == null) {
action = (String) getOption(WSHandlerConstants.ACTION);
@@ -331,7 +332,7 @@
*/
public boolean doReceiver(MessageContext mc, RequestData reqData, boolean isRequest) throws WSSecurityException {
- Vector actions = new Vector();
+ List actions = new Vector();
String action = (String) getOption(WSHandlerConstants.RECEIVE + '.' + WSHandlerConstants.ACTION);
if (action == null) {
action = (String) getOption(WSHandlerConstants.ACTION);
@@ -386,7 +387,7 @@
* may be used for encryption too.
*/
doReceiverAction(doAction, reqData);
- Vector wsResult = null;
+ List wsResult = null;
try {
wsResult =
secEngine.processSecurityHeader(doc,
@@ -507,8 +508,8 @@
* security result structure. The service may fetch this
* and check it.
*/
- Vector results = null;
- if ((results = (Vector) mc.getProperty(WSHandlerConstants.RECV_RESULTS))
+ List results = null;
+ if ((results = (List) mc.getProperty(WSHandlerConstants.RECV_RESULTS))
== null) {
results = new Vector();
mc.setProperty(WSHandlerConstants.RECV_RESULTS, results);
Modified: webservices/wss4j/trunk/src/org/apache/ws/security/processor/BinarySecurityTokenProcessor.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/org/apache/ws/security/processor/BinarySecurityTokenProcessor.java?rev=776253&r1=776252&r2=776253&view=diff
==============================================================================
--- webservices/wss4j/trunk/src/org/apache/ws/security/processor/BinarySecurityTokenProcessor.java (original)
+++ webservices/wss4j/trunk/src/org/apache/ws/security/processor/BinarySecurityTokenProcessor.java Tue May 19 09:55:03 2009
@@ -33,7 +33,7 @@
import javax.security.auth.callback.CallbackHandler;
import java.security.cert.X509Certificate;
-import java.util.Vector;
+import java.util.List;
/**
@@ -77,7 +77,7 @@
Crypto decCrypto,
CallbackHandler cb,
WSDocInfo wsDocInfo,
- Vector returnResults,
+ List returnResults,
WSSConfig config
) throws WSSecurityException {
getCertificatesTokenReference(elem, crypto);
Modified: webservices/wss4j/trunk/src/org/apache/ws/security/processor/DerivedKeyTokenProcessor.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/org/apache/ws/security/processor/DerivedKeyTokenProcessor.java?rev=776253&r1=776252&r2=776253&view=diff
==============================================================================
--- webservices/wss4j/trunk/src/org/apache/ws/security/processor/DerivedKeyTokenProcessor.java (original)
+++ webservices/wss4j/trunk/src/org/apache/ws/security/processor/DerivedKeyTokenProcessor.java Tue May 19 09:55:03 2009
@@ -42,7 +42,7 @@
import javax.security.auth.callback.UnsupportedCallbackException;
import java.io.IOException;
-import java.util.Vector;
+import java.util.List;
/**
* The processor to process <code>wsc:DerivedKeyToken</code>.
@@ -67,7 +67,7 @@
Crypto decCrypto,
CallbackHandler cb,
WSDocInfo wsDocInfo,
- Vector returnResults,
+ List returnResults,
WSSConfig config
) throws WSSecurityException {
Modified: webservices/wss4j/trunk/src/org/apache/ws/security/processor/EncryptedDataProcessor.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/org/apache/ws/security/processor/EncryptedDataProcessor.java?rev=776253&r1=776252&r2=776253&view=diff
==============================================================================
--- webservices/wss4j/trunk/src/org/apache/ws/security/processor/EncryptedDataProcessor.java (original)
+++ webservices/wss4j/trunk/src/org/apache/ws/security/processor/EncryptedDataProcessor.java Tue May 19 09:55:03 2009
@@ -34,7 +34,7 @@
import javax.security.auth.callback.CallbackHandler;
import javax.xml.namespace.QName;
-import java.util.Vector;
+import java.util.List;
/**
* This will process incoming <code>xenc:EncryptedData</code> elements.
@@ -53,7 +53,7 @@
Crypto decCrypto,
CallbackHandler cb,
WSDocInfo wsDocInfo,
- Vector returnResults,
+ List returnResults,
WSSConfig config
) throws WSSecurityException {
Element kiElem =
Modified: webservices/wss4j/trunk/src/org/apache/ws/security/processor/EncryptedKeyProcessor.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/org/apache/ws/security/processor/EncryptedKeyProcessor.java?rev=776253&r1=776252&r2=776253&view=diff
==============================================================================
--- webservices/wss4j/trunk/src/org/apache/ws/security/processor/EncryptedKeyProcessor.java (original)
+++ webservices/wss4j/trunk/src/org/apache/ws/security/processor/EncryptedKeyProcessor.java Tue May 19 09:55:03 2009
@@ -51,7 +51,6 @@
import java.io.IOException;
import java.security.PrivateKey;
import java.security.cert.X509Certificate;
-import java.util.ArrayList;
import java.util.List;
import java.util.Vector;
@@ -72,7 +71,7 @@
Crypto decCrypto,
CallbackHandler cb,
WSDocInfo wsDocInfo,
- Vector returnResults,
+ List returnResults,
WSSConfig wsc
) throws WSSecurityException {
if (log.isDebugEnabled()) {
@@ -182,7 +181,7 @@
WSSecurityUtil.getDirectChildElement(
xencEncryptedKey, "ReferenceList", WSConstants.ENC_NS
);
- List dataRefs = new ArrayList();
+ List dataRefs = new Vector();
if (refList != null) {
for (Node node = refList.getFirstChild();
node != null;
@@ -380,7 +379,7 @@
// at this point ... check token type: Binary
QName el =
new QName(bstElement.getNamespaceURI(), bstElement.getLocalName());
- if (el.equals(WSSecurityEngine.binaryToken)) {
+ if (el.equals(WSSecurityEngine.BINARY_TOKEN)) {
X509Security token = new X509Security(bstElement);
String value = bstElement.getAttribute(WSSecurityEngine.VALUE_TYPE);
if (!X509Security.X509_V3_TYPE.equals(value) || (token == null)) {
Modified: webservices/wss4j/trunk/src/org/apache/ws/security/processor/Processor.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/org/apache/ws/security/processor/Processor.java?rev=776253&r1=776252&r2=776253&view=diff
==============================================================================
--- webservices/wss4j/trunk/src/org/apache/ws/security/processor/Processor.java (original)
+++ webservices/wss4j/trunk/src/org/apache/ws/security/processor/Processor.java Tue May 19 09:55:03 2009
@@ -26,7 +26,7 @@
import org.w3c.dom.Element;
import javax.security.auth.callback.CallbackHandler;
-import java.util.Vector;
+import java.util.List;
public interface Processor {
@@ -36,7 +36,7 @@
Crypto decCrypto,
CallbackHandler cb,
WSDocInfo wsDocInfo,
- Vector returnResults,
+ List returnResults,
WSSConfig config
) throws WSSecurityException;
Modified: webservices/wss4j/trunk/src/org/apache/ws/security/processor/ReferenceListProcessor.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/org/apache/ws/security/processor/ReferenceListProcessor.java?rev=776253&r1=776252&r2=776253&view=diff
==============================================================================
--- webservices/wss4j/trunk/src/org/apache/ws/security/processor/ReferenceListProcessor.java (original)
+++ webservices/wss4j/trunk/src/org/apache/ws/security/processor/ReferenceListProcessor.java Tue May 19 09:55:03 2009
@@ -19,7 +19,6 @@
package org.apache.ws.security.processor;
-import java.util.ArrayList;
import java.util.List;
import java.util.Vector;
@@ -60,7 +59,7 @@
Crypto decCrypto,
CallbackHandler cb,
WSDocInfo wdi,
- Vector returnResults,
+ List returnResults,
WSSConfig wsc
) throws WSSecurityException {
debug = log.isDebugEnabled();
@@ -91,7 +90,7 @@
Crypto crypto,
WSDocInfo wdi
) throws WSSecurityException {
- List dataRefs = new ArrayList();
+ List dataRefs = new Vector();
for (Node node = elem.getFirstChild();
node != null;
node = node.getNextSibling()
Modified: webservices/wss4j/trunk/src/org/apache/ws/security/processor/SAMLTokenProcessor.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/org/apache/ws/security/processor/SAMLTokenProcessor.java?rev=776253&r1=776252&r2=776253&view=diff
==============================================================================
--- webservices/wss4j/trunk/src/org/apache/ws/security/processor/SAMLTokenProcessor.java (original)
+++ webservices/wss4j/trunk/src/org/apache/ws/security/processor/SAMLTokenProcessor.java Tue May 19 09:55:03 2009
@@ -32,7 +32,7 @@
import org.w3c.dom.Element;
import javax.security.auth.callback.CallbackHandler;
-import java.util.Vector;
+import java.util.List;
public class SAMLTokenProcessor implements Processor {
private static Log log = LogFactory.getLog(SAMLTokenProcessor.class.getName());
@@ -46,7 +46,7 @@
Crypto decCrypto,
CallbackHandler cb,
WSDocInfo wsDocInfo,
- Vector returnResults,
+ List returnResults,
WSSConfig wsc
) throws WSSecurityException {
if (log.isDebugEnabled()) {
Modified: webservices/wss4j/trunk/src/org/apache/ws/security/processor/SecurityContextTokenProcessor.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/org/apache/ws/security/processor/SecurityContextTokenProcessor.java?rev=776253&r1=776252&r2=776253&view=diff
==============================================================================
--- webservices/wss4j/trunk/src/org/apache/ws/security/processor/SecurityContextTokenProcessor.java (original)
+++ webservices/wss4j/trunk/src/org/apache/ws/security/processor/SecurityContextTokenProcessor.java Tue May 19 09:55:03 2009
@@ -34,7 +34,7 @@
import javax.security.auth.callback.UnsupportedCallbackException;
import java.io.IOException;
-import java.util.Vector;
+import java.util.List;
/**
* The processor to process <code>wsc:SecurityContextToken</code>.
@@ -66,7 +66,7 @@
Crypto decCrypto,
CallbackHandler cb,
WSDocInfo wsDocInfo,
- Vector returnResults,
+ List returnResults,
WSSConfig config
) throws WSSecurityException {
SecurityContextToken sct = new SecurityContextToken(elem);
Modified: webservices/wss4j/trunk/src/org/apache/ws/security/processor/SignatureConfirmationProcessor.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/org/apache/ws/security/processor/SignatureConfirmationProcessor.java?rev=776253&r1=776252&r2=776253&view=diff
==============================================================================
--- webservices/wss4j/trunk/src/org/apache/ws/security/processor/SignatureConfirmationProcessor.java (original)
+++ webservices/wss4j/trunk/src/org/apache/ws/security/processor/SignatureConfirmationProcessor.java Tue May 19 09:55:03 2009
@@ -31,7 +31,7 @@
import org.w3c.dom.Element;
import javax.security.auth.callback.CallbackHandler;
-import java.util.Vector;
+import java.util.List;
public class SignatureConfirmationProcessor implements Processor {
private static Log log = LogFactory.getLog(SignatureConfirmationProcessor.class.getName());
@@ -44,7 +44,7 @@
Crypto decCrypto,
CallbackHandler cb,
WSDocInfo wsDocInfo,
- Vector returnResults,
+ List returnResults,
WSSConfig wsc
) throws WSSecurityException {
if (log.isDebugEnabled()) {
Modified: webservices/wss4j/trunk/src/org/apache/ws/security/processor/SignatureProcessor.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/org/apache/ws/security/processor/SignatureProcessor.java?rev=776253&r1=776252&r2=776253&view=diff
==============================================================================
--- webservices/wss4j/trunk/src/org/apache/ws/security/processor/SignatureProcessor.java (original)
+++ webservices/wss4j/trunk/src/org/apache/ws/security/processor/SignatureProcessor.java Tue May 19 09:55:03 2009
@@ -64,7 +64,6 @@
import java.security.cert.CertificateNotYetValidException;
import java.security.cert.X509Certificate;
import java.util.List;
-import java.util.Vector;
public class SignatureProcessor implements Processor {
private static Log log = LogFactory.getLog(SignatureProcessor.class.getName());
@@ -82,14 +81,14 @@
Crypto decCrypto,
CallbackHandler cb,
WSDocInfo wsDocInfo,
- Vector returnResults,
+ List returnResults,
WSSConfig wsc
) throws WSSecurityException {
if (log.isDebugEnabled()) {
log.debug("Found signature element");
}
boolean remove = WSDocInfoStore.store(wsDocInfo);
- List protectedRefs = new java.util.ArrayList();
+ List protectedRefs = new java.util.Vector();
Principal lastPrincipalFound = null;
certs = null;
signatureValue = null;
@@ -232,7 +231,7 @@
// Crypto required only for Binary and SAML
//
QName el = new QName(token.getNamespaceURI(), token.getLocalName());
- if (el.equals(WSSecurityEngine.usernameToken)) {
+ if (el.equals(WSSecurityEngine.USERNAME_TOKEN)) {
String id = token.getAttributeNS(WSConstants.WSU_NS, "Id");
UsernameTokenProcessor utProcessor =
(UsernameTokenProcessor) wsDocInfo.getProcessor(id);
@@ -254,7 +253,7 @@
secretKey = dktProcessor.getKeyBytes(keyLength);
} else {
- if (el.equals(WSSecurityEngine.binaryToken)) {
+ if (el.equals(WSSecurityEngine.BINARY_TOKEN)) {
certs = getCertificates(token, wsDocInfo, crypto);
} else if (el.equals(WSSecurityEngine.SAML_TOKEN)) {
if (crypto == null) {
Modified: webservices/wss4j/trunk/src/org/apache/ws/security/processor/TimestampProcessor.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/org/apache/ws/security/processor/TimestampProcessor.java?rev=776253&r1=776252&r2=776253&view=diff
==============================================================================
--- webservices/wss4j/trunk/src/org/apache/ws/security/processor/TimestampProcessor.java (original)
+++ webservices/wss4j/trunk/src/org/apache/ws/security/processor/TimestampProcessor.java Tue May 19 09:55:03 2009
@@ -31,7 +31,7 @@
import org.w3c.dom.Element;
import javax.security.auth.callback.CallbackHandler;
-import java.util.Vector;
+import java.util.List;
public class TimestampProcessor implements Processor {
private static Log log = LogFactory.getLog(TimestampProcessor.class.getName());
@@ -46,7 +46,7 @@
Crypto decCrypto,
CallbackHandler cb,
WSDocInfo wsDocInfo,
- Vector returnResults,
+ List returnResults,
WSSConfig wsc
) throws WSSecurityException {
if (log.isDebugEnabled()) {
Modified: webservices/wss4j/trunk/src/org/apache/ws/security/processor/UsernameTokenProcessor.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/org/apache/ws/security/processor/UsernameTokenProcessor.java?rev=776253&r1=776252&r2=776253&view=diff
==============================================================================
--- webservices/wss4j/trunk/src/org/apache/ws/security/processor/UsernameTokenProcessor.java (original)
+++ webservices/wss4j/trunk/src/org/apache/ws/security/processor/UsernameTokenProcessor.java Tue May 19 09:55:03 2009
@@ -37,7 +37,7 @@
import javax.security.auth.callback.UnsupportedCallbackException;
import java.io.IOException;
import java.security.Principal;
-import java.util.Vector;
+import java.util.List;
public class UsernameTokenProcessor implements Processor {
private static Log log = LogFactory.getLog(UsernameTokenProcessor.class.getName());
@@ -47,7 +47,7 @@
private boolean handleCustomPasswordTypes;
public void handleToken(Element elem, Crypto crypto, Crypto decCrypto, CallbackHandler cb,
- WSDocInfo wsDocInfo, Vector returnResults, WSSConfig wsc) throws WSSecurityException {
+ WSDocInfo wsDocInfo, List returnResults, WSSConfig wsc) throws WSSecurityException {
if (log.isDebugEnabled()) {
log.debug("Found UsernameToken list element");
}
Modified: webservices/wss4j/trunk/src/org/apache/ws/security/util/WSSecurityUtil.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/org/apache/ws/security/util/WSSecurityUtil.java?rev=776253&r1=776252&r2=776253&view=diff
==============================================================================
--- webservices/wss4j/trunk/src/org/apache/ws/security/util/WSSecurityUtil.java (original)
+++ webservices/wss4j/trunk/src/org/apache/ws/security/util/WSSecurityUtil.java Tue May 19 09:55:03 2009
@@ -727,11 +727,13 @@
*
* @param resultList The result list to fetch an action from
* @param action The action to fetch
- * @return The first result fetched from the result list, null if the result
+ * @return The last result fetched from the result list, null if the result
* could not be found
*/
public static WSSecurityEngineResult fetchActionResult(List resultList, int action) {
+ WSSecurityEngineResult returnResult = null;
+
for (int i = 0; i < resultList.size(); i++) {
//
// Check the result of every action whether it matches the given action
@@ -741,11 +743,11 @@
int resultAction =
((java.lang.Integer)result.get(WSSecurityEngineResult.TAG_ACTION)).intValue();
if (resultAction == action) {
- return result;
+ returnResult = result;
}
}
- return null;
+ return returnResult;
}
@@ -778,7 +780,7 @@
return actionResultList;
}
- public static int decodeAction(String action, Vector actions) throws WSSecurityException {
+ public static int decodeAction(String action, List actions) throws WSSecurityException {
int doAction = 0;
if (action == null) {
@@ -878,13 +880,13 @@
/**
* Check that all of the QName[] requiredParts are protected by a specified action in the
- * results vector.
- * @param results The Vector of WSSecurityEngineResults from processing
+ * results list.
+ * @param results The List of WSSecurityEngineResults from processing
* @param action The action that is required (e.g. WSConstants.SIGN)
* @param requiredParts An array of QNames that correspond to the required elements
*/
public static void checkAllElementsProtected(
- Vector results,
+ List results,
int action,
QName[] requiredParts
) throws WSSecurityException {
@@ -1035,7 +1037,7 @@
if (parent == null) {
return java.util.Collections.EMPTY_LIST;
}
- final java.util.List ret = new java.util.ArrayList();
+ final java.util.List ret = new java.util.Vector();
Node node = parent.getFirstChild();
while (node != null) {
ret.add(node);
@@ -1058,7 +1060,7 @@
if (b.size() == 0) {
return java.util.Collections.EMPTY_LIST;
}
- final java.util.List ret = new java.util.ArrayList();
+ final java.util.List ret = new java.util.Vector();
for (
final java.util.Iterator bpos = b.iterator();
bpos.hasNext();
Added: webservices/wss4j/trunk/test/wssec/MyHandler.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/test/wssec/MyHandler.java?rev=776253&view=auto
==============================================================================
--- webservices/wss4j/trunk/test/wssec/MyHandler.java (added)
+++ webservices/wss4j/trunk/test/wssec/MyHandler.java Tue May 19 09:55:03 2009
@@ -0,0 +1,125 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package wssec;
+
+import java.security.cert.X509Certificate;
+
+import org.apache.ws.security.handler.WSHandler;
+import org.apache.ws.security.handler.RequestData;
+import org.w3c.dom.Document;
+
+
+/**
+ * A trivial extension of the WSHandler type for use in unit-testing.
+ */
+public class MyHandler extends WSHandler {
+
+ public Object
+ getOption(String key) {
+ return null;
+ }
+
+ public void
+ setProperty(
+ Object ctx,
+ String key,
+ Object value
+ ) {
+ ((java.util.Map)ctx).put(key, value);
+ }
+
+ public Object
+ getProperty(Object ctx, String key) {
+ if (ctx instanceof java.util.Map) {
+ return ((java.util.Map)ctx).get(key);
+ }
+ return null;
+ }
+
+ public void
+ setPassword(Object msgContext, String password) {
+ }
+
+ public String
+ getPassword(Object msgContext) {
+ if (msgContext instanceof java.util.Map) {
+ return (String)((java.util.Map)msgContext).get("password");
+ }
+ return null;
+ }
+
+ public void send(
+ int action,
+ Document doc,
+ RequestData reqData,
+ java.util.List actions,
+ boolean request
+ ) throws org.apache.ws.security.WSSecurityException {
+ doSenderAction(
+ action,
+ doc,
+ reqData,
+ actions,
+ request
+ );
+ }
+
+ public void receive(
+ int action,
+ RequestData reqData
+ ) throws org.apache.ws.security.WSSecurityException {
+ doReceiverAction(
+ action,
+ reqData
+ );
+ }
+
+ public void signatureConfirmation(
+ RequestData requestData,
+ java.util.List results
+ ) throws org.apache.ws.security.WSSecurityException {
+ checkSignatureConfirmation(requestData, results);
+ }
+
+ public boolean checkResults(
+ java.util.List results,
+ java.util.List actions
+ ) throws org.apache.ws.security.WSSecurityException {
+ return checkReceiverResults(results, actions);
+ }
+
+ public boolean checkResultsAnyOrder(
+ java.util.List results,
+ java.util.List actions
+ ) throws org.apache.ws.security.WSSecurityException {
+ return checkReceiverResultsAnyOrder(results, actions);
+ }
+
+ public boolean verifyCertificate(
+ X509Certificate cert,
+ RequestData reqData
+ ) throws org.apache.ws.security.WSSecurityException {
+ return verifyTrust(
+ cert,
+ reqData
+ );
+ }
+
+}
Propchange: webservices/wss4j/trunk/test/wssec/MyHandler.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: webservices/wss4j/trunk/test/wssec/MyHandler.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Modified: webservices/wss4j/trunk/test/wssec/MyProcessor.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/test/wssec/MyProcessor.java?rev=776253&r1=776252&r2=776253&view=diff
==============================================================================
--- webservices/wss4j/trunk/test/wssec/MyProcessor.java (original)
+++ webservices/wss4j/trunk/test/wssec/MyProcessor.java Tue May 19 09:55:03 2009
@@ -40,7 +40,7 @@
final Crypto decCrypto,
final javax.security.auth.callback.CallbackHandler cb,
final WSDocInfo wsDocInfo,
- final java.util.Vector returnResults,
+ final java.util.List returnResults,
final WSSConfig config
) throws WSSecurityException {
final java.util.Map result =
Modified: webservices/wss4j/trunk/test/wssec/SignatureConfirmationTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/test/wssec/SignatureConfirmationTest.java?rev=776253&r1=776252&r2=776253&view=diff
==============================================================================
--- webservices/wss4j/trunk/test/wssec/SignatureConfirmationTest.java (original)
+++ webservices/wss4j/trunk/test/wssec/SignatureConfirmationTest.java Tue May 19 09:55:03 2009
@@ -35,7 +35,6 @@
import org.apache.ws.security.WSSecurityEngineResult;
import org.apache.ws.security.components.crypto.Crypto;
import org.apache.ws.security.components.crypto.CryptoFactory;
-import org.apache.ws.security.handler.WSHandler;
import org.apache.ws.security.handler.RequestData;
import org.apache.ws.security.handler.WSHandlerConstants;
import org.apache.ws.security.handler.WSHandlerResult;
@@ -129,6 +128,7 @@
java.util.Map msgContext = new java.util.TreeMap();
msgContext.put(WSHandlerConstants.ENABLE_SIGNATURE_CONFIRMATION, "true");
msgContext.put(WSHandlerConstants.SIG_PROP_FILE, "crypto.properties");
+ msgContext.put("password", "security");
reqData.setMsgContext(msgContext);
reqData.setUsername("16c73ab6-b892-458f-abf5-2f875f74882e");
@@ -136,7 +136,7 @@
actions.add(new Integer(WSConstants.SIGN));
final Document doc = unsignedEnvelope.getAsDocument();
MyHandler handler = new MyHandler();
- handler.doit(
+ handler.send(
WSConstants.SIGN, doc, reqData, actions, true
);
if (LOG.isDebugEnabled()) {
@@ -164,6 +164,7 @@
java.util.Map msgContext = new java.util.TreeMap();
msgContext.put(WSHandlerConstants.ENABLE_SIGNATURE_CONFIRMATION, "false");
msgContext.put(WSHandlerConstants.SIG_PROP_FILE, "crypto.properties");
+ msgContext.put("password", "security");
reqData.setMsgContext(msgContext);
reqData.setUsername("16c73ab6-b892-458f-abf5-2f875f74882e");
@@ -171,7 +172,7 @@
actions.add(new Integer(WSConstants.SIGN));
final Document doc = unsignedEnvelope.getAsDocument();
MyHandler handler = new MyHandler();
- handler.doit(
+ handler.send(
WSConstants.SIGN, doc, reqData, actions, true
);
if (LOG.isDebugEnabled()) {
@@ -197,6 +198,7 @@
java.util.Map msgContext = new java.util.TreeMap();
msgContext.put(WSHandlerConstants.ENABLE_SIGNATURE_CONFIRMATION, "true");
msgContext.put(WSHandlerConstants.SIG_PROP_FILE, "crypto.properties");
+ msgContext.put("password", "security");
reqData.setMsgContext(msgContext);
reqData.setUsername("16c73ab6-b892-458f-abf5-2f875f74882e");
@@ -204,7 +206,7 @@
actions.add(new Integer(WSConstants.SIGN));
Document doc = unsignedEnvelope.getAsDocument();
MyHandler handler = new MyHandler();
- handler.doit(
+ handler.send(
WSConstants.SIGN, doc, reqData, actions, true
);
if (LOG.isDebugEnabled()) {
@@ -231,7 +233,7 @@
List receivedResults = new Vector();
receivedResults.add(handlerResult);
msgContext.put(WSHandlerConstants.RECV_RESULTS, receivedResults);
- handler.doit(
+ handler.send(
WSConstants.NO_SECURITY, doc, reqData, actions, false
);
String outputString =
@@ -254,6 +256,7 @@
java.util.Map msgContext = new java.util.TreeMap();
msgContext.put(WSHandlerConstants.ENABLE_SIGNATURE_CONFIRMATION, "true");
msgContext.put(WSHandlerConstants.SIG_PROP_FILE, "crypto.properties");
+ msgContext.put("password", "security");
reqData.setMsgContext(msgContext);
reqData.setUsername("16c73ab6-b892-458f-abf5-2f875f74882e");
@@ -261,7 +264,7 @@
actions.add(new Integer(WSConstants.SIGN));
Document doc = unsignedEnvelope.getAsDocument();
MyHandler handler = new MyHandler();
- handler.doit(
+ handler.send(
WSConstants.SIGN, doc, reqData, actions, true
);
if (LOG.isDebugEnabled()) {
@@ -282,7 +285,7 @@
List receivedResults = new Vector();
receivedResults.add(handlerResult);
msgContext.put(WSHandlerConstants.RECV_RESULTS, receivedResults);
- handler.doit(
+ handler.send(
WSConstants.NO_SECURITY, doc, reqData, actions, false
);
String outputString =
@@ -311,8 +314,8 @@
* @param doc
* @throws Exception Thrown when there is a problem in verification
*/
- private Vector verify(Document doc) throws Exception {
- Vector results = secEngine.processSecurityHeader(doc, null, this, crypto);
+ private List verify(Document doc) throws Exception {
+ List results = secEngine.processSecurityHeader(doc, null, this, crypto);
if (LOG.isDebugEnabled()) {
LOG.debug("Verfied and decrypted message:");
String outputString =
@@ -323,63 +326,6 @@
}
- /**
- * a trivial extension of the WSHandler type
- */
- private static class MyHandler extends WSHandler {
-
- public Object
- getOption(String key) {
- return null;
- }
-
- public void
- setProperty(
- Object ctx,
- String key,
- Object value
- ) {
- ((java.util.Map)ctx).put(key, value);
- }
-
- public Object
- getProperty(Object ctx, String key) {
- return ((java.util.Map)ctx).get(key);
- }
-
- public void
- setPassword(Object msgContext, String password) {
- }
-
- public String
- getPassword(Object msgContext) {
- return "security";
- }
-
- void doit(
- int action,
- Document doc,
- RequestData reqData,
- java.util.Vector actions,
- boolean request
- ) throws org.apache.ws.security.WSSecurityException {
- doSenderAction(
- action,
- doc,
- reqData,
- actions,
- request
- );
- }
-
- void signatureConfirmation(
- RequestData requestData,
- List results
- ) throws org.apache.ws.security.WSSecurityException {
- checkSignatureConfirmation(requestData, results);
- }
- }
-
public void handle(Callback[] callbacks)
throws IOException, UnsupportedCallbackException {
for (int i = 0; i < callbacks.length; i++) {
Modified: webservices/wss4j/trunk/test/wssec/SignatureKeyValueTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/test/wssec/SignatureKeyValueTest.java?rev=776253&r1=776252&r2=776253&view=diff
==============================================================================
--- webservices/wss4j/trunk/test/wssec/SignatureKeyValueTest.java (original)
+++ webservices/wss4j/trunk/test/wssec/SignatureKeyValueTest.java Tue May 19 09:55:03 2009
@@ -44,6 +44,7 @@
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
+import java.util.List;
import javax.security.auth.callback.Callback;
import javax.security.auth.callback.CallbackHandler;
@@ -141,7 +142,7 @@
}
assertTrue(outputString.indexOf("RSAKeyValue") != -1);
- final java.util.Vector results = verify(signedDoc);
+ final List results = verify(signedDoc);
WSSecurityEngineResult actionResult =
WSSecurityUtil.fetchActionResult(results, WSConstants.SIGN);
assertTrue(actionResult != null);
@@ -206,7 +207,7 @@
}
assertTrue(outputString.indexOf("DSAKeyValue") != -1);
- final java.util.Vector results = verify(signedDoc);
+ final List results = verify(signedDoc);
WSSecurityEngineResult actionResult =
WSSecurityUtil.fetchActionResult(results, WSConstants.SIGN);
assertTrue(actionResult != null);
@@ -227,7 +228,7 @@
* @param env soap envelope
* @throws java.lang.Exception Thrown when there is a problem in verification
*/
- private java.util.Vector verify(Document doc) throws Exception {
+ private List verify(Document doc) throws Exception {
return secEngine.processSecurityHeader(doc, null, this, null);
}
Modified: webservices/wss4j/trunk/test/wssec/TestWSSecurityDataRef.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/test/wssec/TestWSSecurityDataRef.java?rev=776253&r1=776252&r2=776253&view=diff
==============================================================================
--- webservices/wss4j/trunk/test/wssec/TestWSSecurityDataRef.java (original)
+++ webservices/wss4j/trunk/test/wssec/TestWSSecurityDataRef.java Tue May 19 09:55:03 2009
@@ -22,7 +22,7 @@
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
-import java.util.ArrayList;
+import java.util.List;
import java.util.Vector;
import javax.security.auth.callback.Callback;
@@ -157,7 +157,7 @@
/*
* Set up the parts structure to encrypt the body
*/
- Vector parts = new Vector();
+ List parts = new Vector();
WSEncryptionPart encP = new WSEncryptionPart("testMethod", "uri:LogTestService2",
"Element");
parts.add(encP);
@@ -194,8 +194,8 @@
*/
private void checkDataRef(Document doc) throws Exception {
- // Retrieve the wsResults vector
- Vector wsResults = secEngine.processSecurityHeader(doc, null, this, crypto);
+ // Retrieve the wsResults List
+ List wsResults = secEngine.processSecurityHeader(doc, null, this, crypto);
boolean found = false;
for (int i = 0; i < wsResults.size(); i++) {
@@ -209,7 +209,7 @@
if (action != WSConstants.ENCR) {
continue;
}
- ArrayList dataRefs = (ArrayList)wsSecEngineResult
+ List dataRefs = (List)wsSecEngineResult
.get(WSSecurityEngineResult.TAG_DATA_REF_URIS);
//We want check only the DATA_REF_URIS
Modified: webservices/wss4j/trunk/test/wssec/TestWSSecurityDataRef1.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/test/wssec/TestWSSecurityDataRef1.java?rev=776253&r1=776252&r2=776253&view=diff
==============================================================================
--- webservices/wss4j/trunk/test/wssec/TestWSSecurityDataRef1.java (original)
+++ webservices/wss4j/trunk/test/wssec/TestWSSecurityDataRef1.java Tue May 19 09:55:03 2009
@@ -22,7 +22,7 @@
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
-import java.util.ArrayList;
+import java.util.List;
import java.util.Vector;
import javax.security.auth.callback.Callback;
@@ -157,7 +157,7 @@
/*
* Set up the parts structure to encrypt the body
*/
- Vector parts = new Vector();
+ List parts = new Vector();
WSEncryptionPart encP = new WSEncryptionPart("testMethod", "uri:LogTestService2",
"Element");
parts.add(encP);
@@ -198,8 +198,8 @@
*/
private void checkDataRef(Document doc) throws Exception {
- // Retrieve the wsResults vector
- Vector wsResults = secEngine.processSecurityHeader(doc, null, this, crypto);
+ // Retrieve the wsResults List
+ List wsResults = secEngine.processSecurityHeader(doc, null, this, crypto);
boolean found = false;
for (int i = 0; i < wsResults.size(); i++) {
@@ -213,7 +213,7 @@
if (action != WSConstants.ENCR) {
continue;
}
- ArrayList dataRefs = (ArrayList)wsSecEngineResult
+ List dataRefs = (List)wsSecEngineResult
.get(WSSecurityEngineResult.TAG_DATA_REF_URIS);
//We want check only the DATA_REF_URIS
Modified: webservices/wss4j/trunk/test/wssec/TestWSSecurityEncryptionParts.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/test/wssec/TestWSSecurityEncryptionParts.java?rev=776253&r1=776252&r2=776253&view=diff
==============================================================================
--- webservices/wss4j/trunk/test/wssec/TestWSSecurityEncryptionParts.java (original)
+++ webservices/wss4j/trunk/test/wssec/TestWSSecurityEncryptionParts.java Tue May 19 09:55:03 2009
@@ -150,7 +150,7 @@
LOG.debug(outputString);
}
- Vector results = verify(encryptedDoc);
+ List results = verify(encryptedDoc);
QName name = new QName("urn:foo.bar", "foobar");
WSSecurityUtil.checkAllElementsProtected(results, WSConstants.ENCR, new QName[]{name});
@@ -309,7 +309,7 @@
LOG.debug(outputString);
}
- Vector results = verify(encryptedDoc);
+ List results = verify(encryptedDoc);
QName fooName = new QName("urn:foo.bar", "foobar");
QName bodyName = new QName(soapConstants.getEnvelopeURI(), "Body");
@@ -356,8 +356,8 @@
* @param doc
* @throws Exception Thrown when there is a problem in verification
*/
- private Vector verify(Document doc) throws Exception {
- Vector results = secEngine.processSecurityHeader(doc, null, this, crypto);
+ private List verify(Document doc) throws Exception {
+ List results = secEngine.processSecurityHeader(doc, null, this, crypto);
if (LOG.isDebugEnabled()) {
LOG.debug("Verified and decrypted message:");
String outputString =
Modified: webservices/wss4j/trunk/test/wssec/TestWSSecurityGetPassword.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/test/wssec/TestWSSecurityGetPassword.java?rev=776253&r1=776252&r2=776253&view=diff
==============================================================================
--- webservices/wss4j/trunk/test/wssec/TestWSSecurityGetPassword.java (original)
+++ webservices/wss4j/trunk/test/wssec/TestWSSecurityGetPassword.java Tue May 19 09:55:03 2009
@@ -162,11 +162,12 @@
actions.add(new Integer(WSConstants.UT));
Document doc = unsignedEnvelope.getAsDocument();
MyHandler handler = new MyHandler();
- handler.doit(
+ handler.send(
WSConstants.UT,
doc,
reqData,
- actions
+ actions,
+ true
);
String outputString =
@@ -202,11 +203,12 @@
actions.add(new Integer(WSConstants.UT));
Document doc = unsignedEnvelope.getAsDocument();
MyHandler handler = new MyHandler();
- handler.doit(
+ handler.send(
WSConstants.UT,
doc,
reqData,
- actions
+ actions,
+ true
);
String outputString =
@@ -219,53 +221,6 @@
}
- /**
- * a trivial extension of the WSHandler type
- */
- public static class MyHandler extends WSHandler {
-
- public Object
- getOption(String key) {
- return null;
- }
-
- public void
- setProperty(
- Object msgContext,
- String key,
- Object value
- ) {
- }
-
- public Object
- getProperty(Object ctx, String key) {
- return ((java.util.Map)ctx).get(key);
- }
-
- public void
- setPassword(Object msgContext, String password) {
- }
-
- public String
- getPassword(Object msgContext) {
- return (String)((java.util.Map)msgContext).get("password");
- }
-
- void doit(
- int action,
- Document doc,
- RequestData reqData,
- java.util.Vector actions
- ) throws org.apache.ws.security.WSSecurityException {
- doSenderAction(
- action,
- doc,
- reqData,
- actions,
- true
- );
- }
- }
public static class MyCallbackHandler implements CallbackHandler {
public void handle(Callback[] callbacks)
Modified: webservices/wss4j/trunk/test/wssec/TestWSSecurityNew14.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/test/wssec/TestWSSecurityNew14.java?rev=776253&r1=776252&r2=776253&view=diff
==============================================================================
--- webservices/wss4j/trunk/test/wssec/TestWSSecurityNew14.java (original)
+++ webservices/wss4j/trunk/test/wssec/TestWSSecurityNew14.java Tue May 19 09:55:03 2009
@@ -36,7 +36,6 @@
import org.apache.ws.security.components.crypto.Crypto;
import org.apache.ws.security.components.crypto.CryptoFactory;
import org.apache.ws.security.handler.RequestData;
-import org.apache.ws.security.handler.WSHandler;
import org.apache.ws.security.handler.WSHandlerConstants;
import org.apache.ws.security.message.WSSecEncrypt;
import org.apache.ws.security.message.WSSecSignature;
@@ -332,11 +331,12 @@
actions.add(new Integer(WSConstants.ENCR));
final Document doc = unsignedEnvelope.getAsDocument();
MyHandler handler = new MyHandler();
- handler.doit(
+ handler.send(
WSConstants.ENCR,
doc,
reqData,
- actions
+ actions,
+ true
);
String outputString =
@@ -378,51 +378,4 @@
}
}
- /**
- * a trivial extension of the WSHandler type
- */
- private static class MyHandler extends WSHandler {
-
- public Object
- getOption(String key) {
- return null;
- }
-
- public void
- setProperty(
- Object msgContext,
- String key,
- Object value
- ) {
- }
-
- public Object
- getProperty(Object ctx, String key) {
- return ((java.util.Map)ctx).get(key);
- }
-
- public void
- setPassword(Object msgContext, String password) {
- }
-
- public String
- getPassword(Object msgContext) {
- return null;
- }
-
- void doit(
- int action,
- Document doc,
- RequestData reqData,
- java.util.Vector actions
- ) throws org.apache.ws.security.WSSecurityException {
- doSenderAction(
- action,
- doc,
- reqData,
- actions,
- true
- );
- }
- }
}
Modified: webservices/wss4j/trunk/test/wssec/TestWSSecurityNew17.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/test/wssec/TestWSSecurityNew17.java?rev=776253&r1=776252&r2=776253&view=diff
==============================================================================
--- webservices/wss4j/trunk/test/wssec/TestWSSecurityNew17.java (original)
+++ webservices/wss4j/trunk/test/wssec/TestWSSecurityNew17.java Tue May 19 09:55:03 2009
@@ -48,7 +48,6 @@
import org.apache.ws.security.components.crypto.Crypto;
import org.apache.ws.security.components.crypto.CryptoFactory;
import org.apache.ws.security.handler.RequestData;
-import org.apache.ws.security.handler.WSHandler;
import org.apache.ws.security.handler.WSHandlerConstants;
import org.apache.ws.security.message.WSSecEncrypt;
import org.apache.ws.security.message.WSSecEncryptedKey;
@@ -271,7 +270,8 @@
WSConstants.SIGN,
doc,
reqData,
- actions
+ actions,
+ true
);
String outputString =
@@ -329,61 +329,5 @@
}
}
- /**
- * a trivial extension of the WSHandler type
- */
- private static class MyHandler extends WSHandler {
-
- public Object
- getOption(String key) {
- return null;
- }
-
- public void
- setProperty(
- Object msgContext,
- String key,
- Object value
- ) {
- }
-
- public Object
- getProperty(Object ctx, String key) {
- return ((java.util.Map)ctx).get(key);
- }
-
- public void
- setPassword(Object msgContext, String password) {
- }
-
- public String
- getPassword(Object msgContext) {
- return null;
- }
- void send(
- int action,
- Document doc,
- RequestData reqData,
- java.util.Vector actions
- ) throws org.apache.ws.security.WSSecurityException {
- doSenderAction(
- action,
- doc,
- reqData,
- actions,
- true
- );
- }
-
- void receive(
- int action,
- RequestData reqData
- ) throws org.apache.ws.security.WSSecurityException {
- doReceiverAction(
- action,
- reqData
- );
- }
- }
}
Modified: webservices/wss4j/trunk/test/wssec/TestWSSecurityNew18.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/test/wssec/TestWSSecurityNew18.java?rev=776253&r1=776252&r2=776253&view=diff
==============================================================================
--- webservices/wss4j/trunk/test/wssec/TestWSSecurityNew18.java (original)
+++ webservices/wss4j/trunk/test/wssec/TestWSSecurityNew18.java Tue May 19 09:55:03 2009
@@ -35,7 +35,6 @@
import org.apache.ws.security.components.crypto.Crypto;
import org.apache.ws.security.components.crypto.CryptoFactory;
import org.apache.ws.security.handler.RequestData;
-import org.apache.ws.security.handler.WSHandler;
import org.apache.ws.security.handler.WSHandlerConstants;
import org.apache.ws.security.message.WSSecSignature;
import org.apache.ws.security.message.WSSecHeader;
@@ -223,11 +222,12 @@
actions.add(new Integer(action));
final Document doc = unsignedEnvelope.getAsDocument();
MyHandler handler = new MyHandler();
- handler.doit(
+ handler.send(
action,
doc,
reqData,
- actions
+ actions,
+ true
);
String outputString =
org.apache.ws.security.util.XMLUtils.PrettyDocumentToString(doc);
@@ -245,51 +245,5 @@
verify(doc);
}
- /**
- * a trivial extension of the WSHandler type
- */
- public static class MyHandler extends WSHandler {
-
- public Object
- getOption(String key) {
- return null;
- }
-
- public void
- setProperty(
- Object msgContext,
- String key,
- Object value
- ) {
- }
-
- public Object
- getProperty(Object ctx, String key) {
- return ((java.util.Map)ctx).get(key);
- }
-
- public void
- setPassword(Object msgContext, String password) {
- }
-
- public String
- getPassword(Object msgContext) {
- return (String)((java.util.Map)msgContext).get("password");
- }
- void doit(
- int action,
- Document doc,
- RequestData reqData,
- java.util.Vector actions
- ) throws org.apache.ws.security.WSSecurityException {
- doSenderAction(
- action,
- doc,
- reqData,
- actions,
- true
- );
- }
- }
}
Modified: webservices/wss4j/trunk/test/wssec/TestWSSecurityNewST1.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/test/wssec/TestWSSecurityNewST1.java?rev=776253&r1=776252&r2=776253&view=diff
==============================================================================
--- webservices/wss4j/trunk/test/wssec/TestWSSecurityNewST1.java (original)
+++ webservices/wss4j/trunk/test/wssec/TestWSSecurityNewST1.java Tue May 19 09:55:03 2009
@@ -45,7 +45,7 @@
import java.io.ByteArrayInputStream;
import java.io.InputStream;
-import java.util.Vector;
+import java.util.List;
/**
* Test-case for sending and processing an unsigned (sender vouches) SAML Assertion.
@@ -137,7 +137,7 @@
LOG.debug(outputString);
}
- Vector results = verify(unsignedDoc);
+ List results = verify(unsignedDoc);
WSSecurityEngineResult actionResult =
WSSecurityUtil.fetchActionResult(results, WSConstants.ST_UNSIGNED);
SAMLAssertion receivedAssertion =
@@ -152,8 +152,8 @@
* @param envelope
* @throws Exception Thrown when there is a problem in verification
*/
- private Vector verify(Document doc) throws Exception {
- Vector results = secEngine.processSecurityHeader(doc, null, null, null);
+ private List verify(Document doc) throws Exception {
+ List results = secEngine.processSecurityHeader(doc, null, null, null);
String outputString =
org.apache.ws.security.util.XMLUtils.PrettyDocumentToString(doc);
assertTrue(outputString.indexOf("LogTestService2") > 0 ? true : false);
Modified: webservices/wss4j/trunk/test/wssec/TestWSSecurityNewST2.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/test/wssec/TestWSSecurityNewST2.java?rev=776253&r1=776252&r2=776253&view=diff
==============================================================================
--- webservices/wss4j/trunk/test/wssec/TestWSSecurityNewST2.java (original)
+++ webservices/wss4j/trunk/test/wssec/TestWSSecurityNewST2.java Tue May 19 09:55:03 2009
@@ -43,7 +43,6 @@
import org.apache.ws.security.components.crypto.Crypto;
import org.apache.ws.security.components.crypto.CryptoFactory;
import org.apache.ws.security.handler.RequestData;
-import org.apache.ws.security.handler.WSHandler;
import org.apache.ws.security.handler.WSHandlerConstants;
import org.apache.ws.security.message.WSSecHeader;
import org.w3c.dom.Document;
@@ -56,7 +55,7 @@
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
-import java.util.Vector;
+import java.util.List;
/**
* Test-case for sending and processing an signed (sender vouches) SAML Assertion.
@@ -156,7 +155,7 @@
LOG.debug(outputString);
}
- Vector results = verify(signedDoc);
+ List results = verify(signedDoc);
WSSecurityEngineResult actionResult =
WSSecurityUtil.fetchActionResult(results, WSConstants.ST_UNSIGNED);
SAMLAssertion receivedAssertion =
@@ -199,7 +198,7 @@
LOG.debug(outputString);
}
- Vector results = verify(signedDoc);
+ List results = verify(signedDoc);
WSSecurityEngineResult actionResult =
WSSecurityUtil.fetchActionResult(results, WSConstants.ST_UNSIGNED);
SAMLAssertion receivedAssertion =
@@ -243,7 +242,7 @@
LOG.debug(outputString);
}
- Vector results = verify(signedDoc);
+ List results = verify(signedDoc);
WSSecurityEngineResult actionResult =
WSSecurityUtil.fetchActionResult(results, WSConstants.ST_UNSIGNED);
SAMLAssertion receivedAssertion =
@@ -290,7 +289,7 @@
reqData.setMsgContext(msgContext);
MyHandler handler = new MyHandler();
- handler.doit(WSConstants.ST_SIGNED, reqData);
+ handler.receive(WSConstants.ST_SIGNED, reqData);
secEngine.processSecurityHeader(
signedDoc, null, this, reqData.getSigCrypto(), reqData.getDecCrypto()
@@ -304,7 +303,7 @@
handler = new MyHandler();
try {
- handler.doit(WSConstants.ST_SIGNED, reqData);
+ handler.receive(WSConstants.ST_SIGNED, reqData);
fail("Failure expected on a bad crypto properties file");
} catch (RuntimeException ex) {
// expected
@@ -318,8 +317,8 @@
* @param doc
* @throws Exception Thrown when there is a problem in verification
*/
- private Vector verify(Document doc) throws Exception {
- Vector results = secEngine.processSecurityHeader(doc, null, this, crypto);
+ private List verify(Document doc) throws Exception {
+ List results = secEngine.processSecurityHeader(doc, null, this, crypto);
String outputString =
org.apache.ws.security.util.XMLUtils.PrettyDocumentToString(doc);
assertTrue(outputString.indexOf("LogTestService2") > 0 ? true : false);
@@ -344,44 +343,4 @@
}
}
- /**
- * a trivial extension of the WSHandler type
- */
- public static class MyHandler extends WSHandler {
-
- public Object
- getOption(String key) {
- return null;
- }
-
- public void
- setProperty(
- Object msgContext,
- String key,
- Object value
- ) {
- }
-
- public Object
- getProperty(Object ctx, String key) {
- java.util.Map ctxMap = (java.util.Map)ctx;
- return ctxMap.get(key);
- }
-
- public void
- setPassword(Object msgContext, String password) {
- }
-
- public String
- getPassword(Object msgContext) {
- return null;
- }
-
- void doit(
- int action,
- RequestData reqData
- ) throws org.apache.ws.security.WSSecurityException {
- doReceiverAction(action, reqData);
- }
- }
}
Modified: webservices/wss4j/trunk/test/wssec/TestWSSecurityNewST3.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/test/wssec/TestWSSecurityNewST3.java?rev=776253&r1=776252&r2=776253&view=diff
==============================================================================
--- webservices/wss4j/trunk/test/wssec/TestWSSecurityNewST3.java (original)
+++ webservices/wss4j/trunk/test/wssec/TestWSSecurityNewST3.java Tue May 19 09:55:03 2009
@@ -53,7 +53,7 @@
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
-import java.util.Vector;
+import java.util.List;
/**
* Test-case for sending and processing a (signed) holder-of-key SAML Assertion.
@@ -158,7 +158,7 @@
LOG.debug(outputString);
}
- Vector results = verify(signedDoc);
+ List results = verify(signedDoc);
WSSecurityEngineResult actionResult =
WSSecurityUtil.fetchActionResult(results, WSConstants.ST_UNSIGNED);
SAMLAssertion receivedAssertion =
@@ -206,7 +206,7 @@
LOG.debug(outputString);
}
- Vector results = verify(signedDoc);
+ List results = verify(signedDoc);
WSSecurityEngineResult actionResult =
WSSecurityUtil.fetchActionResult(results, WSConstants.ST_UNSIGNED);
SAMLAssertion receivedAssertion =
@@ -221,8 +221,8 @@
* @param envelope
* @throws Exception Thrown when there is a problem in verification
*/
- private Vector verify(Document doc) throws Exception {
- Vector results = secEngine.processSecurityHeader(doc, null, this, crypto);
+ private List verify(Document doc) throws Exception {
+ List results = secEngine.processSecurityHeader(doc, null, this, crypto);
String outputString =
org.apache.ws.security.util.XMLUtils.PrettyDocumentToString(doc);
assertTrue(outputString.indexOf("LogTestService2") > 0 ? true : false);
---------------------------------------------------------------------
To unsubscribe, e-mail: wss4j-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: wss4j-dev-help@ws.apache.org