axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ruchi...@apache.org
Subject svn commit: r397768 - in /webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy: model/PolicyEngineData.java parser/processors/TransportBindingProcessor.java
Date Fri, 28 Apr 2006 05:38:48 GMT
Author: ruchithf
Date: Thu Apr 27 22:38:47 2006
New Revision: 397768

URL: http://svn.apache.org/viewcvs?rev=397768&view=rev
Log:
Updated the TransportBindingProcessor to parse a simple TransportBinding assertion

Modified:
    webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy/model/PolicyEngineData.java
    webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy/parser/processors/TransportBindingProcessor.java

Modified: webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy/model/PolicyEngineData.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy/model/PolicyEngineData.java?rev=397768&r1=397767&r2=397768&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy/model/PolicyEngineData.java
(original)
+++ webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy/model/PolicyEngineData.java
Thu Apr 27 22:38:47 2006
@@ -33,55 +33,60 @@
     }
     
     public static  PolicyEngineData copy(QName name) throws WSSPolicyException {
-        if(name.getLocalPart().equals(SecurityPolicy.symmetricBinding.getTokenName())) {
+        String localPart = name.getLocalPart();
+        if(localPart.equals(SecurityPolicy.symmetricBinding.getTokenName())) {
             return new SymmetricBinding();
-        } else if (name.getLocalPart().equals(SecurityPolicy.asymmetricBinding.getTokenName()))
{
+        } else if (localPart.equals(SecurityPolicy.asymmetricBinding.getTokenName())) {
             return new AsymmetricBinding();
-        } else if (name.getLocalPart().equals(SecurityPolicy.transportBinding.getTokenName()))
{
+        } else if (localPart.equals(SecurityPolicy.transportBinding.getTokenName())) {
             return new TransportBinding();
-        } else if (name.getLocalPart().equals(SecurityPolicy.algorithmSuite.getTokenName()))
{
+        } else if (localPart.equals(SecurityPolicy.algorithmSuite.getTokenName())) {
             return new AlgorithmSuite();
-        } else if (name.getLocalPart().equals(SecurityPolicy.signedElements.getTokenName()))
{
+        } else if (localPart.equals(SecurityPolicy.signedElements.getTokenName())) {
             return new SignedEncryptedElements(true);
-        } else if (name.getLocalPart().equals(SecurityPolicy.encryptedElements.getTokenName()))
{
+        } else if (localPart.equals(SecurityPolicy.encryptedElements.getTokenName())) {
             return new SignedEncryptedElements(false);
-        } else if (name.getLocalPart().equals(SecurityPolicy.signedParts.getTokenName()))
{
+        } else if (localPart.equals(SecurityPolicy.signedParts.getTokenName())) {
             return new SignedEncryptedParts(true);
-        } else if (name.getLocalPart().equals(SecurityPolicy.encryptedParts.getTokenName()))
{
+        } else if (localPart.equals(SecurityPolicy.encryptedParts.getTokenName())) {
             return new SignedEncryptedParts(false);
-        } else if (name.getLocalPart().equals(SecurityPolicy.header.getTokenName())) {
+        } else if (localPart.equals(SecurityPolicy.header.getTokenName())) {
             return new Header();
-        } else if (name.getLocalPart().equals(SecurityPolicy.protectionToken.getTokenName()))
{
+        } else if (localPart.equals(SecurityPolicy.protectionToken.getTokenName())) {
             return new ProtectionToken();
-        } else if (name.getLocalPart().equals(SecurityPolicy.signatureToken.getTokenName()))
{
+        } else if (localPart.equals(SecurityPolicy.signatureToken.getTokenName())) {
             return new SignatureToken();
-        } else if (name.getLocalPart().equals(SecurityPolicy.encryptionToken.getTokenName()))
{
+        } else if (localPart.equals(SecurityPolicy.encryptionToken.getTokenName())) {
             return new EncryptionToken();
-        } else if (name.getLocalPart().equals(SecurityPolicy.x509Token.getTokenName())) {
+        } else if (localPart.equals(SecurityPolicy.x509Token.getTokenName())) {
             return new X509Token();
-        } else if (name.getLocalPart().equals(SecurityPolicy.layout.getTokenName())) {
+        } else if (localPart.equals(SecurityPolicy.layout.getTokenName())) {
             return new Layout();
-        } else if (name.getLocalPart().equals(SecurityPolicy.signedSupportingTokens.getTokenName()))
{
+        } else if (localPart.equals(SecurityPolicy.signedSupportingTokens.getTokenName()))
{
             return new SupportingToken(Constants.SUPPORTING_TOKEN_SIGNED);
-        } else if (name.getLocalPart().equals(SecurityPolicy.signedEndorsingSupportingTokens.getTokenName()))
{
+        } else if (localPart.equals(SecurityPolicy.signedEndorsingSupportingTokens.getTokenName()))
{
             return new SupportingToken(Constants.SUPPORTING_TOKEN_SIGNED_ENDORSING);
-        } else if (name.getLocalPart().equals(SecurityPolicy.supportingTokens.getTokenName()))
{
+        } else if (localPart.equals(SecurityPolicy.supportingTokens.getTokenName())) {
             return new SupportingToken(Constants.SUPPORTING_TOKEN_SUPPORTING);
-        } else if (name.getLocalPart().equals(SecurityPolicy.endorsingSupportingTokens.getTokenName()))
{
+        } else if (localPart.equals(SecurityPolicy.endorsingSupportingTokens.getTokenName()))
{
             return new SupportingToken(Constants.SUPPORTING_TOKEN_ENDORSING);
-        } else if (name.getLocalPart().equals(SecurityPolicy.usernameToken.getTokenName()))
{
+        } else if (localPart.equals(SecurityPolicy.usernameToken.getTokenName())) {
             return new UsernameToken();
-        } else if (name.getLocalPart().equals(SecurityPolicy.wss10.getTokenName())) {
+        } else if (localPart.equals(SecurityPolicy.wss10.getTokenName())) {
             return new Wss10();
-        } else if (name.getLocalPart().equals(SecurityPolicy.wss11.getTokenName())) {
+        } else if (localPart.equals(SecurityPolicy.wss11.getTokenName())) {
             return new Wss11();
-        } else if (name.getLocalPart().equals(SecurityPolicy.initiatorToken.getTokenName()))
{
+        } else if (localPart.equals(SecurityPolicy.initiatorToken.getTokenName())) {
             return new InitiatorToken();
-        } else if (name.getLocalPart().equals(SecurityPolicy.recipientToken.getTokenName()))
{
+        } else if (localPart.equals(SecurityPolicy.recipientToken.getTokenName())) {
             return new RecipientToken();
+        } else if (localPart.equals(SecurityPolicy.transportToken.getTokenName())) {
+            return new TransportToken();
+        } else if (localPart.equals(SecurityPolicy.httpsToken.getTokenName())) {
+            return new HttpsToken();
         } else {
-            log.error("Unsuppotred: " + name.getLocalPart());
-            throw new WSSPolicyException("Unsuppotred complex assertion :" + name.getLocalPart());
+            log.error("Unsuppotred: " + localPart);
+            throw new WSSPolicyException("Unsuppotred complex assertion :" + localPart);
         }
     }
 }

