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/07 17:51:42 UTC

svn commit: r392326 - in /webservices/axis2/trunk/java/modules: integration/test-resources/security/rahas/ security/src/org/apache/axis2/security/trust/impl/

Author: ruchithf
Date: Fri Apr  7 08:51:39 2006
New Revision: 392326

URL: http://svn.apache.org/viewcvs?rev=392326&view=rev
Log:
Control the addition of RequestedAttachedReference and RequestedUnattachedReference using presence of following elements in the sct-issuer configuration:
<addRequestedAttachedRef />
<addRequestedUnattachedRef />


Modified:
    webservices/axis2/trunk/java/modules/integration/test-resources/security/rahas/s1-services.xml
    webservices/axis2/trunk/java/modules/integration/test-resources/security/rahas/s2-services.xml
    webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/trust/impl/SCTIssuer.java
    webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/trust/impl/SCTIssuerConfig.java

Modified: webservices/axis2/trunk/java/modules/integration/test-resources/security/rahas/s1-services.xml
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/integration/test-resources/security/rahas/s1-services.xml?rev=392326&r1=392325&r2=392326&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test-resources/security/rahas/s1-services.xml (original)
+++ webservices/axis2/trunk/java/modules/integration/test-resources/security/rahas/s1-services.xml Fri Apr  7 08:51:39 2006
@@ -13,6 +13,7 @@
 		<sct-issuer-config>
 			<proofToken>EncryptedKey</proofToken>
 			<cryptoProperties>sctIssuer.properties</cryptoProperties>
+			<addRequestedAttachedRef />
 		</sct-issuer-config>
     </parameter>
     

Modified: webservices/axis2/trunk/java/modules/integration/test-resources/security/rahas/s2-services.xml
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/integration/test-resources/security/rahas/s2-services.xml?rev=392326&r1=392325&r2=392326&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test-resources/security/rahas/s2-services.xml (original)
+++ webservices/axis2/trunk/java/modules/integration/test-resources/security/rahas/s2-services.xml Fri Apr  7 08:51:39 2006
@@ -13,6 +13,8 @@
 		<sct-issuer-config>
 			<proofToken>BinarySecret</proofToken>
 			<cryptoProperties>sctIssuer.properties</cryptoProperties>
+			<addRequestedAttachedRef />
+			<addRequestedUnattachedRef />
 		</sct-issuer-config>
     </parameter>
     

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=392326&r1=392325&r2=392326&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 Fri Apr  7 08:51:39 2006
@@ -167,7 +167,8 @@
         Document doc = ((Element)env).getOwnerDocument();
         
         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,
@@ -181,6 +182,25 @@
         
         rstElem.addChild((OMElement)sct.getElement());
         
+        if (config.addRequestedAttachedRef) {
+            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));
+        }
+
+        if (config.addRequestedUnattachedRef) {
+            OMElement reqUnattRef = env.getOMFactory().createOMElement(
+                    new QName(Constants.WST_NS,
+                            Constants.REQUESTED_UNATTACHED_REFERENCE,
+                            Constants.WST_PREFIX), rstrElem);
+
+            reqUnattRef.addChild((OMElement) this.createSecurityTokenReference(
+                    doc, sct.getIdentifier(), Constants.TOK_TYPE_SCT));
+        }
+        
         OMElement reqProofTok = env.getOMFactory().createOMElement(
                 new QName(Constants.WST_NS, Constants.REQUESTED_PROOF_TOKEN_LN,
                         Constants.WST_PREFIX), rstrElem);
@@ -237,20 +257,24 @@
         
         rstElem.addChild((OMElement)sct.getElement());
         
