You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ws.apache.org by co...@apache.org on 2015/06/22 12:09:16 UTC
svn commit: r1686824 - in /webservices/wss4j/trunk:
ws-security-common/src/main/java/org/apache/wss4j/common/derivedKey/ConversationConstants.java
ws-security-dom/src/main/java/org/apache/wss4j/dom/message/token/SecurityContextToken.java
Author: coheigea
Date: Mon Jun 22 10:09:16 2015
New Revision: 1686824
URL: http://svn.apache.org/r1686824
Log:
[WSS-542] - Secure Conversation Renew is missing Instance creation. Thanks to Freddy Exposito for the patch.
Modified:
webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/derivedKey/ConversationConstants.java
webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/token/SecurityContextToken.java
Modified: webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/derivedKey/ConversationConstants.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/derivedKey/ConversationConstants.java?rev=1686824&r1=1686823&r2=1686824&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/derivedKey/ConversationConstants.java (original)
+++ webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/derivedKey/ConversationConstants.java Mon Jun 22 10:09:16 2015
@@ -68,6 +68,11 @@ public final class ConversationConstants
* Field IDENTIFIER_LN
*/
public static final String IDENTIFIER_LN = "Identifier";
+
+ /**
+ * Field INSTANCE_LN
+ */
+ public static final String INSTANCE_LN = "Instance";
/**
* Field EXPIRES_LN
Modified: webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/token/SecurityContextToken.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/token/SecurityContextToken.java?rev=1686824&r1=1686823&r2=1686824&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/token/SecurityContextToken.java (original)
+++ webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/token/SecurityContextToken.java Mon Jun 22 10:09:16 2015
@@ -44,6 +44,11 @@ public class SecurityContextToken {
*/
private Element elementIdentifier;
+ /**
+ * Instance element
+ */
+ private Element elementInstance;
+
private String tokenType = WSConstants.WSC_SCT;
/**
@@ -115,7 +120,23 @@ public class SecurityContextToken {
tokenType = WSConstants.WSC_SCT_05_12;
}
}
-
+
+ /**
+ * Constructor to create the SCT with a given uuid and instance
+ *
+ * @param doc
+ */
+ public SecurityContextToken(int version, Document doc, String uuid, String instance)
+ throws WSSecurityException {
+ this(version, doc, uuid);
+
+ if (instance != null) {
+ String ns = ConversationConstants.getWSCNs(version);
+ elementInstance = doc.createElementNS(ns, ConversationConstants.INSTANCE_LN);
+ element.appendChild(elementInstance);
+ elementInstance.appendChild(doc.createTextNode(instance));
+ }
+ }
/**
* This is used to create a SecurityContextToken using a DOM Element
@@ -142,6 +163,13 @@ public class SecurityContextToken {
ConversationConstants.IDENTIFIER_LN,
el.getNamespaceURI()
);
+
+ elementInstance =
+ XMLUtils.getDirectChildElement(
+ element,
+ ConversationConstants.INSTANCE_LN,
+ el.getNamespaceURI()
+ );
}
/**
@@ -174,7 +202,22 @@ public class SecurityContextToken {
}
return null;
}
-
+
+ /**
+ * Get the instance.
+ *
+ * @return the data from the instance element.
+ */
+ public String getInstance() {
+ if (elementInstance != null) {
+ Text text = getFirstNode(elementInstance);
+ if (text != null) {
+ return text.getData();
+ }
+ }
+ return null;
+ }
+
/**
* Get the WS-Trust tokenType String associated with this token
*/