Modified: webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy/parser/processors/TransportBindingProcessor.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy/parser/processors/TransportBindingProcessor.java?rev=397768&r1=397767&r2=397768&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy/parser/processors/TransportBindingProcessor.java
(original)
+++ webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy/parser/processors/TransportBindingProcessor.java
Thu Apr 27 22:38:47 2006
@@ -22,13 +22,12 @@
 import org.apache.ws.security.policy.parser.SecurityPolicy;
 import org.apache.ws.security.policy.parser.SecurityPolicyToken;
 import org.apache.ws.security.policy.parser.SecurityProcessorContext;
-import org.apache.ws.security.processor.TimestampProcessor;
 
 public class TransportBindingProcessor {
     
     private Log log = LogFactory.getLog(getClass());
     
-    private boolean initializedSymmetricBinding = false;
+    private boolean initializedTransportBinding = false;
     
     private void initializeTransportBinding(SecurityPolicyToken spt)
         throws NoSuchMethodException {
@@ -37,6 +36,25 @@
         tmpSpt.setProcessTokenMethod(this);
         spt.setChildToken(tmpSpt);
 
+        tmpSpt = SecurityPolicy.transportToken.copy();
+        tmpSpt.setProcessTokenMethod(this);
+        spt.setChildToken(tmpSpt);
+        
+        //TODO: This is just  ahack , have to move this to a proper processor
+        SecurityPolicyToken tmpSpt2 = SecurityPolicy.httpsToken.copy();
+        tmpSpt2.setProcessTokenMethod(this);
+        tmpSpt.setChildToken(tmpSpt2);
+        
+        tmpSpt = SecurityPolicy.algorithmSuite.copy();
+        tmpSpt.setProcessTokenMethod(new AlgorithmSuiteProcessor());
+        spt.setChildToken(tmpSpt);
+        
+        tmpSpt = SecurityPolicy.layout.copy();
+        tmpSpt.setProcessTokenMethod(new LayoutProcessor());
+        spt.setChildToken(tmpSpt);
+        
+        
+        
     }
     
     public Object doTransportBinding(SecurityProcessorContext spc) {
@@ -48,10 +66,10 @@
         switch (spc.getAction()) {
 
         case SecurityProcessorContext.START:
-            if (!initializedSymmetricBinding) {
+            if (!initializedTransportBinding) {
                 try {
                     initializeTransportBinding(spt);
-                    initializedSymmetricBinding = true;
+                    initializedTransportBinding = true;
                 } catch (NoSuchMethodException e) {
                     log.error(e.getMessage(), e);
                     return new Boolean(false);
@@ -73,6 +91,38 @@
         if(spc.getAction() == SecurityProcessorContext.START) {
             ((Binding)spc.readCurrentPolicyEngineData()).setIncludeTimestamp(true);
         }
+        return new Boolean(true);
+    }
+    
+    public Object doTransportToken(SecurityProcessorContext spc) {
+        log.debug("Processing "
+                + spc.readCurrentSecurityToken().getTokenName() + ": "
+                + SecurityProcessorContext.ACTION_NAMES[spc.getAction()]);
+        log.debug("TODO: doTransportToken");
+        return new Boolean(true);
+    }
+
+    public Object doAlgorithmSuite(SecurityProcessorContext spc) {
+        log.debug("Processing "
+                + spc.readCurrentSecurityToken().getTokenName() + ": "
+                + SecurityProcessorContext.ACTION_NAMES[spc.getAction()]);
+        log.debug("TODO: doAlgorithmSuite");
+        return new Boolean(true);
+    }
+
+    public Object doLayout(SecurityProcessorContext spc) {
+        log.debug("Processing "
+                + spc.readCurrentSecurityToken().getTokenName() + ": "
+                + SecurityProcessorContext.ACTION_NAMES[spc.getAction()]);
+        log.debug("TODO: doLayout");
+        return new Boolean(true);
+    }
+
+    public Object doHttpsToken(SecurityProcessorContext spc) {
+        log.debug("Processing "
+                + spc.readCurrentSecurityToken().getTokenName() + ": "
+                + SecurityProcessorContext.ACTION_NAMES[spc.getAction()]);
+        log.debug("TODO: doHttpsToken");
         return new Boolean(true);
     }
 }



Mime
View raw message