You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ws.apache.org by co...@apache.org on 2010/11/12 18:29:55 UTC
svn commit: r1034482 [1/2] - in
/webservices/wss4j/trunk/src/org/apache/ws/security: ./ action/
components/crypto/ handler/ message/ message/token/ processor/ saml/ util/
Author: coheigea
Date: Fri Nov 12 17:29:54 2010
New Revision: 1034482
URL: http://svn.apache.org/viewvc?rev=1034482&view=rev
Log:
[WSS-249] - Parameterize Collections in WSS4J 1.6
- Fixed a bug in WSDocInfo, and some changes to WSHandler as well.
Modified:
webservices/wss4j/trunk/src/org/apache/ws/security/WSDocInfo.java
webservices/wss4j/trunk/src/org/apache/ws/security/WSDocInfoStore.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/WSSecurityEngineResult.java
webservices/wss4j/trunk/src/org/apache/ws/security/WSSecurityException.java
webservices/wss4j/trunk/src/org/apache/ws/security/action/SignatureConfirmationAction.java
webservices/wss4j/trunk/src/org/apache/ws/security/action/UsernameTokenSignedAction.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/WSHandlerConstants.java
webservices/wss4j/trunk/src/org/apache/ws/security/handler/WSHandlerResult.java
webservices/wss4j/trunk/src/org/apache/ws/security/handler/WSS4JHandler.java
webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecBase.java
webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecDKEncrypt.java
webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecDKSign.java
webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecEncrypt.java
webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecSignature.java
webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecSignatureBase.java
webservices/wss4j/trunk/src/org/apache/ws/security/message/token/DerivedKeyToken.java
webservices/wss4j/trunk/src/org/apache/ws/security/message/token/Timestamp.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/saml/SAMLIssuerImpl.java
webservices/wss4j/trunk/src/org/apache/ws/security/saml/SAMLUtil.java
webservices/wss4j/trunk/src/org/apache/ws/security/saml/WSSecSignatureSAML.java
webservices/wss4j/trunk/src/org/apache/ws/security/util/WSSecurityUtil.java
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=1034482&r1=1034481&r2=1034482&view=diff
==============================================================================
--- webservices/wss4j/trunk/src/org/apache/ws/security/WSDocInfo.java (original)
+++ webservices/wss4j/trunk/src/org/apache/ws/security/WSDocInfo.java Fri Nov 12 17:29:54 2010
@@ -39,17 +39,16 @@ import org.apache.ws.security.processor.
import org.w3c.dom.Document;
import org.w3c.dom.Element;
-import java.util.Iterator;
import java.util.List;
import java.util.Vector;
public class WSDocInfo {
Document doc = null;
Crypto crypto = null;
- List bstList = null;
+ List<Element> bstList = null;
Element assertion = null;
- List processors = null;
- List securityTokenReferences = null;
+ List<Processor> processors = null;
+ List<Element> securityTokenReferences = null;
public WSDocInfo(Document doc) {
//
@@ -68,7 +67,7 @@ public class WSDocInfo {
*/
public void setSecurityTokenReference(Element securityTokenRef) {
if (securityTokenReferences == null) {
- securityTokenReferences = new Vector();
+ securityTokenReferences = new Vector<Element>();
}
securityTokenReferences.add(securityTokenRef);
}
@@ -81,8 +80,7 @@ public class WSDocInfo {
*/
public Element getSecurityTokenReference(String uri) {
if (securityTokenReferences != null) {
- for (Iterator iter = securityTokenReferences.iterator(); iter.hasNext();) {
- Element elem = (Element)iter.next();
+ for (Element elem : securityTokenReferences) {
String cId = elem.getAttributeNS(WSConstants.WSU_NS, "Id");
if (uri.equals(cId)) {
return elem;
@@ -120,18 +118,15 @@ public class WSDocInfo {
if (id.charAt(0) == '#') {
id = id.substring(1);
}
- Element elem = null;
-
if (bstList != null) {
- for (Iterator iter = bstList.iterator(); iter.hasNext();) {
- elem = (Element) iter.next();
- String cId = elem.getAttribute("Id");
+ for (Element elem : bstList) {
+ String cId = elem.getAttributeNS(WSConstants.WSU_NS, "Id");
if (id.equals(cId)) {
- break;
+ return elem;
}
}
}
- return elem;
+ return null;
}
/**
@@ -145,10 +140,8 @@ public class WSDocInfo {
return null;
}
- Processor p = null;
if (processors != null) {
- for (Iterator iter = processors.iterator(); iter.hasNext();) {
- p = (Processor) iter.next();
+ for (Processor p : processors) {
String cId = p.getId();
if (id.equals(cId)) {
return p;
@@ -165,7 +158,7 @@ public class WSDocInfo {
*/
public void setProcessor(Processor p) {
if (processors == null) {
- processors = new Vector();
+ processors = new Vector<Processor>();
}
processors.add(p);
}
@@ -190,7 +183,7 @@ public class WSDocInfo {
*/
public void setBst(Element elem) {
if (bstList == null) {
- bstList = new Vector();
+ bstList = new Vector<Element>();
}
bstList.add(elem);
}
Modified: webservices/wss4j/trunk/src/org/apache/ws/security/WSDocInfoStore.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/org/apache/ws/security/WSDocInfoStore.java?rev=1034482&r1=1034481&r2=1034482&view=diff
==============================================================================
--- webservices/wss4j/trunk/src/org/apache/ws/security/WSDocInfoStore.java (original)
+++ webservices/wss4j/trunk/src/org/apache/ws/security/WSDocInfoStore.java Fri Nov 12 17:29:54 2010
@@ -30,14 +30,15 @@ package org.apache.ws.security;
* @author Werner Dittmann (Werner.Dittmann@apache.org)
*/
-import java.util.Hashtable;
import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
import org.w3c.dom.Document;
public class WSDocInfoStore {
- private static final Map STORAGE = new Hashtable(10);
+ private static final Map<Document, WSDocInfo> STORAGE =
+ new ConcurrentHashMap<Document, WSDocInfo>();
public static WSDocInfo lookup(Document doc) {
return (WSDocInfo) STORAGE.get(doc);
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=1034482&r1=1034481&r2=1034482&view=diff
==============================================================================
--- webservices/wss4j/trunk/src/org/apache/ws/security/WSSConfig.java (original)
+++ webservices/wss4j/trunk/src/org/apache/ws/security/WSSConfig.java Fri Nov 12 17:29:54 2010
@@ -53,9 +53,9 @@ public class WSSConfig {
/**
* The default collection of actions supported by the toolkit.
*/
- private static final Map DEFAULT_ACTIONS;
+ private static final Map<Integer, String> DEFAULT_ACTIONS;
static {
- final Map tmp = new HashMap();
+ final Map<Integer, String> tmp = new HashMap<Integer, String>();
try {
tmp.put(
new Integer(WSConstants.UT),
@@ -105,9 +105,9 @@ public class WSSConfig {
/**
* The default collection of processors supported by the toolkit
*/
- private static final Map DEFAULT_PROCESSORS;
+ private static final Map<QName, String> DEFAULT_PROCESSORS;
static {
- final Map tmp = new HashMap();
+ final Map<QName, String> tmp = new HashMap<QName, String>();
try {
tmp.put(
WSSecurityEngine.SAML_TOKEN,
@@ -257,7 +257,7 @@ public class WSSConfig {
};
protected WsuIdAllocator idAllocator = DEFAULT_ID_ALLOCATOR;
- protected java.util.Map jceProvider = new HashMap(10);
+ protected Map<String, String> jceProvider = new HashMap<String, String>();
/**
* The known actions. This map is of the form <Integer, String> or <Integer, Action>.
@@ -630,7 +630,7 @@ public class WSSConfig {
String newName = null;
try {
if (Security.getProvider(name) == null) {
- Class c = Loader.loadClass(className, false);
+ Class<?> c = Loader.loadClass(className, false);
Provider[] provs = Security.getProviders();
Provider newProvider = (Provider)c.newInstance();
//
@@ -693,7 +693,7 @@ public class WSSConfig {
String newName = null;
try {
if (Security.getProvider(name) == null) {
- Class c = Loader.loadClass(className, false);
+ Class<?> c = Loader.loadClass(className, false);
Provider newProvider = (Provider)c.newInstance();
int ret = Security.addProvider(newProvider);
if (log.isDebugEnabled()) {
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=1034482&r1=1034481&r2=1034482&view=diff
==============================================================================
--- webservices/wss4j/trunk/src/org/apache/ws/security/WSSecurityEngine.java (original)
+++ webservices/wss4j/trunk/src/org/apache/ws/security/WSSecurityEngine.java Fri Nov 12 17:29:54 2010
@@ -184,7 +184,7 @@ public class WSSecurityEngine {
* @see WSSecurityEngine#processSecurityHeader(Element securityHeader, CallbackHandler cb,
* Crypto sigCrypto, Crypto decCrypto)
*/
- public List processSecurityHeader(
+ public List<WSSecurityEngineResult> processSecurityHeader(
Document doc,
String actor,
CallbackHandler cb,
@@ -215,7 +215,7 @@ public class WSSecurityEngine {
* @see WSSecurityEngine#processSecurityHeader(
* Element securityHeader, CallbackHandler cb, Crypto sigCrypto, Crypto decCrypto)
*/
- public List processSecurityHeader(
+ public List<WSSecurityEngineResult> processSecurityHeader(
Document doc,
String actor,
CallbackHandler cb,
@@ -230,7 +230,7 @@ public class WSSecurityEngine {
if (actor == null) {
actor = "";
}
- List wsResult = null;
+ List<WSSecurityEngineResult> wsResult = null;
Element elem = WSSecurityUtil.getSecurityHeader(doc, actor);
if (elem != null) {
if (doDebug) {
@@ -280,7 +280,7 @@ public class WSSecurityEngine {
* was performed.
* @throws WSSecurityException
*/
- protected List processSecurityHeader(
+ protected List<WSSecurityEngineResult> processSecurityHeader(
Element securityHeader,
CallbackHandler cb,
Crypto sigCrypto,
@@ -302,7 +302,7 @@ public class WSSecurityEngine {
if (tlog.isDebugEnabled()) {
t1 = System.currentTimeMillis();
}
- List returnResults = new Vector();
+ List<WSSecurityEngineResult> returnResults = new Vector<WSSecurityEngineResult>();
final WSSConfig cfg = getWssConfig();
Node node = securityHeader.getFirstChild();
while (node != null) {
Modified: webservices/wss4j/trunk/src/org/apache/ws/security/WSSecurityEngineResult.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/org/apache/ws/security/WSSecurityEngineResult.java?rev=1034482&r1=1034481&r2=1034482&view=diff
==============================================================================
--- webservices/wss4j/trunk/src/org/apache/ws/security/WSSecurityEngineResult.java (original)
+++ webservices/wss4j/trunk/src/org/apache/ws/security/WSSecurityEngineResult.java Fri Nov 12 17:29:54 2010
@@ -31,39 +31,35 @@ import java.util.List;
/**
* @author Werner Dittmann (Werner.Dittmann@t-online.de)
*/
-public class WSSecurityEngineResult extends java.util.HashMap {
+public class WSSecurityEngineResult extends java.util.HashMap<String, Object> {
/**
* Tag denoting the cryptographic operation performed
*
* The value under this tag is of type java.lang.Integer
*/
- public static final java.lang.String TAG_ACTION =
- "action";
+ public static final String TAG_ACTION = "action";
/**
* Tag denoting the security principal found, if applicable.
*
* The value under this tag is of type java.security.Principal.
*/
- public static final java.lang.String TAG_PRINCIPAL =
- "principal";
+ public static final String TAG_PRINCIPAL = "principal";
/**
* Tag denoting the X.509 certificate found, if applicable.
*
* The value under this tag is of type java.security.cert.X509Certificate.
*/
- public static final java.lang.String TAG_X509_CERTIFICATE =
- "x509-certificate";
+ public static final String TAG_X509_CERTIFICATE = "x509-certificate";
/**
* Tag denoting the SAML Assertion found, if applicable.
*
* The value under this tag is of type org.opensaml.SAMLAssertion.
*/
- public static final java.lang.String TAG_SAML_ASSERTION =
- "saml-assertion";
+ public static final String TAG_SAML_ASSERTION = "saml-assertion";
/**
* Tag denoting the timestamp found, if applicable.
@@ -71,16 +67,14 @@ public class WSSecurityEngineResult exte
* The value under this tag is of type
* org.apache.ws.security.message.token.Timestamp.
*/
- public static final java.lang.String TAG_TIMESTAMP =
- "timestamp";
+ public static final String TAG_TIMESTAMP = "timestamp";
/**
* Tag denoting the signature value of a signed element, if applicable.
*
* The value under this tag is of type byte[].
*/
- public static final java.lang.String TAG_SIGNATURE_VALUE =
- "signature-value";
+ public static final String TAG_SIGNATURE_VALUE = "signature-value";
/**
* Tag denoting the signature confirmation of a signed element,
@@ -89,8 +83,7 @@ public class WSSecurityEngineResult exte
* The value under this tag is of type
* org.apache.ws.security.message.token.SignatureConfirmation.
*/
- public static final java.lang.String TAG_SIGNATURE_CONFIRMATION =
- "signature-confirmation";
+ public static final java.lang.String TAG_SIGNATURE_CONFIRMATION = "signature-confirmation";
/**
* Tag denoting references to the DOM elements that have been
@@ -98,76 +91,70 @@ public class WSSecurityEngineResult exte
*
* The value under this tag is of type SecurityContextToken.
*/
- public static final java.lang.String TAG_SECURITY_CONTEXT_TOKEN =
- "security-context-token";
+ public static final String TAG_SECURITY_CONTEXT_TOKEN = "security-context-token";
/**
* Tag denoting a reference to the decrypted key
*
* The value under this tag is of type byte[].
*/
- public static final java.lang.String TAG_DECRYPTED_KEY =
- "decrypted-key";
+ public static final String TAG_DECRYPTED_KEY = "decrypted-key";
/**
* Tag denoting references to the encrypted key id.
*
* The value under this tag is of type String.
*/
- public static final java.lang.String TAG_ENCRYPTED_KEY_ID =
- "encrypted-key-id";
+ public static final String TAG_ENCRYPTED_KEY_ID = "encrypted-key-id";
/**
* Tag denoting references to a List of Data ref URIs.
*
* The value under this tag is of type List.
*/
- public static final java.lang.String TAG_DATA_REF_URIS =
- "data-ref-uris";
+ public static final String TAG_DATA_REF_URIS = "data-ref-uris";
/**
* Tag denoting the X.509 certificate chain found, if applicable.
*
* The value under this tag is of type java.security.cert.X509Certificate[].
*/
- public static final java.lang.String TAG_X509_CERTIFICATES =
- "x509-certificates";
+ public static final String TAG_X509_CERTIFICATES = "x509-certificates";
/**
* Tag denoting the X.509 certificate found, if applicable.
*
* The value under this tag is of type java.security.cert.X509Certificate.
*/
- public static final java.lang.String TAG_BINARY_SECURITY_TOKEN =
- "binary-security-token";
+ public static final String TAG_BINARY_SECURITY_TOKEN = "binary-security-token";
/**
* Tag denoting the encrypted key bytes
*
* The value under this tag is a byte array
*/
- public static final Object TAG_ENCRYPTED_EPHEMERAL_KEY = "encrypted-ephemeral-key-bytes";
+ public static final String TAG_ENCRYPTED_EPHEMERAL_KEY = "encrypted-ephemeral-key-bytes";
/**
* Tag denoting the encrypted key transport algorithm.
*
* The value under this tag is of type String.
*/
- public static final Object TAG_ENCRYPTED_KEY_TRANSPORT_METHOD = "encrypted-key-transport-method";
+ public static final String TAG_ENCRYPTED_KEY_TRANSPORT_METHOD = "encrypted-key-transport-method";
/**
* Tag denoting the algorithm that was used to sign the message
*
* The value under this tag is of type String.
*/
- public static final Object TAG_SIGNATURE_METHOD = "signature-method";
+ public static final String TAG_SIGNATURE_METHOD = "signature-method";
/**
* Tag denoting the algorithm that was used to do canonicalization
*
* The value under this tag is of type String.
*/
- public static final Object TAG_CANONICALIZATION_METHOD = "canonicalization-method";
+ public static final String TAG_CANONICALIZATION_METHOD = "canonicalization-method";
public WSSecurityEngineResult(
int act,
@@ -197,7 +184,7 @@ public class WSSecurityEngineResult exte
int act,
Principal princ,
X509Certificate[] certs,
- List dataRefs,
+ List<WSDataRef> dataRefs,
byte[] sv
) {
this(act, princ, certs, sv);
@@ -209,7 +196,7 @@ public class WSSecurityEngineResult exte
byte[] decryptedKey,
byte[] encryptedKeyBytes,
String encyptedKeyId,
- List dataRefUris
+ List<WSDataRef> dataRefUris
) {
put(TAG_ACTION, new Integer(act));
put(TAG_DECRYPTED_KEY, decryptedKey);
@@ -223,7 +210,7 @@ public class WSSecurityEngineResult exte
byte[] decryptedKey,
byte[] encryptedKeyBytes,
String encyptedKeyId,
- List dataRefUris,
+ List<WSDataRef> dataRefUris,
X509Certificate[] certs
) {
put(TAG_ACTION, new Integer(act));
@@ -237,7 +224,7 @@ public class WSSecurityEngineResult exte
}
}
- public WSSecurityEngineResult(int act, List dataRefUris) {
+ public WSSecurityEngineResult(int act, List<WSDataRef> dataRefUris) {
put(TAG_ACTION, new Integer(act));
put(TAG_DATA_REF_URIS, dataRefUris);
}
Modified: webservices/wss4j/trunk/src/org/apache/ws/security/WSSecurityException.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/org/apache/ws/security/WSSecurityException.java?rev=1034482&r1=1034481&r2=1034482&view=diff
==============================================================================
--- webservices/wss4j/trunk/src/org/apache/ws/security/WSSecurityException.java (original)
+++ webservices/wss4j/trunk/src/org/apache/ws/security/WSSecurityException.java Fri Nov 12 17:29:54 2010
@@ -23,6 +23,7 @@ import java.rmi.RemoteException;
import java.text.MessageFormat;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
+import javax.xml.namespace.QName;
/**
* Exception class for WS-Security.
@@ -50,7 +51,8 @@ public class WSSecurityException extends
* any parsing of the error code. Note that there are no mappings for "FAILURE",
* "FAILED_ENCRYPTION" and "FAILED_SIGNATURE" as these are not standard error messages.
*/
- private static final java.util.Map FAULT_CODE_MAP = new java.util.HashMap();
+ private static final java.util.Map<Integer, QName> FAULT_CODE_MAP =
+ new java.util.HashMap<Integer, QName>();
static {
try {
Modified: webservices/wss4j/trunk/src/org/apache/ws/security/action/SignatureConfirmationAction.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/org/apache/ws/security/action/SignatureConfirmationAction.java?rev=1034482&r1=1034481&r2=1034482&view=diff
==============================================================================
--- webservices/wss4j/trunk/src/org/apache/ws/security/action/SignatureConfirmationAction.java (original)
+++ webservices/wss4j/trunk/src/org/apache/ws/security/action/SignatureConfirmationAction.java Fri Nov 12 17:29:54 2010
@@ -39,14 +39,17 @@ import java.util.Vector;
public class SignatureConfirmationAction implements Action {
protected static Log log = LogFactory.getLog(WSHandler.class.getName());
+ @SuppressWarnings("unchecked")
public void execute(WSHandler handler, int actionToDo, Document doc, RequestData reqData)
throws WSSecurityException {
if (log.isDebugEnabled()) {
log.debug("Perform Signature confirmation");
}
- List results =
- (List) handler.getProperty(reqData.getMsgContext(), WSHandlerConstants.RECV_RESULTS);
+ List<WSHandlerResult> results =
+ (List<WSHandlerResult>) handler.getProperty(
+ reqData.getMsgContext(), WSHandlerConstants.RECV_RESULTS
+ );
if (results == null) {
return;
}
@@ -54,10 +57,9 @@ public class SignatureConfirmationAction
// Loop over all the (signature) results gathered by all the processors, and store
// them in a list.
//
- List signatureActions = new Vector();
- for (int i = 0; i < results.size(); i++) {
- WSHandlerResult wshResult = (WSHandlerResult) results.get(i);
- List resultList = wshResult.getResults();
+ List<WSSecurityEngineResult> signatureActions = new Vector<WSSecurityEngineResult>();
+ for (WSHandlerResult wshResult : results) {
+ List<WSSecurityEngineResult> resultList = wshResult.getResults();
WSSecurityUtil.fetchAllActionResults(
resultList, WSConstants.SIGN, signatureActions
@@ -73,7 +75,7 @@ public class SignatureConfirmationAction
// prepare a SignatureConfirmation token
//
WSSecSignatureConfirmation wsc = new WSSecSignatureConfirmation();
- List signatureParts = reqData.getSignatureParts();
+ List<WSEncryptionPart> signatureParts = reqData.getSignatureParts();
if (signatureActions.size() > 0) {
if (log.isDebugEnabled()) {
log.debug("Signature Confirmation: number of Signature results: "
Modified: webservices/wss4j/trunk/src/org/apache/ws/security/action/UsernameTokenSignedAction.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/org/apache/ws/security/action/UsernameTokenSignedAction.java?rev=1034482&r1=1034481&r2=1034482&view=diff
==============================================================================
--- webservices/wss4j/trunk/src/org/apache/ws/security/action/UsernameTokenSignedAction.java (original)
+++ webservices/wss4j/trunk/src/org/apache/ws/security/action/UsernameTokenSignedAction.java Fri Nov 12 17:29:54 2010
@@ -108,7 +108,7 @@ public class UsernameTokenSignedAction i
// sign.prependToHeader(reqData.getSecHeader());
// builder.prependToHeader(reqData.getSecHeader());
- List parts = null;
+ List<WSEncryptionPart> parts = null;
if (reqData.getSignatureParts().size() > 0) {
parts = reqData.getSignatureParts();
} else {
@@ -116,12 +116,13 @@ public class UsernameTokenSignedAction i
if (soapConstants == null) {
soapConstants = WSSecurityUtil.getSOAPConstants(doc.getDocumentElement());
}
- parts = new Vector();
+ parts = new Vector<WSEncryptionPart>();
WSEncryptionPart encP =
new WSEncryptionPart(WSConstants.ELEM_BODY, soapConstants.getEnvelopeURI(), "Content");
parts.add(encP);
}
- List referenceList = sign.addReferencesToSign(parts, reqData.getSecHeader());
+ List<javax.xml.crypto.dsig.Reference> referenceList =
+ sign.addReferencesToSign(parts, reqData.getSecHeader());
try {
sign.computeSignature(referenceList);
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=1034482&r1=1034481&r2=1034482&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 Fri Nov 12 17:29:54 2010
@@ -75,16 +75,17 @@ public abstract class CryptoBase impleme
public static final String NAME_CONSTRAINTS_OID = "2.5.29.30";
private static Log log = LogFactory.getLog(CryptoBase.class);
- private static final Constructor BC_509CLASS_CONS;
+ private static final Constructor<?> BC_509CLASS_CONS;
- protected static Map certFactMap = new HashMap();
+ protected static Map<String, CertificateFactory> certFactMap =
+ new HashMap<String, CertificateFactory>();
protected KeyStore keystore = null;
protected KeyStore truststore = null;
static {
- Constructor cons = null;
+ Constructor<?> cons = null;
try {
- Class c = Class.forName("org.bouncycastle.asn1.x509.X509Name");
+ Class<?> c = Class.forName("org.bouncycastle.asn1.x509.X509Name");
cons = c.getConstructor(new Class[] {String.class});
} catch (Exception e) {
//ignore
@@ -240,7 +241,7 @@ public abstract class CryptoBase impleme
}
protected static String createKeyStoreErrorMessage(KeyStore keystore) throws KeyStoreException {
- Enumeration aliases = keystore.aliases();
+ Enumeration<String> aliases = keystore.aliases();
StringBuffer sb = new StringBuffer(keystore.size() * 7);
boolean firstAlias = true;
while (aliases.hasMoreElements()) {
@@ -257,9 +258,9 @@ public abstract class CryptoBase impleme
return msg;
}
- protected List splitAndTrim(String inString) {
+ protected List<String> splitAndTrim(String inString) {
X509NameTokenizer nmTokens = new X509NameTokenizer(inString);
- List vr = new Vector();
+ List<String> vr = new Vector<String>();
while (nmTokens.hasMoreTokens()) {
vr.add(nmTokens.nextToken());
@@ -317,8 +318,8 @@ public abstract class CryptoBase impleme
}
try {
- for (Enumeration e = keystore.aliases(); e.hasMoreElements();) {
- String alias = (String) e.nextElement();
+ for (Enumeration<String> e = keystore.aliases(); e.hasMoreElements();) {
+ String alias = e.nextElement();
Certificate[] certs = keystore.getCertificateChain(alias);
if (certs == null || certs.length == 0) {
// no cert chain, so lets check if getCertificate gives us a result.
@@ -382,8 +383,8 @@ public abstract class CryptoBase impleme
}
try {
- for (Enumeration e = keystore.aliases(); e.hasMoreElements();) {
- String alias = (String) e.nextElement();
+ for (Enumeration<String> e = keystore.aliases(); e.hasMoreElements();) {
+ String alias = e.nextElement();
Certificate[] certs = keystore.getCertificateChain(alias);
if (certs == null || certs.length == 0) {
// no cert chain, so lets check if getCertificate gives us a result.
@@ -468,8 +469,8 @@ public abstract class CryptoBase impleme
return null;
}
try {
- for (Enumeration e = keystore.aliases(); e.hasMoreElements();) {
- String alias = (String) e.nextElement();
+ for (Enumeration<String> e = keystore.aliases(); e.hasMoreElements();) {
+ String alias = e.nextElement();
Certificate[] certs = keystore.getCertificateChain(alias);
if (certs == null || certs.length == 0) {
// no cert chain, so lets check if getCertificate gives us a result.
@@ -515,8 +516,8 @@ public abstract class CryptoBase impleme
// if (alias != null) {
// return alias;
// }
- for (Enumeration e = keystore.aliases(); e.hasMoreElements();) {
- String alias = (String) e.nextElement();
+ for (Enumeration<String> e = keystore.aliases(); e.hasMoreElements();) {
+ String alias = e.nextElement();
Certificate retrievedCert = keystore.getCertificate(alias);
if (retrievedCert != null && retrievedCert.equals(cert)) {
return alias;
@@ -609,8 +610,8 @@ public abstract class CryptoBase impleme
);
}
try {
- for (Enumeration e = keystore.aliases(); e.hasMoreElements();) {
- String alias = (String) e.nextElement();
+ for (Enumeration<String> e = keystore.aliases(); e.hasMoreElements();) {
+ String alias = e.nextElement();
Certificate[] certs = keystore.getCertificateChain(alias);
if (certs == null || certs.length == 0) {
// no cert chain, so lets check if getCertificate gives us a result.
@@ -746,7 +747,7 @@ public abstract class CryptoBase impleme
} catch (java.lang.IllegalArgumentException ex) {
subject = createBCX509Name(subjectDN);
}
- List aliases = null;
+ List<String> aliases = null;
if (keystore != null) {
aliases = getAliases(subject, keystore);
}
@@ -811,10 +812,10 @@ public abstract class CryptoBase impleme
null, e
);
}
- List l = path.getCertificates();
+ List<?> l = path.getCertificates();
X509Certificate[] certs = new X509Certificate[l.size()];
int i = 0;
- for (Iterator iterator = l.iterator(); iterator.hasNext(); ) {
+ for (Iterator<?> iterator = l.iterator(); iterator.hasNext(); ) {
certs[i++] = (X509Certificate) iterator.next();
}
return certs;
@@ -834,14 +835,14 @@ public abstract class CryptoBase impleme
) throws org.apache.ws.security.WSSecurityException {
try {
// Generate cert path
- List certList = Arrays.asList(certs);
+ List<X509Certificate> certList = Arrays.asList(certs);
CertPath path = getCertificateFactory().generateCertPath(certList);
- Set set = new HashSet();
+ Set<TrustAnchor> set = new HashSet<TrustAnchor>();
if (truststore != null) {
- Enumeration truststoreAliases = truststore.aliases();
+ Enumeration<String> truststoreAliases = truststore.aliases();
while (truststoreAliases.hasMoreElements()) {
- String alias = (String) truststoreAliases.nextElement();
+ String alias = truststoreAliases.nextElement();
X509Certificate cert =
(X509Certificate) truststore.getCertificate(alias);
if (cert != null) {
@@ -854,9 +855,9 @@ public abstract class CryptoBase impleme
// Add certificates from the keystore
if (keystore != null) {
- Enumeration aliases = keystore.aliases();
+ Enumeration<String> aliases = keystore.aliases();
while (aliases.hasMoreElements()) {
- String alias = (String) aliases.nextElement();
+ String alias = aliases.nextElement();
X509Certificate cert =
(X509Certificate) keystore.getCertificate(alias);
if (cert != null) {
@@ -933,15 +934,15 @@ public abstract class CryptoBase impleme
* @return A list of aliases
* @throws WSSecurityException
*/
- private List getAliases(Object subjectRDN, KeyStore store)
+ private List<String> getAliases(Object subjectRDN, KeyStore store)
throws WSSecurityException {
// Store the aliases found
- List aliases = new Vector();
+ List<String> aliases = new Vector<String>();
Certificate cert = null;
try {
- for (Enumeration e = store.aliases(); e.hasMoreElements();) {
- String alias = (String) e.nextElement();
+ for (Enumeration<String> e = store.aliases(); e.hasMoreElements();) {
+ String alias = e.nextElement();
Certificate[] certs = store.getCertificateChain(alias);
if (certs == null || certs.length == 0) {
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=1034482&r1=1034481&r2=1034482&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 Fri Nov 12 17:29:54 2010
@@ -21,6 +21,7 @@ package org.apache.ws.security.handler;
import org.apache.ws.security.SOAPConstants;
import org.apache.ws.security.WSConstants;
+import org.apache.ws.security.WSEncryptionPart;
import org.apache.ws.security.WSSConfig;
import org.apache.ws.security.components.crypto.Crypto;
import org.apache.ws.security.message.WSSecHeader;
@@ -48,18 +49,18 @@ public class RequestData {
private int sigKeyId = 0;
private String sigAlgorithm = null;
private String signatureDigestAlgorithm = null;
- private List signatureParts = new Vector();
+ private List<WSEncryptionPart> signatureParts = new Vector<WSEncryptionPart>();
private Crypto encCrypto = null;
private int encKeyId = 0;
private String encSymmAlgo = null;
private String encKeyTransport = null;
private String encUser = null;
private String signatureUser = null;
- private List encryptParts = new Vector();
+ private List<WSEncryptionPart> encryptParts = new Vector<WSEncryptionPart>();
private X509Certificate encCert = null;
private int timeToLive = 300; // Timestamp: time in seconds between creation and expiry
private WSSConfig wssConfig = null;
- private List signatureValues = new Vector();
+ private List<byte[]> signatureValues = new Vector<byte[]>();
private WSSecHeader secHeader = null;
private boolean encSymmetricEncryptionKey = true;
private int secretKeyLength = WSConstants.WSE_DERIVED_KEY_LEN;
@@ -200,7 +201,7 @@ public class RequestData {
this.signatureDigestAlgorithm = sigDigestAlgorithm;
}
- public List getSignatureParts() {
+ public List<WSEncryptionPart> getSignatureParts() {
return signatureParts;
}
@@ -252,7 +253,7 @@ public class RequestData {
this.encUser = encUser;
}
- public List getEncryptParts() {
+ public List<WSEncryptionPart> getEncryptParts() {
return encryptParts;
}
@@ -289,7 +290,7 @@ public class RequestData {
/**
* @return Returns the list of stored signature values.
*/
- public List getSignatureValues() {
+ public List<byte[]> 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=1034482&r1=1034481&r2=1034482&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 Fri Nov 12 17:29:54 2010
@@ -45,11 +45,11 @@ import javax.security.auth.callback.Call
import java.security.cert.X509Certificate;
import java.util.Arrays;
-import java.util.Hashtable;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.Vector;
+import java.util.concurrent.ConcurrentHashMap;
/**
@@ -63,7 +63,7 @@ import java.util.Vector;
public abstract class WSHandler {
private static Log log = LogFactory.getLog(WSHandler.class.getName());
protected WSSecurityEngine secEngine = WSSecurityEngine.getInstance();
- protected Map cryptos = new Hashtable(5);
+ protected Map<String, Crypto> cryptos = new ConcurrentHashMap<String, Crypto>();
private boolean doDebug = log.isDebugEnabled();
@@ -78,11 +78,12 @@ public abstract class WSHandler {
* in the deployment file or property
* @throws WSSecurityException
*/
+ @SuppressWarnings("unchecked")
protected void doSenderAction(
int doAction,
Document doc,
RequestData reqData,
- List actions,
+ List<Integer> actions,
boolean isRequest
) throws WSSecurityException {
@@ -183,8 +184,7 @@ public abstract class WSHandler {
* Here we have all necessary information to perform the requested
* action(s).
*/
- for (int i = 0; i < actions.size(); i++) {
- int actionToDo = ((Integer) actions.get(i)).intValue();
+ for (Integer actionToDo : actions) {
if (doDebug) {
log.debug("Performing Action: " + actionToDo);
}
@@ -230,10 +230,10 @@ public abstract class WSHandler {
*/
if (wssConfig.isEnableSignatureConfirmation()
&& isRequest && reqData.getSignatureValues().size() > 0) {
- List savedSignatures =
- (List)getProperty(reqData.getMsgContext(), WSHandlerConstants.SEND_SIGV);
+ List<byte[]> savedSignatures =
+ (List<byte[]>)getProperty(reqData.getMsgContext(), WSHandlerConstants.SEND_SIGV);
if (savedSignatures == null) {
- savedSignatures = new Vector();
+ savedSignatures = new Vector<byte[]>();
setProperty(
reqData.getMsgContext(), WSHandlerConstants.SEND_SIGV, savedSignatures
);
@@ -282,18 +282,19 @@ public abstract class WSHandler {
}
}
- protected boolean checkReceiverResults(List wsResult, List actions) {
+ protected boolean checkReceiverResults(
+ List<WSSecurityEngineResult> wsResult, List<Integer> actions
+ ) {
int size = actions.size();
int ai = 0;
- for (int i = 0; i < wsResult.size(); i++) {
- final Integer actInt = (Integer) ((WSSecurityEngineResult) wsResult
- .get(i)).get(WSSecurityEngineResult.TAG_ACTION);
+ for (WSSecurityEngineResult result : wsResult) {
+ final Integer actInt = (Integer) result.get(WSSecurityEngineResult.TAG_ACTION);
int act = actInt.intValue();
if (act == WSConstants.SC || act == WSConstants.BST) {
continue;
}
- if (ai >= size || ((Integer) actions.get(ai++)).intValue() != act) {
+ if (ai >= size || actions.get(ai++).intValue() != act) {
return false;
}
}
@@ -305,17 +306,16 @@ public abstract class WSHandler {
return true;
}
- protected boolean checkReceiverResultsAnyOrder(List wsResult, List actions) {
-
- List recordedActions = new Vector(actions.size());
- for (int i = 0; i < actions.size(); i++) {
- Integer action = (Integer)actions.get(i);
+ protected boolean checkReceiverResultsAnyOrder(
+ List<WSSecurityEngineResult> wsResult, List<Integer> actions
+ ) {
+ List<Integer> recordedActions = new Vector<Integer>(actions.size());
+ for (Integer action : actions) {
recordedActions.add(action);
}
- for (int i = 0; i < wsResult.size(); i++) {
- final Integer actInt = (Integer) ((WSSecurityEngineResult) wsResult
- .get(i)).get(WSSecurityEngineResult.TAG_ACTION);
+ for (WSSecurityEngineResult result : wsResult) {
+ final Integer actInt = (Integer) result.get(WSSecurityEngineResult.TAG_ACTION);
int act = actInt.intValue();
if (act == WSConstants.SC || act == WSConstants.BST) {
continue;
@@ -333,9 +333,10 @@ public abstract class WSHandler {
return true;
}
+ @SuppressWarnings("unchecked")
protected void checkSignatureConfirmation(
RequestData reqData,
- List resultList
+ List<WSSecurityEngineResult> resultList
) throws WSSecurityException{
if (doDebug) {
log.debug("Check Signature confirmation");
@@ -343,14 +344,14 @@ public abstract class WSHandler {
//
// First get all Signature values stored during sending the request
//
- List savedSignatures =
- (List) getProperty(reqData.getMsgContext(), WSHandlerConstants.SEND_SIGV);
+ List<byte[]> savedSignatures =
+ (List<byte[]>) getProperty(reqData.getMsgContext(), WSHandlerConstants.SEND_SIGV);
//
// Now get all results that hold a SignatureConfirmation element from
// the current run of receiver (we can have more than one run: if we
// have several security header blocks with different actors/roles)
//
- List sigConf = new Vector();
+ List<WSSecurityEngineResult> sigConf = new Vector<WSSecurityEngineResult>();
WSSecurityUtil.fetchAllActionResults(resultList, WSConstants.SC, sigConf);
//
// now loop over all SignatureConfirmation results and check:
@@ -359,9 +360,7 @@ public abstract class WSHandler {
//
// If a matching value found: remove from vector of stored signature values
//
- for (int i = 0; i < sigConf.size(); i++) {
- WSSecurityEngineResult result =
- (WSSecurityEngineResult)sigConf.get(i);
+ for (WSSecurityEngineResult result : sigConf) {
SignatureConfirmation sc =
(SignatureConfirmation)result.get(
WSSecurityEngineResult.TAG_SIGNATURE_CONFIRMATION
@@ -667,26 +666,6 @@ public abstract class WSHandler {
}
}
- protected boolean decodeMustUnderstand(RequestData reqData)
- throws WSSecurityException {
- String mu =
- getString(WSHandlerConstants.MUST_UNDERSTAND, reqData.getMsgContext());
-
- if (mu == null) {
- return true;
- }
- if ("0".equals(mu) || "false".equals(mu)) {
- return false;
- }
- if ("1".equals(mu) || "true".equals(mu)) {
- return true;
- }
-
- throw new WSSecurityException(
- "WSHandler: illegal mustUnderstand parameter"
- );
- }
-
public int decodeTimeToLive(RequestData reqData) {
String ttl =
getString(WSHandlerConstants.TTL_TIMESTAMP, reqData.getMsgContext());
@@ -703,150 +682,84 @@ public abstract class WSHandler {
}
return ttl_i;
}
-
- protected boolean decodeEnableSignatureConfirmation(RequestData reqData) throws WSSecurityException {
-
- String value = getString(WSHandlerConstants.ENABLE_SIGNATURE_CONFIRMATION,
- reqData.getMsgContext());
-
- if (value == null) {
- return true;
- }
- if ("0".equals(value) || "false".equals(value)) {
- return false;
- }
- if ("1".equals(value) || "true".equals(value)) {
- return true;
- }
-
- throw new WSSecurityException(
- "WSHandler: illegal enableSignatureConfirmation parameter"
+
+ protected boolean decodeMustUnderstand(RequestData reqData)
+ throws WSSecurityException {
+ return decodeBooleanConfigValue(
+ reqData, WSHandlerConstants.MUST_UNDERSTAND, true
);
}
- protected boolean decodeTimestampPrecision(RequestData reqData)
- throws WSSecurityException {
- String value = getString(WSHandlerConstants.TIMESTAMP_PRECISION,
- reqData.getMsgContext());
-
- if (value == null) {
- return true;
- }
- if ("0".equals(value) || "false".equals(value)) {
- return false;
- }
- if ("1".equals(value) || "true".equals(value)) {
- return true;
- }
-
- throw new WSSecurityException(
- "WSHandler: illegal precisionInMilliSeconds parameter"
+ protected boolean decodeEnableSignatureConfirmation(
+ RequestData reqData
+ ) throws WSSecurityException {
+ return decodeBooleanConfigValue(
+ reqData, WSHandlerConstants.ENABLE_SIGNATURE_CONFIRMATION, true
);
}
-
- protected boolean decodeCustomPasswordTypes(RequestData reqData)
- throws WSSecurityException {
- String value = getString(
- WSHandlerConstants.HANDLE_CUSTOM_PASSWORD_TYPES,
- reqData.getMsgContext()
+
+ protected boolean decodeTimestampPrecision(
+ RequestData reqData
+ ) throws WSSecurityException {
+ return decodeBooleanConfigValue(
+ reqData, WSHandlerConstants.TIMESTAMP_PRECISION, true
);
-
- if (value == null) {
- return false;
- }
- if ("0".equals(value) || "false".equals(value)) {
- return false;
- }
- if ("1".equals(value) || "true".equals(value)) {
- return true;
- }
-
- throw new WSSecurityException(
- "WSHandler: illegal handleCustomPasswordTypes parameter"
+ }
+
+ protected boolean decodeCustomPasswordTypes(
+ RequestData reqData
+ ) throws WSSecurityException {
+ return decodeBooleanConfigValue(
+ reqData, WSHandlerConstants.HANDLE_CUSTOM_PASSWORD_TYPES, false
);
}
protected boolean decodeUseEncodedPasswords(RequestData reqData)
throws WSSecurityException {
- String value = getString(
- WSHandlerConstants.USE_ENCODED_PASSWORDS,
- reqData.getMsgContext()
- );
-
- if (value == null) {
- return false;
- }
- if ("0".equals(value) || "false".equals(value)) {
- return false;
- }
- if ("1".equals(value) || "true".equals(value)) {
- return true;
- }
-
- throw new WSSecurityException(
- "WSHandler: illegal useEncodedPasswords parameter"
+ return decodeBooleanConfigValue(
+ reqData, WSHandlerConstants.USE_ENCODED_PASSWORDS, false
);
}
protected boolean decodeNamespaceQualifiedPasswordTypes(RequestData reqData)
throws WSSecurityException {
- String value = getString(
- WSHandlerConstants.ALLOW_NAMESPACE_QUALIFIED_PASSWORD_TYPES,
- reqData.getMsgContext()
- );
-
- if (value == null) {
- return false;
- }
- if ("0".equals(value) || "false".equals(value)) {
- return false;
- }
- if ("1".equals(value) || "true".equals(value)) {
- return true;
- }
-
- throw new WSSecurityException(
- "WSHandler: illegal allowNamespaceQualifiedPasswordTypes parameter"
+ return decodeBooleanConfigValue(
+ reqData, WSHandlerConstants.ALLOW_NAMESPACE_QUALIFIED_PASSWORD_TYPES, false
);
}
protected boolean decodeTimestampStrict(RequestData reqData)
throws WSSecurityException {
- String value = getString(WSHandlerConstants.TIMESTAMP_STRICT,
- reqData.getMsgContext());
-
- if (value == null) {
- return true;
- }
- if ("0".equals(value) || "false".equals(value)) {
- return false;
- }
- if ("1".equals(value) || "true".equals(value)) {
- return true;
- }
-
- throw new WSSecurityException(
- "WSHandler: illegal timestampStrict parameter"
+ return decodeBooleanConfigValue(
+ reqData, WSHandlerConstants.TIMESTAMP_STRICT, true
);
}
protected boolean decodeUseSingleCertificate(RequestData reqData)
throws WSSecurityException {
- String useSingleCert =
- getString(WSHandlerConstants.USE_SINGLE_CERTIFICATE, reqData.getMsgContext());
+ return decodeBooleanConfigValue(
+ reqData, WSHandlerConstants.USE_SINGLE_CERTIFICATE, true
+ );
+ }
- if (useSingleCert == null) {
- return true;
+ protected boolean decodeBooleanConfigValue(
+ RequestData reqData, String configTag, boolean defaultToTrue
+ ) throws WSSecurityException {
+
+ String value = getString(configTag, reqData.getMsgContext());
+
+ if (value == null) {
+ return defaultToTrue;
}
- if ("0".equals(useSingleCert) || "false".equals(useSingleCert)) {
+ if ("0".equals(value) || "false".equals(value)) {
return false;
}
- if ("1".equals(useSingleCert) || "true".equals(useSingleCert)) {
+ if ("1".equals(value) || "true".equals(value)) {
return true;
}
-
+
throw new WSSecurityException(
- "WSHandler: illegal useSingleCert parameter"
+ "WSHandler: illegal " + configTag + " parameter"
);
}
@@ -900,7 +813,7 @@ public abstract class WSHandler {
RequestData requestData
) throws WSSecurityException {
- Class cbClass = null;
+ Class<?> cbClass = null;
CallbackHandler cbHandler = null;
try {
cbClass =
@@ -970,7 +883,7 @@ public abstract class WSHandler {
return new WSPasswordCallback(username, reason);
}
- private void splitEncParts(String tmpS, List parts, RequestData reqData)
+ private void splitEncParts(String tmpS, List<WSEncryptionPart> parts, RequestData reqData)
throws WSSecurityException {
WSEncryptionPart encPart = null;
String[] rawParts = StringUtil.split(tmpS, ';');
@@ -1016,12 +929,15 @@ public abstract class WSHandler {
}
}
+ @SuppressWarnings("unchecked")
private void handleSpecialUser(RequestData reqData) {
if (!WSHandlerConstants.USE_REQ_SIG_CERT.equals(reqData.getEncUser())) {
return;
}
- List results =
- (List) getProperty(reqData.getMsgContext(), WSHandlerConstants.RECV_RESULTS);
+ List<WSHandlerResult> results =
+ (List<WSHandlerResult>) getProperty(
+ reqData.getMsgContext(), WSHandlerConstants.RECV_RESULTS
+ );
if (results == null) {
return;
}
@@ -1029,22 +945,18 @@ public abstract class WSHandler {
* Scan the results for a matching actor. Use results only if the
* receiving Actor and the sending Actor match.
*/
- for (int i = 0; i < results.size(); i++) {
- WSHandlerResult rResult =
- (WSHandlerResult) results.get(i);
+ for (WSHandlerResult rResult : results) {
String hActor = rResult.getActor();
if (!WSSecurityUtil.isActorEqual(reqData.getActor(), hActor)) {
continue;
}
- List wsSecEngineResults = rResult.getResults();
+ List<WSSecurityEngineResult> wsSecEngineResults = rResult.getResults();
/*
* Scan the results for the first Signature action. Use the
* certificate of this Signature to set the certificate for the
* encryption action :-).
*/
- for (int j = 0; j < wsSecEngineResults.size(); j++) {
- WSSecurityEngineResult wser =
- (WSSecurityEngineResult) wsSecEngineResults.get(j);
+ for (WSSecurityEngineResult wser : wsSecEngineResults) {
int wserAction =
((java.lang.Integer)wser.get(WSSecurityEngineResult.TAG_ACTION)).intValue();
if (wserAction == WSConstants.SIGN) {
@@ -1137,7 +1049,7 @@ public abstract class WSHandler {
CallbackHandler cbHandler = null;
String callback = getString(WSHandlerConstants.PW_CALLBACK_CLASS, mc);
if (callback != null) {
- Class cbClass = null;
+ Class<?> cbClass = null;
try {
cbClass =
Loader.loadClass(getClassLoader(reqData.getMsgContext()), callback);
Modified: webservices/wss4j/trunk/src/org/apache/ws/security/handler/WSHandlerConstants.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/org/apache/ws/security/handler/WSHandlerConstants.java?rev=1034482&r1=1034481&r2=1034482&view=diff
==============================================================================
--- webservices/wss4j/trunk/src/org/apache/ws/security/handler/WSHandlerConstants.java (original)
+++ webservices/wss4j/trunk/src/org/apache/ws/security/handler/WSHandlerConstants.java Fri Nov 12 17:29:54 2010
@@ -20,8 +20,8 @@
package org.apache.ws.security.handler;
import org.apache.ws.security.WSConstants;
-import java.util.Hashtable;
import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
/**
* This class defines the names, actions, and other string for the deployment
@@ -434,7 +434,7 @@ public class WSHandlerConstants {
* The WSDoAllReceiver handler stores a result <code>Vector</code>
* in this property.
* <p/>
- * The vector contains <code>WSDoAllReceiverResult</code> objects
+ * The vector contains <code>WSHandlerResult</code> objects
* for each chained WSDoAllReceiver handler.
*/
public static final String RECV_RESULTS = "RECV_RESULTS";
@@ -839,7 +839,8 @@ public class WSHandlerConstants {
* </ul>
* See {@link #SIG_KEY_ID} {@link #ENC_KEY_ID}.
*/
- public static Map keyIdentifier = new Hashtable();
+ public static Map<String, Integer> keyIdentifier =
+ new ConcurrentHashMap<String, Integer>();
static {
keyIdentifier.put("DirectReference",
Modified: webservices/wss4j/trunk/src/org/apache/ws/security/handler/WSHandlerResult.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/org/apache/ws/security/handler/WSHandlerResult.java?rev=1034482&r1=1034481&r2=1034482&view=diff
==============================================================================
--- webservices/wss4j/trunk/src/org/apache/ws/security/handler/WSHandlerResult.java (original)
+++ webservices/wss4j/trunk/src/org/apache/ws/security/handler/WSHandlerResult.java Fri Nov 12 17:29:54 2010
@@ -20,20 +20,21 @@
package org.apache.ws.security.handler;
import java.util.List;
+import org.apache.ws.security.WSSecurityEngineResult;
/**
* @author Werner Dittmann (Werner.Dittmann@Siemens.com)
*/
public class WSHandlerResult {
private String actor;
- private List wsSecurityResults;
+ private List<WSSecurityEngineResult> wsSecurityResults;
/**
* constructor
* @param actor
* @param wsResults
*/
- public WSHandlerResult(String actor, List results) {
+ public WSHandlerResult(String actor, List<WSSecurityEngineResult> results) {
this.actor = actor;
this.wsSecurityResults = results;
}
@@ -48,9 +49,9 @@ public class WSHandlerResult {
/**
* gets the the security results
- * @return list
+ * @return the the security results
*/
- public List getResults() {
+ public List<WSSecurityEngineResult> getResults() {
return wsSecurityResults;
}
}
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=1034482&r1=1034481&r2=1034482&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 Fri Nov 12 17:29:54 2010
@@ -23,6 +23,7 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.ws.security.SOAPConstants;
import org.apache.ws.security.WSConstants;
+import org.apache.ws.security.WSSecurityEngineResult;
import org.apache.ws.security.WSSecurityException;
import org.apache.ws.security.util.WSSecurityUtil;
import org.apache.xml.security.utils.XMLUtils;
@@ -188,7 +189,7 @@ public class WSS4JHandler extends WSHand
/*
* Get the action first.
*/
- List actions = new Vector();
+ List<Integer> actions = new Vector<Integer>();
String action = (String) getOption(WSHandlerConstants.SEND + '.' + WSHandlerConstants.ACTION);
if (action == null) {
action = (String) getOption(WSHandlerConstants.ACTION);
@@ -328,9 +329,10 @@ public class WSS4JHandler extends WSHand
* @return true on successful processing
* @throws WSSecurityException
*/
+ @SuppressWarnings("unchecked")
public boolean doReceiver(MessageContext mc, RequestData reqData, boolean isRequest) throws WSSecurityException {
- List actions = new Vector();
+ List<Integer> actions = new Vector<Integer>();
String action = (String) getOption(WSHandlerConstants.RECEIVE + '.' + WSHandlerConstants.ACTION);
if (action == null) {
action = (String) getOption(WSHandlerConstants.ACTION);
@@ -385,7 +387,7 @@ public class WSS4JHandler extends WSHand
* may be used for encryption too.
*/
doReceiverAction(doAction, reqData);
- List wsResult = null;
+ List<WSSecurityEngineResult> wsResult = null;
try {
wsResult =
secEngine.processSecurityHeader(doc,
@@ -456,7 +458,7 @@ public class WSS4JHandler extends WSHand
throw new JAXRPCException("WSS4JHandler: cannot get SOAP header after security processing", ex);
}
- Iterator headers = sHeader.examineHeaderElements(actor);
+ Iterator<?> headers = sHeader.examineHeaderElements(actor);
SOAPHeaderElement headerElement = null;
while (headers.hasNext()) {
@@ -483,10 +485,10 @@ public class WSS4JHandler extends WSHand
* security result structure. The service may fetch this
* and check it.
*/
- List results = null;
- if ((results = (List) mc.getProperty(WSHandlerConstants.RECV_RESULTS))
+ List<WSHandlerResult> results = null;
+ if ((results = (List<WSHandlerResult>) mc.getProperty(WSHandlerConstants.RECV_RESULTS))
== null) {
- results = new Vector();
+ results = new Vector<WSHandlerResult>();
mc.setProperty(WSHandlerConstants.RECV_RESULTS, results);
}
WSHandlerResult rResult =
Modified: webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecBase.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecBase.java?rev=1034482&r1=1034481&r2=1034482&view=diff
==============================================================================
--- webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecBase.java (original)
+++ webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecBase.java Fri Nov 12 17:29:54 2010
@@ -20,6 +20,7 @@
package org.apache.ws.security.message;
import org.apache.ws.security.WSConstants;
+import org.apache.ws.security.WSEncryptionPart;
import org.apache.ws.security.WSSConfig;
import org.apache.ws.security.util.WSSecurityUtil;
import org.w3c.dom.Document;
@@ -41,7 +42,7 @@ public class WSSecBase {
protected int keyIdentifierType = WSConstants.ISSUER_SERIAL;
- protected List parts = null;
+ protected List<WSEncryptionPart> parts = null;
protected boolean doDebug = false;
@@ -52,7 +53,7 @@ public class WSSecBase {
*
* @param parts The list containing the WSEncryptionPart objects
*/
- public void setParts(List parts) {
+ public void setParts(List<WSEncryptionPart> parts) {
this.parts = parts;
}
Modified: webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecDKEncrypt.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecDKEncrypt.java?rev=1034482&r1=1034481&r2=1034482&view=diff
==============================================================================
--- webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecDKEncrypt.java (original)
+++ webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecDKEncrypt.java Fri Nov 12 17:29:54 2010
@@ -61,7 +61,7 @@ public class WSSecDKEncrypt extends WSSe
String soapNamespace = WSSecurityUtil.getSOAPNamespace(envelope);
if (parts == null) {
- parts = new Vector();
+ parts = new Vector<WSEncryptionPart>();
WSEncryptionPart encP =
new WSEncryptionPart(
WSConstants.ELEM_BODY,
@@ -97,13 +97,13 @@ public class WSSecDKEncrypt extends WSSe
* @return Returns the updated <code>xenc:Reference</code> element
* @throws WSSecurityException
*/
- public Element encryptForExternalRef(Element dataRef, List references)
+ public Element encryptForExternalRef(Element dataRef, List<WSEncryptionPart> references)
throws WSSecurityException {
KeyInfo keyInfo = createKeyInfo();
SecretKey key = WSSecurityUtil.prepareSecretKey(symEncAlgo, derivedKeyBytes);
- List encDataRefs =
+ List<String> encDataRefs =
WSSecEncrypt.doEncryption(document, wssConfig, keyInfo, key, symEncAlgo, references);
if (dataRef == null) {
dataRef =
Modified: webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecDKSign.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecDKSign.java?rev=1034482&r1=1034481&r2=1034482&view=diff
==============================================================================
--- webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecDKSign.java (original)
+++ webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecDKSign.java Fri Nov 12 17:29:54 2010
@@ -87,7 +87,7 @@ public class WSSecDKSign extends WSSecDe
prepare(doc, secHeader);
String soapNamespace = WSSecurityUtil.getSOAPNamespace(doc.getDocumentElement());
if (parts == null) {
- parts = new Vector();
+ parts = new Vector<WSEncryptionPart>();
WSEncryptionPart encP =
new WSEncryptionPart(
WSConstants.ELEM_BODY,
@@ -96,15 +96,15 @@ public class WSSecDKSign extends WSSecDe
);
parts.add(encP);
} else {
- for (int i = 0; i < parts.size(); i++) {
- WSEncryptionPart part = (WSEncryptionPart)parts.get(i);
+ for (WSEncryptionPart part : parts) {
if ("STRTransform".equals(part.getName()) && part.getId() == null) {
part.setId(strUri);
}
}
}
- List referenceList = addReferencesToSign(parts, secHeader);
+ List<javax.xml.crypto.dsig.Reference> referenceList =
+ addReferencesToSign(parts, secHeader);
computeSignature(referenceList);
//
@@ -125,7 +125,8 @@ public class WSSecDKSign extends WSSecDe
try {
C14NMethodParameterSpec c14nSpec = null;
if (wssConfig.isWsiBSPCompliant() && canonAlgo.equals(WSConstants.C14N_EXCL_OMIT_COMMENTS)) {
- List prefixes = getInclusivePrefixes(secHeader.getSecurityHeader(), false);
+ List<String> prefixes =
+ getInclusivePrefixes(secHeader.getSecurityHeader(), false);
c14nSpec = new ExcC14NParameterSpec(prefixes);
}
@@ -176,8 +177,10 @@ public class WSSecDKSign extends WSSecDe
* @param secHeader The Security Header
* @throws WSSecurityException
*/
- public List addReferencesToSign(List references, WSSecHeader secHeader)
- throws WSSecurityException {
+ public List<javax.xml.crypto.dsig.Reference> addReferencesToSign(
+ List<WSEncryptionPart> references,
+ WSSecHeader secHeader
+ ) throws WSSecurityException {
return
addReferencesToSign(
document,
@@ -199,7 +202,7 @@ public class WSSecDKSign extends WSSecDe
* @throws WSSecurityException
*/
public void computeSignature(
- List referenceList
+ List<javax.xml.crypto.dsig.Reference> referenceList
) throws WSSecurityException {
computeSignature(referenceList, true, null);
}
@@ -214,7 +217,7 @@ public class WSSecDKSign extends WSSecDe
* @throws WSSecurityException
*/
public void computeSignature(
- List referenceList,
+ List<javax.xml.crypto.dsig.Reference> referenceList,
boolean prepend,
Element siblingElement
) throws WSSecurityException {
Modified: webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecEncrypt.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecEncrypt.java?rev=1034482&r1=1034481&r2=1034482&view=diff
==============================================================================
--- webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecEncrypt.java (original)
+++ webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecEncrypt.java Fri Nov 12 17:29:54 2010
@@ -264,7 +264,7 @@ public class WSSecEncrypt extends WSSecE
}
if (parts == null) {
- parts = new Vector();
+ parts = new Vector<WSEncryptionPart>();
String soapNamespace = WSSecurityUtil.getSOAPNamespace(envelope);
WSEncryptionPart encP =
new WSEncryptionPart(
@@ -317,11 +317,11 @@ public class WSSecEncrypt extends WSSecE
* @return Returns the updated <code>xenc:Reference</code> element
* @throws WSSecurityException
*/
- public Element encryptForRef(Element dataRef, List references)
+ public Element encryptForRef(Element dataRef, List<WSEncryptionPart> references)
throws WSSecurityException {
KeyInfo keyInfo = createKeyInfo();
- List encDataRefs =
+ List<String> encDataRefs =
doEncryption(document, wssConfig, keyInfo, symmetricKey, symEncAlgo, references);
if (dataRef == null) {
dataRef =
@@ -345,7 +345,7 @@ public class WSSecEncrypt extends WSSecE
/**
* @deprecated Use encryptForRef(dataRef, references) instead
*/
- public Element encryptForInternalRef(Element dataRef, List references)
+ public Element encryptForInternalRef(Element dataRef, List<WSEncryptionPart> references)
throws WSSecurityException {
return encryptForRef(dataRef, references);
}
@@ -353,7 +353,7 @@ public class WSSecEncrypt extends WSSecE
/**
* @deprecated Use encryptForRef(dataRef, references) instead
*/
- public Element encryptForExternalRef(Element dataRef, List references)
+ public Element encryptForExternalRef(Element dataRef, List<WSEncryptionPart> references)
throws WSSecurityException {
return encryptForRef(dataRef, references);
}
@@ -397,13 +397,13 @@ public class WSSecEncrypt extends WSSecE
* @return a List of references to EncryptedData elements
* @throws WSSecurityException
*/
- public static List doEncryption(
+ public static List<String> doEncryption(
Document doc,
WSSConfig config,
KeyInfo keyInfo,
SecretKey secretKey,
String encryptionAlgorithm,
- List references
+ List<WSEncryptionPart> references
) throws WSSecurityException {
XMLCipher xmlCipher = null;
@@ -415,9 +415,9 @@ public class WSSecEncrypt extends WSSecE
);
}
- List encDataRef = new Vector();
+ List<String> encDataRef = new Vector<String>();
for (int part = 0; part < references.size(); part++) {
- WSEncryptionPart encPart = (WSEncryptionPart) references.get(part);
+ WSEncryptionPart encPart = references.get(part);
String idToEnc = encPart.getId();
String elemName = encPart.getName();
@@ -599,10 +599,9 @@ public class WSSecEncrypt extends WSSecE
public static Element createDataRefList(
Document doc,
Element referenceList,
- List encDataRefs
+ List<String> encDataRefs
) {
- for (int i = 0; i < encDataRefs.size(); i++) {
- String dataReferenceUri = (String) encDataRefs.get(i);
+ for (String dataReferenceUri : encDataRefs) {
Element dataReference =
doc.createElementNS(
WSConstants.ENC_NS, WSConstants.ENC_PREFIX + ":DataReference"
Modified: webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecSignature.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecSignature.java?rev=1034482&r1=1034481&r2=1034482&view=diff
==============================================================================
--- webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecSignature.java (original)
+++ webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecSignature.java Fri Nov 12 17:29:54 2010
@@ -144,7 +144,8 @@ public class WSSecSignature extends WSSe
try {
C14NMethodParameterSpec c14nSpec = null;
if (wssConfig.isWsiBSPCompliant() && canonAlgo.equals(WSConstants.C14N_EXCL_OMIT_COMMENTS)) {
- List prefixes = getInclusivePrefixes(secHeader.getSecurityHeader(), false);
+ List<String> prefixes =
+ getInclusivePrefixes(secHeader.getSecurityHeader(), false);
c14nSpec = new ExcC14NParameterSpec(prefixes);
}
@@ -287,7 +288,7 @@ public class WSSecSignature extends WSSe
prepare(doc, cr, secHeader);
if (parts == null) {
- parts = new Vector();
+ parts = new Vector<WSEncryptionPart>();
String soapNamespace = WSSecurityUtil.getSOAPNamespace(doc.getDocumentElement());
WSEncryptionPart encP =
new WSEncryptionPart(
@@ -297,15 +298,15 @@ public class WSSecSignature extends WSSe
);
parts.add(encP);
} else {
- for (int i = 0; i < parts.size(); i++) {
- WSEncryptionPart part = (WSEncryptionPart)parts.get(i);
+ for (WSEncryptionPart part : parts) {
if ("STRTransform".equals(part.getName()) && part.getId() == null) {
part.setId(strUri);
}
}
}
- List referenceList = addReferencesToSign(parts, secHeader);
+ List<javax.xml.crypto.dsig.Reference> referenceList =
+ addReferencesToSign(parts, secHeader);
computeSignature(referenceList);
@@ -328,7 +329,10 @@ public class WSSecSignature extends WSSe
* @param secHeader The Security Header
* @throws WSSecurityException
*/
- public List addReferencesToSign(List references, WSSecHeader secHeader) throws WSSecurityException {
+ public List<javax.xml.crypto.dsig.Reference> addReferencesToSign(
+ List<WSEncryptionPart> references,
+ WSSecHeader secHeader
+ ) throws WSSecurityException {
return
addReferencesToSign(
document,
@@ -393,7 +397,7 @@ public class WSSecSignature extends WSSe
* @throws WSSecurityException
*/
public void computeSignature(
- List referenceList
+ List<javax.xml.crypto.dsig.Reference> referenceList
) throws WSSecurityException {
computeSignature(referenceList, true, null);
}
@@ -408,7 +412,7 @@ public class WSSecSignature extends WSSe
* @throws WSSecurityException
*/
public void computeSignature(
- List referenceList,
+ List<javax.xml.crypto.dsig.Reference> referenceList,
boolean prepend,
Element siblingElement
) throws WSSecurityException {
Modified: webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecSignatureBase.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecSignatureBase.java?rev=1034482&r1=1034481&r2=1034482&view=diff
==============================================================================
--- webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecSignatureBase.java (original)
+++ webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecSignatureBase.java Fri Nov 12 17:29:54 2010
@@ -63,9 +63,9 @@ public class WSSecSignatureBase extends
* @param digestAlgo The digest algorithm to use
* @throws WSSecurityException
*/
- public List addReferencesToSign(
+ public List<javax.xml.crypto.dsig.Reference> addReferencesToSign(
Document doc,
- List references,
+ List<WSEncryptionPart> references,
XMLSignatureFactory signatureFactory,
WSSecHeader secHeader,
WSSConfig wssConfig,
@@ -83,11 +83,10 @@ public class WSSecSignatureBase extends
);
}
- List referenceList = new Vector();
-
- for (int part = 0; part < references.size(); part++) {
- WSEncryptionPart encPart = (WSEncryptionPart) references.get(part);
+ List<javax.xml.crypto.dsig.Reference> referenceList =
+ new Vector<javax.xml.crypto.dsig.Reference>();
+ for (WSEncryptionPart encPart : references) {
String idToSign = encPart.getId();
String elemName = encPart.getName();
@@ -109,7 +108,7 @@ public class WSSecSignatureBase extends
}
TransformParameterSpec transformSpec = null;
if (wssConfig.isWsiBSPCompliant()) {
- List prefixes = getInclusivePrefixes(toSignById);
+ List<String> prefixes = getInclusivePrefixes(toSignById);
transformSpec = new ExcC14NParameterSpec(prefixes);
}
Transform transform =
@@ -158,7 +157,7 @@ public class WSSecSignatureBase extends
}
TransformParameterSpec transformSpec = null;
if (wssConfig.isWsiBSPCompliant()) {
- List prefixes = getInclusivePrefixes(elementToSign);
+ List<String> prefixes = getInclusivePrefixes(elementToSign);
transformSpec = new ExcC14NParameterSpec(prefixes);
}
Transform transform =
@@ -190,7 +189,7 @@ public class WSSecSignatureBase extends
/**
* Get the List of inclusive prefixes from the DOM Element argument
*/
- public List getInclusivePrefixes(Element target) {
+ public List<String> getInclusivePrefixes(Element target) {
return getInclusivePrefixes(target, true);
}
@@ -198,8 +197,8 @@ public class WSSecSignatureBase extends
/**
* Get the List of inclusive prefixes from the DOM Element argument
*/
- public List getInclusivePrefixes(Element target, boolean excludeVisible) {
- List result = new Vector();
+ public List<String> getInclusivePrefixes(Element target, boolean excludeVisible) {
+ List<String> result = new Vector<String>();
Node parent = target;
while (!(Node.DOCUMENT_NODE == parent.getParentNode().getNodeType())) {
parent = parent.getParentNode();
Modified: webservices/wss4j/trunk/src/org/apache/ws/security/message/token/DerivedKeyToken.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/org/apache/ws/security/message/token/DerivedKeyToken.java?rev=1034482&r1=1034481&r2=1034482&view=diff
==============================================================================
--- webservices/wss4j/trunk/src/org/apache/ws/security/message/token/DerivedKeyToken.java (original)
+++ webservices/wss4j/trunk/src/org/apache/ws/security/message/token/DerivedKeyToken.java Fri Nov 12 17:29:54 2010
@@ -20,8 +20,8 @@
package org.apache.ws.security.message.token;
import java.security.Principal;
-import java.util.Enumeration;
-import java.util.Hashtable;
+import java.util.HashMap;
+import java.util.Map;
import javax.xml.namespace.QName;
@@ -219,7 +219,7 @@ public class DerivedKeyToken {
* @param nonce Value of the Properties/Nonce element
*/
public void setProperties(String name, String label, String nonce) {
- Hashtable table = new Hashtable(3);
+ Map<String, String> table = new HashMap<String, String>();
table.put("Name", name);
table.put("Label", label);
table.put("Nonce", nonce);
@@ -230,28 +230,27 @@ public class DerivedKeyToken {
* If there are other types of properties other than Name, Label and Nonce
* This is provided for extensibility purposes
*
- * @param properties The properties and values in a hashtable
+ * @param properties The properties and values in a Map
*/
- public void setProperties(Hashtable properties) {
- Enumeration keys = properties.keys();
- while (keys.hasMoreElements()) {
- String propertyName = (String) keys.nextElement(); //Get the property name
+ public void setProperties(Map<String, String> properties) {
+ for (String key : properties.keySet()) {
+ String propertyName = properties.get(key); //Get the property name
//Check whether this property is already there
//If so change the value
Node node =
WSSecurityUtil.findElement(elementProperties, propertyName, ns);
if (node != null && Node.ELEMENT_NODE == node.getNodeType()) { //If the node is not null
Text node1 = getFirstNode((Element) node);
- node1.setData((String) properties.get(propertyName));
+ node1.setData(properties.get(propertyName));
} else {
- addProperty(propertyName, (String) properties.get(propertyName));
+ addProperty(propertyName, properties.get(propertyName));
}
}
}
- public Hashtable getProperties() {
+ public Map<String, String> getProperties() {
if (elementProperties != null) {
- Hashtable table = new Hashtable();
+ Map<String, String> table = new HashMap<String, String>();
Node node = elementProperties.getFirstChild();
while (node != null) {
if (Node.ELEMENT_NODE == node.getNodeType()) {
Modified: webservices/wss4j/trunk/src/org/apache/ws/security/message/token/Timestamp.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/org/apache/ws/security/message/token/Timestamp.java?rev=1034482&r1=1034481&r2=1034482&view=diff
==============================================================================
--- webservices/wss4j/trunk/src/org/apache/ws/security/message/token/Timestamp.java (original)
+++ webservices/wss4j/trunk/src/org/apache/ws/security/message/token/Timestamp.java Fri Nov 12 17:29:54 2010
@@ -51,7 +51,7 @@ public class Timestamp {
private final static Log LOG = LogFactory.getLog(Timestamp.class.getName());
protected Element element = null;
- protected List customElements = null;
+ protected List<Element> customElements = null;
protected Date createdDate;
protected Date expiresDate;
@@ -65,7 +65,7 @@ public class Timestamp {
public Timestamp(Element timestampElement) throws WSSecurityException {
element = timestampElement;
- customElements = new Vector();
+ customElements = new Vector<Element>();
String strCreated = null;
String strExpires = null;
@@ -134,7 +134,7 @@ public class Timestamp {
*/
public Timestamp(boolean milliseconds, Document doc, int ttl) {
- customElements = new Vector();
+ customElements = new Vector<Element>();
element =
doc.createElementNS(
WSConstants.WSU_NS, WSConstants.WSU_PREFIX + ":" + WSConstants.TIMESTAMP_TOKEN_LN
@@ -237,7 +237,7 @@ public class Timestamp {
*
* @return the list containing the custom elements.
*/
- public List getCustomElements() {
+ public List<Element> getCustomElements() {
return customElements;
}
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=1034482&r1=1034481&r2=1034482&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 Fri Nov 12 17:29:54 2010
@@ -77,7 +77,7 @@ public class BinarySecurityTokenProcesso
Crypto decCrypto,
CallbackHandler cb,
WSDocInfo wsDocInfo,
- List returnResults,
+ List<WSSecurityEngineResult> returnResults,
WSSConfig config
) throws WSSecurityException {
if (crypto == null) {
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=1034482&r1=1034481&r2=1034482&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 Fri Nov 12 17:29:54 2010
@@ -69,7 +69,7 @@ public class DerivedKeyTokenProcessor im
Crypto decCrypto,
CallbackHandler cb,
WSDocInfo wsDocInfo,
- List returnResults,
+ List<WSSecurityEngineResult> 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=1034482&r1=1034481&r2=1034482&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 Fri Nov 12 17:29:54 2010
@@ -22,6 +22,7 @@ package org.apache.ws.security.processor
import org.apache.ws.security.WSConstants;
import org.apache.ws.security.WSDocInfo;
import org.apache.ws.security.WSSConfig;
+import org.apache.ws.security.WSSecurityEngineResult;
import org.apache.ws.security.WSSecurityException;
import org.apache.ws.security.components.crypto.Crypto;
import org.apache.ws.security.util.WSSecurityUtil;
@@ -53,7 +54,7 @@ public class EncryptedDataProcessor impl
Crypto decCrypto,
CallbackHandler cb,
WSDocInfo wsDocInfo,
- List returnResults,
+ List<WSSecurityEngineResult> 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=1034482&r1=1034481&r2=1034482&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 Fri Nov 12 17:29:54 2010
@@ -73,7 +73,7 @@ public class EncryptedKeyProcessor imple
Crypto decCrypto,
CallbackHandler cb,
WSDocInfo wsDocInfo,
- List returnResults,
+ List<WSSecurityEngineResult> returnResults,
WSSConfig wsc
) throws WSSecurityException {
if (log.isDebugEnabled()) {
@@ -86,7 +86,7 @@ public class EncryptedKeyProcessor imple
if (cb == null) {
throw new WSSecurityException(WSSecurityException.FAILURE, "noCallback");
}
- List dataRefs = handleEncryptedKey(elem, cb, decCrypto, null);
+ List<WSDataRef> dataRefs = handleEncryptedKey(elem, cb, decCrypto, null);
encryptedKeyId = elem.getAttribute("Id");
WSSecurityEngineResult result = new WSSecurityEngineResult(
@@ -106,7 +106,7 @@ public class EncryptedKeyProcessor imple
);
}
- public List handleEncryptedKey(
+ public List<WSDataRef> handleEncryptedKey(
Element xencEncryptedKey,
CallbackHandler cb,
Crypto crypto
@@ -114,14 +114,14 @@ public class EncryptedKeyProcessor imple
return handleEncryptedKey(xencEncryptedKey, cb, crypto, null);
}
- public List handleEncryptedKey(
+ public List<WSDataRef> handleEncryptedKey(
Element xencEncryptedKey,
PrivateKey privatekey
) throws WSSecurityException {
return handleEncryptedKey(xencEncryptedKey, null, null, privatekey);
}
- public List handleEncryptedKey(
+ public List<WSDataRef> handleEncryptedKey(
Element xencEncryptedKey,
CallbackHandler cb,
Crypto crypto,
@@ -188,7 +188,7 @@ public class EncryptedKeyProcessor imple
WSSecurityUtil.getDirectChildElement(
xencEncryptedKey, "ReferenceList", WSConstants.ENC_NS
);
- List dataRefs = new Vector();
+ List<WSDataRef> dataRefs = new Vector<WSDataRef>();
if (refList != null) {
for (Node node = refList.getFirstChild();
node != null;
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ws.apache.org
For additional commands, e-mail: dev-help@ws.apache.org