Author: dkulp
Date: Mon Mar 23 20:19:36 2009
New Revision: 757531
URL: http://svn.apache.org/viewvc?rev=757531&view=rev
Log:
Stop using hashCode for ID's
Added:
webservices/wss4j/trunk/src/org/apache/ws/security/WsuIdAllocator.java
(with props)
Modified:
webservices/wss4j/trunk/src/org/apache/ws/security/WSSConfig.java
webservices/wss4j/trunk/src/org/apache/ws/security/message/WSBaseMessage.java
webservices/wss4j/trunk/src/org/apache/ws/security/message/WSEncryptBody.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/WSSecDerivedKeyBase.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/WSSecSignatureConfirmation.java
webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecTimestamp.java
webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecUsernameToken.java
webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSignEnvelope.java
webservices/wss4j/trunk/src/org/apache/ws/security/message/token/SecurityContextToken.java
webservices/wss4j/trunk/src/org/apache/ws/security/saml/WSSecSignatureSAML.java
webservices/wss4j/trunk/src/org/apache/ws/security/saml/WSSignSAMLEnvelope.java
webservices/wss4j/trunk/src/org/apache/ws/security/util/UUIDGenerator.java
webservices/wss4j/trunk/test/wssec/PackageTests.java
webservices/wss4j/trunk/test/wssec/TestWSSecurityNew15.java
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=757531&r1=757530&r2=757531&view=diff
==============================================================================
--- webservices/wss4j/trunk/src/org/apache/ws/security/WSSConfig.java (original)
+++ webservices/wss4j/trunk/src/org/apache/ws/security/WSSConfig.java Mon Mar
23 20:19:36 2009
@@ -27,6 +27,7 @@
import org.apache.ws.security.processor.Processor;
import org.apache.ws.security.transform.STRTransform;
import org.apache.ws.security.util.Loader;
+import org.apache.ws.security.util.UUIDGenerator;
import org.apache.xml.security.transforms.Transform;
/**
@@ -194,6 +195,26 @@
* reject custom token types in the callback handler.
*/
protected boolean handleCustomPasswordTypes = false;
+
+ protected WsuIdAllocator idAllocator = new WsuIdAllocator() {
+ int i;
+ private synchronized String next() {
+ return Integer.toString(++i);
+ }
+ public String createId(String prefix, Object o) {
+ if (prefix == null) {
+ return next();
+ }
+ return prefix + next();
+ }
+
+ public String createSecureId(String prefix, Object o) {
+ if (prefix == null) {
+ return UUIDGenerator.getUUID();
+ }
+ return prefix + UUIDGenerator.getUUID();
+ }
+ };
protected HashMap jceProvider = new HashMap(10);
@@ -374,6 +395,17 @@
}
/**
+ * @return Returns the WsuIdAllocator used to generate wsu:Id attributes
+ */
+ public WsuIdAllocator getIdAllocator() {
+ return idAllocator;
+ }
+
+ public void setIdAllocator(WsuIdAllocator idAllocator) {
+ this.idAllocator = idAllocator;
+ }
+
+ /**
* Associate an action name with a specific action code.
*
* This operation allows applications to supply their own
Added: webservices/wss4j/trunk/src/org/apache/ws/security/WsuIdAllocator.java
URL:
http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/org/apache/ws/security/WsuIdAllocator.java?rev=757531&view=auto
==============================================================================
--- webservices/wss4j/trunk/src/org/apache/ws/security/WsuIdAllocator.java
(added)
+++ webservices/wss4j/trunk/src/org/apache/ws/security/WsuIdAllocator.java Mon
Mar 23 20:19:36 2009
@@ -0,0 +1,32 @@
+/**
+ * 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 org.apache.ws.security;
+
+/**
+ * Interface used for generating unique ID's for elements that need
+ * to be addressed by their wsu:Id attribute
+ */
+public interface WsuIdAllocator {
+
+ String createId(String prefix, Object o);
+
+ String createSecureId(String prefix, Object o);
+
+}
Propchange:
webservices/wss4j/trunk/src/org/apache/ws/security/WsuIdAllocator.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
webservices/wss4j/trunk/src/org/apache/ws/security/WsuIdAllocator.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Modified:
webservices/wss4j/trunk/src/org/apache/ws/security/message/WSBaseMessage.java
URL:
http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/org/apache/ws/security/message/WSBaseMessage.java?rev=757531&r1=757530&r2=757531&view=diff
==============================================================================
---
webservices/wss4j/trunk/src/org/apache/ws/security/message/WSBaseMessage.java
(original)
+++
webservices/wss4j/trunk/src/org/apache/ws/security/message/WSBaseMessage.java
Mon Mar 23 20:19:36 2009
@@ -205,7 +205,7 @@
id = bodyElement.getAttributeNS(WSConstants.WSU_NS, "Id");
if ((id == null) || (id.length() == 0)) {
- id = "id-" + Integer.toString(bodyElement.hashCode());
+ id = wssConfig.getIdAllocator().createId("id-", bodyElement);
String prefix = WSSecurityUtil.setNamespace(bodyElement,
WSConstants.WSU_NS, WSConstants.WSU_PREFIX);
bodyElement.setAttributeNS(WSConstants.WSU_NS, prefix + ":Id", id);
Modified:
webservices/wss4j/trunk/src/org/apache/ws/security/message/WSEncryptBody.java
URL:
http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/org/apache/ws/security/message/WSEncryptBody.java?rev=757531&r1=757530&r2=757531&view=diff
==============================================================================
---
webservices/wss4j/trunk/src/org/apache/ws/security/message/WSEncryptBody.java
(original)
+++
webservices/wss4j/trunk/src/org/apache/ws/security/message/WSEncryptBody.java
Mon Mar 23 20:19:36 2009
@@ -346,7 +346,6 @@
}
remoteCert = certs[0];
}
- String certUri = "EncCertId-" + remoteCert.hashCode();
if (tlog.isDebugEnabled()) {
t2 = System.currentTimeMillis();
}
@@ -429,6 +428,7 @@
case WSConstants.BST_DIRECT_REFERENCE:
Reference ref = new Reference(doc);
+ String certUri =
wssConfig.getIdAllocator().createId("EncCertId-", remoteCert);
ref.setURI("#" + certUri);
BinarySecurity bstToken = null;
bstToken = new X509Security(doc);
@@ -520,7 +520,7 @@
}
boolean content = modifier.equals("Content") ? true : false;
- String xencEncryptedDataId = "EncDataId-" + body.hashCode();
+ String xencEncryptedDataId =
wssConfig.getIdAllocator().createId("EncDataId-", body);
/*
* Forth step: encrypt data, and set neccessary attributes in
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=757531&r1=757530&r2=757531&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
Mon Mar 23 20:19:36 2009
@@ -131,7 +131,7 @@
String id = bodyElement.getAttributeNS(WSConstants.WSU_NS, "Id");
if ((id == null) || (id.length() == 0)) {
- id = "id-" + Integer.toString(bodyElement.hashCode());
+ id = wssConfig.getIdAllocator().createId("id-", bodyElement);
String prefix =
WSSecurityUtil.setNamespace(bodyElement, WSConstants.WSU_NS,
WSConstants.WSU_PREFIX);
bodyElement.setAttributeNS(WSConstants.WSU_NS, prefix + ":Id", id);
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=757531&r1=757530&r2=757531&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
Mon Mar 23 20:19:36 2009
@@ -127,7 +127,7 @@
}
boolean content = modifier.equals("Content") ? true : false;
- String xencEncryptedDataId = "EncDataId-" + body.hashCode();
+ String xencEncryptedDataId =
wssConfig.getIdAllocator().createId("EncDataId-", body);
//
// Fourth step: encrypt data, and set necessary attributes in
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=757531&r1=757530&r2=757531&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
Mon Mar 23 20:19:36 2009
@@ -150,15 +150,15 @@
}
sig.addResourceResolver(EnvelopeIdResolver.getInstance());
- String sigUri = "Signature-" + sig.hashCode();
+ String sigUri = wssConfig.getIdAllocator().createId("Signature-", sig);
sig.setId(sigUri);
keyInfo = sig.getKeyInfo();
- keyInfoUri = "KeyId-" + keyInfo.hashCode();
+ keyInfoUri = wssConfig.getIdAllocator().createSecureId("KeyId-",
keyInfo);
keyInfo.setId(keyInfoUri);
secRef = new SecurityTokenReference(doc);
- strUri = "STRId-" + secRef.hashCode();
+ strUri = wssConfig.getIdAllocator().createSecureId("STRId-", secRef);
secRef.setID(strUri);
Reference refUt = new Reference(document);
Modified:
webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecDerivedKeyBase.java
URL:
http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecDerivedKeyBase.java?rev=757531&r1=757530&r2=757531&view=diff
==============================================================================
---
webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecDerivedKeyBase.java
(original)
+++
webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecDerivedKeyBase.java
Mon Mar 23 20:19:36 2009
@@ -195,7 +195,7 @@
// Add the DKTs
dkt = new DerivedKeyToken(this.wscVersion, document);
- dktId = "derivedKeyId-" + dkt.hashCode();
+ dktId = wssConfig.getIdAllocator().createId("derivedKeyId-", dkt);
dkt.setOffset(offset);
dkt.setLength(length);
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=757531&r1=757530&r2=757531&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
Mon Mar 23 20:19:36 2009
@@ -495,7 +495,7 @@
}
boolean content = modifier.equals("Content") ? true : false;
- String xencEncryptedDataId = "EncDataId-" + body.hashCode();
+ String xencEncryptedDataId =
wssConfig.getIdAllocator().createId("EncDataId-", body);
encPart.setEncId(xencEncryptedDataId);
cloneKeyInfo = true;
@@ -534,7 +534,8 @@
String wsuPrefix =
WSSecurityUtil.setNamespace(elem, WSConstants.WSU_NS,
WSConstants.WSU_PREFIX);
elem.setAttributeNS(
- WSConstants.WSU_NS, wsuPrefix + ":Id", "EncHeader-" +
body.hashCode()
+ WSConstants.WSU_NS, wsuPrefix + ":Id",
+ wssConfig.getIdAllocator().createId("EncHeader-", body)
);
NamedNodeMap map = body.getAttributes();
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=757531&r1=757530&r2=757531&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
Mon Mar 23 20:19:36 2009
@@ -314,7 +314,7 @@
new Object[] { user, "signature" }
);
}
- certUri = "CertId-" + certs[0].hashCode();
+ certUri = wssConfig.getIdAllocator().createSecureId("CertId-",
certs[0]);
//
// If no signature algorithm was set try to detect it according to
the
// data stored in the certificate.
@@ -371,17 +371,16 @@
}
sig.addResourceResolver(EnvelopeIdResolver.getInstance());
- String sigUri = "Signature-" + sig.hashCode();
- sig.setId(sigUri);
+ sig.setId(wssConfig.getIdAllocator().createId("Signature-", sig));
keyInfo = sig.getKeyInfo();
- keyInfoUri = "KeyId-" + keyInfo.hashCode();
+ keyInfoUri = wssConfig.getIdAllocator().createSecureId("KeyId-",
keyInfo);
keyInfo.setId(keyInfoUri);
secRef = new SecurityTokenReference(doc);
- strUri = "STRId-" + secRef.hashCode();
+ strUri = wssConfig.getIdAllocator().createSecureId("STRId-", secRef);
secRef.setID(strUri);
-
+
//
// Prepare and setup the token references for this Signature
//
Modified:
webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecSignatureConfirmation.java
URL:
http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecSignatureConfirmation.java?rev=757531&r1=757530&r2=757531&view=diff
==============================================================================
---
webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecSignatureConfirmation.java
(original)
+++
webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecSignatureConfirmation.java
Mon Mar 23 20:19:36 2009
@@ -65,8 +65,7 @@
*/
public void prepare(Document doc) {
sc = new SignatureConfirmation(doc, signatureValue);
- String scId = "SigConf-" + sc.hashCode();
- sc.setID(scId);
+ sc.setID(wssConfig.getIdAllocator().createId("SigConf-", sc));
}
/**
Modified:
webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecTimestamp.java
URL:
http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecTimestamp.java?rev=757531&r1=757530&r2=757531&view=diff
==============================================================================
---
webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecTimestamp.java
(original)
+++
webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecTimestamp.java
Mon Mar 23 20:19:36 2009
@@ -68,7 +68,7 @@
*/
public void prepare(Document doc) {
ts = new Timestamp(wssConfig.isPrecisionInMilliSeconds(), doc,
timeToLive);
- String tsId = "Timestamp-" + ts.hashCode();
+ String tsId = wssConfig.getIdAllocator().createId("Timestamp-", ts);
ts.setID(tsId);
}
Modified:
webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecUsernameToken.java
URL:
http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecUsernameToken.java?rev=757531&r1=757530&r2=757531&view=diff
==============================================================================
---
webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecUsernameToken.java
(original)
+++
webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecUsernameToken.java
Mon Mar 23 20:19:36 2009
@@ -184,8 +184,7 @@
if (created) {
ut.addCreated(wssConfig.isPrecisionInMilliSeconds(), doc);
}
- String utId = "UsernameToken-" + ut.hashCode();
- ut.setID(utId);
+ ut.setID(wssConfig.getIdAllocator().createId("UsernameToken-", ut));
}
/**
Modified:
webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSignEnvelope.java
URL:
http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSignEnvelope.java?rev=757531&r1=757530&r2=757531&view=diff
==============================================================================
---
webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSignEnvelope.java
(original)
+++
webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSignEnvelope.java
Mon Mar 23 20:19:36 2009
@@ -261,7 +261,7 @@
new Object[] { user, "signature" }
);
}
- certUri = "CertId-" + certs[0].hashCode();
+ certUri = wssConfig.getIdAllocator().createSecureId("CertId-",
certs[0]);
if (sigAlgo == null) {
String pubKeyAlgo = certs[0].getPublicKey().getAlgorithm();
log.debug("automatic sig algo detection: " + pubKeyAlgo);
@@ -326,12 +326,12 @@
*/
KeyInfo info = sig.getKeyInfo();
- String keyInfoUri = "KeyId-" + info.hashCode();
+ String keyInfoUri =
wssConfig.getIdAllocator().createSecureId("KeyId-", info);
info.setId(keyInfoUri);
SecurityTokenReference secRef = new SecurityTokenReference(doc);
- String strUri = "STRId-" + secRef.hashCode();
- secRef.setID(strUri);
+ String secRefId = wssConfig.getIdAllocator().createSecureId("STRId-",
info);
+ secRef.setID(secRefId);
if (tlog.isDebugEnabled()) {
t1 = System.currentTimeMillis();
@@ -415,7 +415,7 @@
transforms = new Transforms(doc);
transforms.addTransform(
STRTransform.implementedTransformURI, ctx);
- sig.addDocument("#" + strUri, transforms);
+ sig.addDocument("#" + secRefId, transforms);
} else if (elemName.equals("Assertion")) { // Assertion
String id = null;
@@ -521,7 +521,7 @@
refUt.setValueType(WSConstants.USERNAMETOKEN_NS +
"#UsernameToken");
String utId = usernameToken.getId();
if (utId == null) {
- utId = "usernameTokenId-" + usernameToken.hashCode();
+ utId = wssConfig.getIdAllocator().createId("usernameTokenId-",
usernameToken);
usernameToken.setId(utId);
}
refUt.setURI("#" + utId);
Modified:
webservices/wss4j/trunk/src/org/apache/ws/security/message/token/SecurityContextToken.java
URL:
http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/org/apache/ws/security/message/token/SecurityContextToken.java?rev=757531&r1=757530&r2=757531&view=diff
==============================================================================
---
webservices/wss4j/trunk/src/org/apache/ws/security/message/token/SecurityContextToken.java
(original)
+++
webservices/wss4j/trunk/src/org/apache/ws/security/message/token/SecurityContextToken.java
Mon Mar 23 20:19:36 2009
@@ -18,6 +18,7 @@
package org.apache.ws.security.message.token;
import org.apache.ws.security.WSConstants;
+import org.apache.ws.security.WSSConfig;
import org.apache.ws.security.WSSecurityException;
import org.apache.ws.security.conversation.ConversationConstants;
import org.apache.ws.security.conversation.ConversationException;
@@ -88,7 +89,7 @@
this.elementIdentifier.appendChild(doc.createTextNode(uuid));
- this.setID("sctId-" + this.element.hashCode());
+
this.setID(WSSConfig.getDefaultWSConfig().getIdAllocator().createSecureId("sctId-",
this.element));
}
/**
Modified:
webservices/wss4j/trunk/src/org/apache/ws/security/saml/WSSecSignatureSAML.java
URL:
http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/org/apache/ws/security/saml/WSSecSignatureSAML.java?rev=757531&r1=757530&r2=757531&view=diff
==============================================================================
---
webservices/wss4j/trunk/src/org/apache/ws/security/saml/WSSecSignatureSAML.java
(original)
+++
webservices/wss4j/trunk/src/org/apache/ws/security/saml/WSSecSignatureSAML.java
Mon Mar 23 20:19:36 2009
@@ -342,18 +342,18 @@
}
sig.addResourceResolver(EnvelopeIdResolver.getInstance());
- String sigUri = "Signature-" + sig.hashCode();
+ String sigUri = wssConfig.getIdAllocator().createId("Signature-", sig);
sig.setId(sigUri);
keyInfo = sig.getKeyInfo();
- keyInfoUri = "KeyId-" + keyInfo.hashCode();
+ keyInfoUri = wssConfig.getIdAllocator().createSecureId("KeyId-",
keyInfo);
keyInfo.setId(keyInfoUri);
secRef = new SecurityTokenReference(doc);
- strUri = "STRId-" + secRef.hashCode();
+ strUri = wssConfig.getIdAllocator().createSecureId("STRId-", secRef);
secRef.setID(strUri);
- certUri = "CertId-" + certs[0].hashCode();
+ certUri = wssConfig.getIdAllocator().createSecureId("CertId-",
certs[0]);
/*
* If the sender vouches, then we must sign the SAML token _and_ at
@@ -368,7 +368,7 @@
try {
if (senderVouches) {
secRefSaml = new SecurityTokenReference(doc);
- String strSamlUri = "STRSAMLId-" + secRefSaml.hashCode();
+ String strSamlUri =
wssConfig.getIdAllocator().createSecureId("STRSAMLId-", secRefSaml);
secRefSaml.setID(strSamlUri);
// Decouple Reference/KeyInfo setup - quick shot here
Modified:
webservices/wss4j/trunk/src/org/apache/ws/security/saml/WSSignSAMLEnvelope.java
URL:
http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/org/apache/ws/security/saml/WSSignSAMLEnvelope.java?rev=757531&r1=757530&r2=757531&view=diff
==============================================================================
---
webservices/wss4j/trunk/src/org/apache/ws/security/saml/WSSignSAMLEnvelope.java
(original)
+++
webservices/wss4j/trunk/src/org/apache/ws/security/saml/WSSignSAMLEnvelope.java
Mon Mar 23 20:19:36 2009
@@ -243,14 +243,14 @@
}
KeyInfo info = sig.getKeyInfo();
- String keyInfoUri = "KeyId-" + info.hashCode();
+ String keyInfoUri =
wssConfig.getIdAllocator().createSecureId("KeyId-", info);
info.setId(keyInfoUri);
SecurityTokenReference secRef = new SecurityTokenReference(doc);
- String strUri = "STRId-" + secRef.hashCode();
+ String strUri = wssConfig.getIdAllocator().createSecureId("STRId-",
secRef);
secRef.setID(strUri);
- String certUri = "CertId-" + certs[0].hashCode();
+ String certUri = wssConfig.getIdAllocator().createSecureId("CertId-",
certs[0]);
if (tlog.isDebugEnabled()) {
t1 = System.currentTimeMillis();
@@ -278,7 +278,7 @@
try {
if (senderVouches) {
secRefSaml = new SecurityTokenReference(doc);
- String strSamlUri = "STRSAMLId-" + secRefSaml.hashCode();
+ String strSamlUri =
wssConfig.getIdAllocator().createSecureId("STRSAMLId-", secRefSaml);
secRefSaml.setID(strSamlUri);
// Decouple Refernce/KeyInfo setup - quick shot here
Reference ref = new Reference(doc);
Modified:
webservices/wss4j/trunk/src/org/apache/ws/security/util/UUIDGenerator.java
URL:
http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/org/apache/ws/security/util/UUIDGenerator.java?rev=757531&r1=757530&r2=757531&view=diff
==============================================================================
--- webservices/wss4j/trunk/src/org/apache/ws/security/util/UUIDGenerator.java
(original)
+++ webservices/wss4j/trunk/src/org/apache/ws/security/util/UUIDGenerator.java
Mon Mar 23 20:19:36 2009
@@ -20,7 +20,6 @@
import java.net.UnknownHostException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
-import java.util.Date;
import java.util.Random;
import org.apache.commons.logging.Log;
@@ -49,10 +48,12 @@
if (baseUUID == null) {
baseUUID = getInitialUUID();
}
- if(++incrementingValue >= Long.MAX_VALUE){
+ long i = ++incrementingValue;
+ if(i >= Long.MAX_VALUE || i < 0){
incrementingValue = 0;
+ i = 0;
}
- return baseUUID + new Date().getTime() + incrementingValue;
+ return baseUUID + System.currentTimeMillis() + i;
}
protected static String getInitialUUID() {
Modified: webservices/wss4j/trunk/test/wssec/PackageTests.java
URL:
http://svn.apache.org/viewvc/webservices/wss4j/trunk/test/wssec/PackageTests.java?rev=757531&r1=757530&r2=757531&view=diff
==============================================================================
--- webservices/wss4j/trunk/test/wssec/PackageTests.java (original)
+++ webservices/wss4j/trunk/test/wssec/PackageTests.java Mon Mar 23 20:19:36
2009
@@ -62,6 +62,7 @@
suite.addTestSuite(TestWSSecurityNew12.class);
suite.addTestSuite(TestWSSecurityNew13.class);
suite.addTestSuite(TestWSSecurityNew14.class);
+ suite.addTestSuite(TestWSSecurityNew15.class);
suite.addTestSuite(TestWSSecurityNew16.class);
suite.addTestSuite(TestWSSecurityNew17.class);
suite.addTestSuite(TestWSSecurityNewSOAP12.class);
Modified: webservices/wss4j/trunk/test/wssec/TestWSSecurityNew15.java
URL:
http://svn.apache.org/viewvc/webservices/wss4j/trunk/test/wssec/TestWSSecurityNew15.java?rev=757531&r1=757530&r2=757531&view=diff
==============================================================================
--- webservices/wss4j/trunk/test/wssec/TestWSSecurityNew15.java (original)
+++ webservices/wss4j/trunk/test/wssec/TestWSSecurityNew15.java Mon Mar 23
20:19:36 2009
@@ -74,7 +74,7 @@
+ "xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" "
+ "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">"
+ "<SOAP-ENV:Body>"
- + "<add
xmlns=\"http://ws.apache.org/counter/counter_port_type\">"
+ + "<add
xmlns=\"http://ws.apache.org/counter/counter_port_type/LogTestService2\">"
+ "<value xmlns=\"\">15</value>"
+ "</add>"
+ "</SOAP-ENV:Body>"
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]