You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by ru...@apache.org on 2006/04/06 18:19:31 UTC
svn commit: r392008 - in
/webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security:
rahas/STSRequester.java trust/Constants.java trust/Token.java
trust/impl/SCTIssuer.java
Author: ruchithf
Date: Thu Apr 6 09:19:28 2006
New Revision: 392008
URL: http://svn.apache.org/viewcvs?rev=392008&view=rev
Log:
- Do not clone the node in the token, rather import the element in to the Token with the tempDocument within the Token.
- Added RequestedAttachedReference to the response.
Modified:
webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/rahas/STSRequester.java
webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/trust/Constants.java
webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/trust/Token.java
webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/trust/impl/SCTIssuer.java
Modified: webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/rahas/STSRequester.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/rahas/STSRequester.java?rev=392008&r1=392007&r2=392008&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/rahas/STSRequester.java (original)
+++ webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/rahas/STSRequester.java Thu Apr 6 09:19:28 2006
@@ -116,7 +116,7 @@
OMElement sctElem = rstElem.getFirstChildWithName(SecurityContextToken.TOKEN);
if(sctElem != null) {
SecurityContextToken sct = new SecurityContextToken((Element)sctElem);
- token = new Token(sct.getIdentifier(), sctElem.cloneOMElement());
+ token = new Token(sct.getIdentifier(), sctElem);
config.resgisterContext(sct.getIdentifier());
} else {
throw new RahasException("sctMissingInResponse");
Modified: webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/trust/Constants.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/trust/Constants.java?rev=392008&r1=392007&r2=392008&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/trust/Constants.java (original)
+++ webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/trust/Constants.java Thu Apr 6 09:19:28 2006
@@ -28,6 +28,8 @@
public static final String REQUEST_SECURITY_TOKEN_RESPONSE_LN = "RequestSecurityTokenResponse";
public static final String REQUESTED_SECURITY_TOKEN_LN = "RequestedSecurityToken";
public final static String BINARY_SECRET = "BinarySecret";
+ public final static String REQUESTED_ATTACHED_REFERENCE = "RequestedAttachedReference";
+ public final static String REQUESTED_UNATTACHED_REFERENCE = "RequestedUnattachedReference";
//RequestTypes
public final static String REQ_TYPE_ISSUE = "http://schemas.xmlsoap.org/ws/2005/02/trust/Issue";
Modified: webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/trust/Token.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/trust/Token.java?rev=392008&r1=392007&r2=392008&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/trust/Token.java (original)
+++ webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/trust/Token.java Thu Apr 6 09:19:28 2006
@@ -17,6 +17,9 @@
package org.apache.axis2.security.trust;
import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.impl.dom.factory.OMDOMFactory;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
import java.util.HashMap;
@@ -39,6 +42,8 @@
*/
public class Token {
+ private static Document dummyDoc = new OMDOMFactory().getDocument();
+
public final static int ISSUED = 1;
public final static int EXPIRED = 2;
public final static int CANCELLED = 3;
@@ -90,7 +95,7 @@
public Token(String id, OMElement tokenElem) {
this.id = id;
- this.token = tokenElem;
+ this.token = (OMElement)dummyDoc.importNode((Element)tokenElem, true);
}
/**
Modified: webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/trust/impl/SCTIssuer.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/trust/impl/SCTIssuer.java?rev=392008&r1=392007&r2=392008&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/trust/impl/SCTIssuer.java (original)
+++ webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/trust/impl/SCTIssuer.java Thu Apr 6 09:19:28 2006
@@ -37,7 +37,9 @@
import org.apache.ws.security.handler.WSHandlerConstants;
import org.apache.ws.security.handler.WSHandlerResult;
import org.apache.ws.security.message.WSSecEncryptedKey;
+import org.apache.ws.security.message.token.Reference;
import org.apache.ws.security.message.token.SecurityContextToken;
+import org.apache.ws.security.message.token.SecurityTokenReference;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
@@ -191,7 +193,7 @@
binSecElem.setText(Base64.encode(secret));
//Store the tokens
- Token sctToken = new Token(sct.getIdentifier(), ((OMElement)sct.getElement()).cloneOMElement());
+ Token sctToken = new Token(sct.getIdentifier(), (OMElement)sct.getElement());
sctToken.setSecret(secret);
this.getTokenStore(msgCtx).add(sctToken);
@@ -220,7 +222,8 @@
}
SecurityContextToken sct = new SecurityContextToken(doc);
- sct.setID("sctId-" + sct.getElement().hashCode());
+ String sctId = "sctId-" + sct.getElement().hashCode();
+ sct.setID(sctId);
OMElement rstrElem = env.getOMFactory().createOMElement(
new QName(Constants.WST_NS,
@@ -240,16 +243,22 @@
OMElement reqProofTok = env.getOMFactory().createOMElement(
new QName(Constants.WST_NS, Constants.REQUESTED_PROOF_TOKEN_LN,
Constants.WST_PREFIX), rstrElem);
-
+
if(bstElem != null) {
reqProofTok.addChild((OMElement)bstElem);
}
reqProofTok.addChild((OMElement)encryptedKeyElem);
+ OMElement reqAttRef = env.getOMFactory().createOMElement(
+ new QName(Constants.WST_NS,
+ Constants.REQUESTED_ATTACHED_REFERENCE,
+ Constants.WST_PREFIX), rstrElem);
+ reqAttRef.addChild((OMElement) this.createSecurityTokenReference(doc,
+ sctId, Constants.TOK_TYPE_SCT));
+
//Store the tokens
- OMElement clonedElem = ((OMElement)sct.getElement()).cloneOMElement();
- Token sctToken = new Token(sct.getIdentifier(), clonedElem);
+ Token sctToken = new Token(sct.getIdentifier(), (OMElement)sct.getElement());
sctToken.setSecret(encrKeyBuilder.getEphemeralKey());
this.getTokenStore(msgCtx).add(sctToken);
@@ -326,6 +335,17 @@
*/
public void setConfigurationParamName(String configParamName) {
this.configParamName = configParamName;
+ }
+
+ private Element createSecurityTokenReference(Document doc, String refUri, String refValueType) {
+
+ Reference ref = new Reference(doc);
+ ref.setURI(refUri);
+ ref.setValueType(refValueType);
+ SecurityTokenReference str = new SecurityTokenReference(doc);
+ str.setReference(ref);
+
+ return str.getElement();
}
}