axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ruchi...@apache.org
Subject svn commit: r417673 - in /webservices/axis2/trunk/java/modules: integration/test-resources/rahas/ integration/test/org/apache/rahas/ rahas/src/META-INF/ rahas/src/org/apache/rahas/ rahas/src/org/apache/rahas/impl/ security/src/org/apache/rampart/conver...
Date Wed, 28 Jun 2006 05:41:10 GMT
Author: ruchithf
Date: Tue Jun 27 22:41:10 2006
New Revision: 417673

URL: http://svn.apache.org/viewvc?rev=417673&view=rev
Log:
- added the references to the response token
- makesure the requsted token is sent in an RST element


Modified:
    webservices/axis2/trunk/java/modules/integration/test-resources/rahas/s1-services.xml
    webservices/axis2/trunk/java/modules/integration/test/org/apache/rahas/RahasSAMLTokenTest.java
    webservices/axis2/trunk/java/modules/integration/test/org/apache/rahas/TestClient.java
    webservices/axis2/trunk/java/modules/rahas/src/META-INF/module.xml
    webservices/axis2/trunk/java/modules/rahas/src/org/apache/rahas/Constants.java
    webservices/axis2/trunk/java/modules/rahas/src/org/apache/rahas/TrustUtil.java
    webservices/axis2/trunk/java/modules/rahas/src/org/apache/rahas/impl/SAMLTokenIssuer.java
    webservices/axis2/trunk/java/modules/rahas/src/org/apache/rahas/impl/SAMLTokenIssuerConfig.java
    webservices/axis2/trunk/java/modules/rahas/src/org/apache/rahas/impl/SCTIssuerConfig.java
    webservices/axis2/trunk/java/modules/security/src/org/apache/rampart/conversation/Util.java

Modified: webservices/axis2/trunk/java/modules/integration/test-resources/rahas/s1-services.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/integration/test-resources/rahas/s1-services.xml?rev=417673&r1=417672&r2=417673&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test-resources/rahas/s1-services.xml
(original)
+++ webservices/axis2/trunk/java/modules/integration/test-resources/rahas/s1-services.xml
Tue Jun 27 22:41:10 2006
@@ -15,6 +15,8 @@
 			<samlPropFile>saml.s1.properties</samlPropFile>
 			<user>sts</user>
 			<cryptoProperties>sctIssuer.properties</cryptoProperties>
+			<addRequestedAttachedRef />
+			<addRequestedUnattachedRef />
 		</saml-issuer-config>
     </parameter>
     

Modified: webservices/axis2/trunk/java/modules/integration/test/org/apache/rahas/RahasSAMLTokenTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/integration/test/org/apache/rahas/RahasSAMLTokenTest.java?rev=417673&r1=417672&r2=417673&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test/org/apache/rahas/RahasSAMLTokenTest.java
(original)
+++ webservices/axis2/trunk/java/modules/integration/test/org/apache/rahas/RahasSAMLTokenTest.java
Tue Jun 27 22:41:10 2006
@@ -84,8 +84,9 @@
     }
     
     public void validateRsponse(OMElement resp) {
-        System.out.println(resp);
-        OMElement elem = resp.getFirstChildWithName(new QName(XML.SAML_NS, "Assertion"));
+        OMElement rst = resp.getFirstChildWithName(new QName(Constants.WST_NS, Constants.REQUESTED_SECURITY_TOKEN_LN));
+        assertNotNull("RequestedSecurityToken missing", rst);
+        OMElement elem = rst.getFirstChildWithName(new QName(XML.SAML_NS, "Assertion"));
         assertNotNull("Missing SAML Assertoin", elem);
     }
 