-        OMElement reqAttRef = env.getOMFactory().createOMElement(
-                new QName(Constants.WST_NS,
-                        Constants.REQUESTED_ATTACHED_REFERENCE,
-                        Constants.WST_PREFIX), rstrElem);
-        OMElement reqUnattRef = env.getOMFactory().createOMElement(
-                new QName(Constants.WST_NS,
-                        Constants.REQUESTED_UNATTACHED_REFERENCE,
-                        Constants.WST_PREFIX), rstrElem);
-        
-        reqAttRef.addChild((OMElement) this.createSecurityTokenReference(doc,
-                "#" + sctId, Constants.TOK_TYPE_SCT));
-        
-        reqUnattRef.addChild((OMElement) this.createSecurityTokenReference(doc,
-                sct.getIdentifier(), Constants.TOK_TYPE_SCT));
+        if (config.addRequestedAttachedRef) {
+            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));
+        }
+
+        if (config.addRequestedUnattachedRef) {
+            OMElement reqUnattRef = env.getOMFactory().createOMElement(
+                    new QName(Constants.WST_NS,
+                            Constants.REQUESTED_UNATTACHED_REFERENCE,
+                            Constants.WST_PREFIX), rstrElem);
+
+            reqUnattRef.addChild((OMElement) this.createSecurityTokenReference(
+                    doc, sct.getIdentifier(), Constants.TOK_TYPE_SCT));
+        }
         
         Element encryptedKeyElem = encrKeyBuilder.getEncryptedKeyElement();
         Element bstElem = encrKeyBuilder.getBinarySecurityTokenElement();

Modified: webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/trust/impl/SCTIssuerConfig.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/trust/impl/SCTIssuerConfig.java?rev=392326&r1=392325&r2=392326&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/trust/impl/SCTIssuerConfig.java (original)
+++ webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/trust/impl/SCTIssuerConfig.java Fri Apr  7 08:51:39 2006
@@ -30,6 +30,8 @@
 public class SCTIssuerConfig {
 
     public final static QName SCT_ISSUER_CONFIG = new QName("sct-issuer-config");
+    public final static QName ADD_REQUESTED_ATTACHED_REF = new QName("addRequestedAttachedRef");
+    public final static QName ADD_REQUESTED_UNATTACHED_REF = new QName("addRequestedUnattachedRef");
     
     public final static String SCT_ISSUER_CONFIG_PARAM = 
                                             "sct-issuer-config-param";
@@ -37,26 +39,11 @@
     protected String proofTokenType = SCTIssuer.ENCRYPTED_KEY;
 
     protected String cryptoPropertiesFile = null;
-
-    public static SCTIssuerConfig load(OMElement elem) throws TrustException {
-        return new SCTIssuerConfig(elem);
-    }
     
-    public static SCTIssuerConfig load(String configFilePath)
-            throws TrustException {
-        FileInputStream fis = null;
-        StAXOMBuilder builder = null;
-        try {
-            fis = new FileInputStream(configFilePath);
-             builder = new StAXOMBuilder(fis);
-        } catch (Exception e) {
-            throw new TrustException("errorLoadingConfigFile",
-                    new String[] { configFilePath });
-        }
-        
-        return load(builder.getDocumentElement());
-    }
-
+    protected boolean addRequestedAttachedRef;
+    
+    protected boolean addRequestedUnattachedRef;
+    
     public SCTIssuerConfig(OMElement elem) throws TrustException {
         OMElement proofTokenElem = (OMElement) elem.getFirstChildWithName(
                 new QName("proofToken"));
@@ -72,6 +59,31 @@
             throw new TrustException("sctIssuerCryptoPropertiesMissing");
         }
 
+        this.addRequestedAttachedRef = elem
+                .getFirstChildWithName(ADD_REQUESTED_ATTACHED_REF) != null;
+        this.addRequestedAttachedRef = elem
+                .getFirstChildWithName(ADD_REQUESTED_UNATTACHED_REF) != null;
+        
         this.cryptoPropertiesFile = cryptoPropertiesElem.getText();
     }
+    
+    public static SCTIssuerConfig load(OMElement elem) throws TrustException {
+        return new SCTIssuerConfig(elem);
+    }
+    
+    public static SCTIssuerConfig load(String configFilePath)
+            throws TrustException {
+        FileInputStream fis = null;
+        StAXOMBuilder builder = null;
+        try {
+            fis = new FileInputStream(configFilePath);
+            builder = new StAXOMBuilder(fis);
+        } catch (Exception e) {
+            throw new TrustException("errorLoadingConfigFile",
+                    new String[] { configFilePath });
+        }
+        
+        return builder != null ? load(builder.getDocumentElement()) : null;
+    }
+
 }