Modified: webservices/axis2/trunk/java/modules/integration/test/org/apache/rahas/TestClient.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/integration/test/org/apache/rahas/TestClient.java?rev=417673&r1=417672&r2=417673&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test/org/apache/rahas/TestClient.java
(original)
+++ webservices/axis2/trunk/java/modules/integration/test/org/apache/rahas/TestClient.java
Tue Jun 27 22:41:10 2006
@@ -34,7 +34,7 @@
 
 public abstract class TestClient extends TestCase {
     
-    protected int port = UtilServer.TESTING_PORT;
+    protected int port = 5556; //UtilServer.TESTING_PORT;
     
     public TestClient(String name) {
         super(name);
@@ -82,9 +82,6 @@
             serviceClient.setOptions(options);
 
             //Blocking invocation
-            serviceClient.sendReceive(payload);
-
-            serviceClient.sendReceive(getRequest());
 
             OMElement result = serviceClient.sendReceive(getRequest());
 

Modified: webservices/axis2/trunk/java/modules/rahas/src/META-INF/module.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/rahas/src/META-INF/module.xml?rev=417673&r1=417672&r2=417673&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/rahas/src/META-INF/module.xml (original)
+++ webservices/axis2/trunk/java/modules/rahas/src/META-INF/module.xml Tue Jun 27 22:41:10
2006
@@ -22,7 +22,7 @@
 				</issuer>
 				<issuer class="org.apache.rahas.impl.SAMLTokenIssuer">
 					<configuration-param>saml-issuer-config</configuration-param>
-					<tokenType>urn:oasis:names:tc:SAML:1.0:assertion</tokenType>
+					<tokenType>http://docs.oasis-open.org/wss/oasis-wss-saml-token-profile-1.1#SAMLV1.1</tokenType>
 				</issuer>
 			</token-dispatcher-configuration>
 		</parameter>

Modified: webservices/axis2/trunk/java/modules/rahas/src/org/apache/rahas/Constants.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/rahas/src/org/apache/rahas/Constants.java?rev=417673&r1=417672&r2=417673&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/rahas/src/org/apache/rahas/Constants.java (original)
+++ webservices/axis2/trunk/java/modules/rahas/src/org/apache/rahas/Constants.java Tue Jun
27 22:41:10 2006
@@ -23,15 +23,16 @@
     
     //Local names
     public final static String REQUEST_TYPE_LN = "RequestType";
+    public final static String TOKEN_TYPE_LN = "TokenType";
     public final static String REQUEST_SECURITY_TOKEN_LN = "RequestSecurityToken";
     public static final String REQUESTED_PROOF_TOKEN_LN = "RequestedProofToken";
     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";
-    public final static String KEY_SIZE = "KeySize";
-    public final static String ENTROPY = "Entropy";
+    public final static String BINARY_SECRET_LN = "BinarySecret";
+    public final static String REQUESTED_ATTACHED_REFERENCE_LN = "RequestedAttachedReference";
+    public final static String REQUESTED_UNATTACHED_REFERENCE_LN = "RequestedUnattachedReference";
+    public final static String KEY_SIZE_LN = "KeySize";
+    public final static String ENTROPY_LN = "Entropy";
     
     //RequestTypes
     public final static String REQ_TYPE_ISSUE = "http://schemas.xmlsoap.org/ws/2005/02/trust/Issue";
@@ -41,7 +42,7 @@
 
     //Token types
     public final static String TOK_TYPE_SCT = "http://schemas.xmlsoap.org/ws/2005/02/sc/sct";
-    public final static String TOK_TYPE_SAML_10="urn:oasis:names:tc:SAML:1.0:assertion";
+    public final static String TOK_TYPE_SAML_10="http://docs.oasis-open.org/wss/oasis-wss-saml-token-profile-1.1#SAMLV1.1";
     
     
     //RST actions

Modified: webservices/axis2/trunk/java/modules/rahas/src/org/apache/rahas/TrustUtil.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/rahas/src/org/apache/rahas/TrustUtil.java?rev=417673&r1=417672&r2=417673&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/rahas/src/org/apache/rahas/TrustUtil.java (original)
+++ webservices/axis2/trunk/java/modules/rahas/src/org/apache/rahas/TrustUtil.java Tue Jun
27 22:41:10 2006
@@ -67,13 +67,18 @@
     
     public static OMElement createEntropyElement(OMElement parent) {
         return createOMElement(parent, Constants.WST_NS,
-                Constants.ENTROPY, Constants.WST_PREFIX);
+                Constants.ENTROPY_LN, Constants.WST_PREFIX);
+    }
+    
+    public static OMElement createtTokenTypeElement(OMElement parent) {
+        return createOMElement(parent, Constants.WST_NS,
+                Constants.TOKEN_TYPE_LN, Constants.WST_PREFIX);
     }
     
     public static OMElement createBinarySecretElement(OMElement parent,
             String type) {
         OMElement elem = createOMElement(parent, Constants.WST_NS,
-                Constants.BINARY_SECRET, Constants.WST_PREFIX);
+                Constants.BINARY_SECRET_LN, Constants.WST_PREFIX);
         if(type != null) {
             elem.addAttribute(elem.getOMFactory().createOMAttribute(
                     Constants.ATTR_TYPE, null, type));
@@ -84,7 +89,7 @@
     public static OMElement createRequestedUnattachedRef(OMElement parent,
             String refUri, String refValueType) {
         OMElement elem = createOMElement(parent, Constants.WST_NS,
-                            Constants.REQUESTED_UNATTACHED_REFERENCE,
+                            Constants.REQUESTED_UNATTACHED_REFERENCE_LN,
                             Constants.WST_PREFIX);
         elem.addChild((OMElement) createSecurityTokenReference(
                 ((Element) parent).getOwnerDocument(), refUri, refValueType));
@@ -94,7 +99,7 @@
     public static OMElement createRequestedAttachedRef(OMElement parent,
             String refUri, String refValueType) {
         OMElement elem = createOMElement(parent, Constants.WST_NS,
-                            Constants.REQUESTED_ATTACHED_REFERENCE,
+                            Constants.REQUESTED_ATTACHED_REFERENCE_LN,
                             Constants.WST_PREFIX);
         elem.addChild((OMElement) createSecurityTokenReference(
                 ((Element) parent).getOwnerDocument(), refUri, refValueType));
@@ -103,7 +108,7 @@
     
     public static OMElement createKeySizeElement(OMElement parent) {
         return createOMElement(parent, Constants.WST_NS,
-                Constants.KEY_SIZE,
+                Constants.KEY_SIZE_LN,
                 Constants.WST_PREFIX);
     }
     

Modified: webservices/axis2/trunk/java/modules/rahas/src/org/apache/rahas/impl/SAMLTokenIssuer.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/rahas/src/org/apache/rahas/impl/SAMLTokenIssuer.java?rev=417673&r1=417672&r2=417673&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/rahas/src/org/apache/rahas/impl/SAMLTokenIssuer.java
(original)
+++ webservices/axis2/trunk/java/modules/rahas/src/org/apache/rahas/impl/SAMLTokenIssuer.java
Tue Jun 27 22:41:10 2006
@@ -38,8 +38,6 @@
 import org.w3c.dom.Element;
 import org.w3c.dom.Node;
 
-import java.util.Properties;
-
 /**
  * Issuer to issue SAMl tokens
  */
@@ -58,6 +56,9 @@
     public SOAPEnvelope issue(OMElement request, MessageContext inMsgCtx)
             throws TrustException {
 
+        
+        
+        
         SOAPEnvelope env = this.getSOAPEnvelope(inMsgCtx);
         // Get the document
         Document doc = ((Element) env).getOwnerDocument();
@@ -103,13 +104,26 @@
         SAMLAssertion assertion = saml.newAssertion();
         
         OMElement rstrElem = TrustUtil.createRequestSecurityTokenResponseElement(env.getBody());
+        OMElement rstElem = TrustUtil.createRequestedSecurityTokenElement(rstrElem);
+
+        
+        if (config.addRequestedAttachedRef) {
+            TrustUtil.createRequestedAttachedRef(rstrElem, "#" + assertion.getId(),
+                    Constants.TOK_TYPE_SAML_10);
+        }
+
+        if (config.addRequestedUnattachedRef) {
+            TrustUtil.createRequestedUnattachedRef(
+                    rstrElem, assertion.getId(), Constants.TOK_TYPE_SAML_10);
+        }
         
         try {
             Node tempNode = assertion.toDOM();
-            rstrElem.addChild((OMNode)((Element)rstrElem).getOwnerDocument().importNode(tempNode,
true));
+            rstElem.addChild((OMNode)((Element)rstrElem).getOwnerDocument().importNode(tempNode,
true));
         } catch (SAMLException e) {
             throw new TrustException("samlConverstionError", e);
         }
+
         
         // Set the DOM impl to DOOM
         DocumentBuilderFactoryImpl.setDOOMRequired(false);

Modified: webservices/axis2/trunk/java/modules/rahas/src/org/apache/rahas/impl/SAMLTokenIssuerConfig.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/rahas/src/org/apache/rahas/impl/SAMLTokenIssuerConfig.java?rev=417673&r1=417672&r2=417673&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/rahas/src/org/apache/rahas/impl/SAMLTokenIssuerConfig.java
(original)
+++ webservices/axis2/trunk/java/modules/rahas/src/org/apache/rahas/impl/SAMLTokenIssuerConfig.java
Tue Jun 27 22:41:10 2006
@@ -54,10 +54,17 @@
      * information used securing the response
      */
     private final static QName CRYPTO_PROPERTIES = new QName("cryptoProperties");
+
+    public final static QName ADD_REQUESTED_ATTACHED_REF = new QName("addRequestedAttachedRef");
+    public final static QName ADD_REQUESTED_UNATTACHED_REF = new QName("addRequestedUnattachedRef");
     
     protected String samlPropFile;
     protected String cryptoPropFile;
     protected String user;
+
+    protected boolean addRequestedAttachedRef;
+
+    protected boolean addRequestedUnattachedRef;
     
     private SAMLTokenIssuerConfig(OMElement elem) throws TrustException {
         
@@ -82,6 +89,11 @@
         if(cryptoPropElem != null) {
             this.cryptoPropFile = cryptoPropElem.getText().trim();
         }
+        
+        this.addRequestedAttachedRef = elem
+                .getFirstChildWithName(ADD_REQUESTED_ATTACHED_REF) != null;
+        this.addRequestedUnattachedRef = elem
+                .getFirstChildWithName(ADD_REQUESTED_UNATTACHED_REF) != null;
     }
     
     public static SAMLTokenIssuerConfig load(OMElement elem) throws TrustException {

Modified: webservices/axis2/trunk/java/modules/rahas/src/org/apache/rahas/impl/SCTIssuerConfig.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/rahas/src/org/apache/rahas/impl/SCTIssuerConfig.java?rev=417673&r1=417672&r2=417673&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/rahas/src/org/apache/rahas/impl/SCTIssuerConfig.java
(original)
+++ webservices/axis2/trunk/java/modules/rahas/src/org/apache/rahas/impl/SCTIssuerConfig.java
Tue Jun 27 22:41:10 2006
@@ -63,7 +63,7 @@
 
         this.addRequestedAttachedRef = elem
                 .getFirstChildWithName(ADD_REQUESTED_ATTACHED_REF) != null;
-        this.addRequestedAttachedRef = elem
+        this.addRequestedUnattachedRef = elem
                 .getFirstChildWithName(ADD_REQUESTED_UNATTACHED_REF) != null;
         
         this.cryptoPropertiesFile = cryptoPropertiesElem.getText().trim();

Modified: webservices/axis2/trunk/java/modules/security/src/org/apache/rampart/conversation/Util.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/security/src/org/apache/rampart/conversation/Util.java?rev=417673&r1=417672&r2=417673&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/security/src/org/apache/rampart/conversation/Util.java
(original)
+++ webservices/axis2/trunk/java/modules/security/src/org/apache/rampart/conversation/Util.java
Tue Jun 27 22:41:10 2006
@@ -111,7 +111,7 @@
                         getCallbackHandlerInstance(config), null, new Vector(),
                         null);
                 secret = processor.getDecryptedBytes();
-            } else if (Constants.BINARY_SECRET.equals(elem.getLocalName())
+            } else if (Constants.BINARY_SECRET_LN.equals(elem.getLocalName())
                     && Constants.WST_NS.equals(elem.getNamespace().getName())) {
                 // Handle the wst:BinarySecret case
                 secret = Base64.decode(elem.getText());
@@ -126,12 +126,12 @@
 
         // Check for attached ref
         OMElement reqAttElem = rstr.getFirstChildWithName(new QName(
-                Constants.WST_NS, Constants.REQUESTED_ATTACHED_REFERENCE));
+                Constants.WST_NS, Constants.REQUESTED_ATTACHED_REFERENCE_LN));
         OMElement reqAttRef = reqAttElem == null ? null : reqAttElem
                 .getFirstElement();
 
         OMElement reqUnattElem = rstr.getFirstChildWithName(new QName(
-                Constants.WST_NS, Constants.REQUESTED_UNATTACHED_REFERENCE));
+                Constants.WST_NS, Constants.REQUESTED_UNATTACHED_REFERENCE_LN));
         OMElement reqUnattRef = reqUnattElem == null ? null : reqUnattElem
                 .getFirstElement();
 



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org


Mime
View raw message