cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r688791 - in /cxf/trunk: rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/ rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/interceptors/ rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/ rt/w...
Date Mon, 25 Aug 2008 17:42:44 GMT
Author: dkulp
Date: Mon Aug 25 10:42:43 2008
New Revision: 688791

URL: http://svn.apache.org/viewvc?rev=688791&view=rev
Log:
Start wiring the Ws-sec policies in.

Added:
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/interceptors/WSSecurityInterceptorProvider.java   (with props)
Modified:
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/SP11Constants.java
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/SP12Constants.java
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/SPConstants.java
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/WSSecurityPolicyLoader.java
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/interceptors/HttpsTokenInterceptorProvider.java
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/interceptors/WSSecurityPolicyInterceptorProvider.java
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/AlgorithmSuite.java
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/AsymmetricBinding.java
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/ContentEncryptedElements.java
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/EncryptionToken.java
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/HttpsToken.java
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/InitiatorToken.java
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/IssuedToken.java
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/Layout.java
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/ProtectionToken.java
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/RecipientToken.java
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/RequiredElements.java
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/RequiredParts.java
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/SecureConversationToken.java
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/SecurityContextToken.java
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/SignatureToken.java
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/SignedEncryptedElements.java
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/SignedEncryptedParts.java
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/SupportingToken.java
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/SymmetricBinding.java
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/TransportBinding.java
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/TransportToken.java
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/Trust10.java
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/Trust13.java
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/UsernameToken.java
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/Wss10.java
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/Wss11.java
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/X509Token.java
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/AbstractWSS4JInterceptor.java
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JInInterceptor.java
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JOutInterceptor.java
    cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/security/SecurityPolicyTest.java
    cxf/trunk/systests/src/test/resources/wsdl_systest/DoubleIt.wsdl
    cxf/trunk/testutils/src/main/java/org/apache/cxf/testutil/common/AbstractBusClientServerTestBase.java

Modified: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/SP11Constants.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/SP11Constants.java?rev=688791&r1=688790&r2=688791&view=diff
==============================================================================
--- cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/SP11Constants.java (original)
+++ cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/SP11Constants.java Mon Aug 25 10:42:43 2008
@@ -414,6 +414,8 @@
     public QName getRequiredDerivedKeys() {
         return REQUIRE_DERIVED_KEYS;
     }
-
+    public QName getIncludeTimestamp() {
+        return INCLUDE_TIMESTAMP;
+    }
     
 }

Modified: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/SP12Constants.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/SP12Constants.java?rev=688791&r1=688790&r2=688791&view=diff
==============================================================================
--- cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/SP12Constants.java (original)
+++ cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/SP12Constants.java Mon Aug 25 10:42:43 2008
@@ -479,5 +479,9 @@
     public QName getRequiredDerivedKeys() {
         return REQUIRE_DERIVED_KEYS;
     }
+    public QName getIncludeTimestamp() {
+        return INCLUDE_TIMESTAMP;
+    }
+
 
 }

Modified: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/SPConstants.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/SPConstants.java?rev=688791&r1=688790&r2=688791&view=diff
==============================================================================
--- cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/SPConstants.java (original)
+++ cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/SPConstants.java Mon Aug 25 10:42:43 2008
@@ -439,6 +439,7 @@
     public abstract QName getEncryptedElements();
     public abstract QName getSignedParts();
     public abstract QName getEncryptedParts();
+    public abstract QName getIncludeTimestamp();
     
     public abstract QName getSymmetricBinding();
     public abstract QName getTransportBinding();

Modified: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/WSSecurityPolicyLoader.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/WSSecurityPolicyLoader.java?rev=688791&r1=688790&r2=688791&view=diff
==============================================================================
--- cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/WSSecurityPolicyLoader.java (original)
+++ cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/WSSecurityPolicyLoader.java Mon Aug 25 10:42:43 2008
@@ -55,6 +55,7 @@
 import org.apache.cxf.ws.security.policy.builders.WSS11Builder;
 import org.apache.cxf.ws.security.policy.builders.X509TokenBuilder;
 import org.apache.cxf.ws.security.policy.interceptors.HttpsTokenInterceptorProvider;
+import org.apache.cxf.ws.security.policy.interceptors.WSSecurityInterceptorProvider;
 import org.apache.cxf.ws.security.policy.interceptors.WSSecurityPolicyInterceptorProvider;
 
 
@@ -114,9 +115,8 @@
             return;
         }
         reg.register(new WSSecurityPolicyInterceptorProvider());
-        
-        reg.register(new HttpsTokenInterceptorProvider(SP11Constants.HTTPS_TOKEN));
-        reg.register(new HttpsTokenInterceptorProvider(SP12Constants.HTTPS_TOKEN));
+        reg.register(new WSSecurityInterceptorProvider());
+        reg.register(new HttpsTokenInterceptorProvider());
     }
 
 }

Modified: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/interceptors/HttpsTokenInterceptorProvider.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/interceptors/HttpsTokenInterceptorProvider.java?rev=688791&r1=688790&r2=688791&view=diff
==============================================================================
--- cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/interceptors/HttpsTokenInterceptorProvider.java (original)
+++ cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/interceptors/HttpsTokenInterceptorProvider.java Mon Aug 25 10:42:43 2008
@@ -20,14 +20,13 @@
 package org.apache.cxf.ws.security.policy.interceptors;
 
 import java.net.HttpURLConnection;
+import java.util.Arrays;
 import java.util.Collection;
-import java.util.Collections;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
 import javax.net.ssl.HttpsURLConnection;
-import javax.xml.namespace.QName;
 
 import org.apache.cxf.helpers.CastUtils;
 import org.apache.cxf.interceptor.Fault;
@@ -38,6 +37,8 @@
 import org.apache.cxf.ws.policy.AbstractPolicyInterceptorProvider;
 import org.apache.cxf.ws.policy.AssertionInfo;
 import org.apache.cxf.ws.policy.AssertionInfoMap;
+import org.apache.cxf.ws.security.policy.SP11Constants;
+import org.apache.cxf.ws.security.policy.SP12Constants;
 import org.apache.cxf.ws.security.policy.model.HttpsToken;
 
 /**
@@ -45,12 +46,12 @@
  */
 public class HttpsTokenInterceptorProvider extends AbstractPolicyInterceptorProvider {
 
-    public HttpsTokenInterceptorProvider(QName name) {
-        super(Collections.singleton(name));
-        this.getOutInterceptors().add(new HttpsTokenOutInterceptor(name));
-        this.getOutFaultInterceptors().add(new HttpsTokenOutInterceptor(name));
-        this.getInInterceptors().add(new HttpsTokenInInterceptor(name));
-        this.getInFaultInterceptors().add(new HttpsTokenInInterceptor(name));
+    public HttpsTokenInterceptorProvider() {
+        super(Arrays.asList(SP11Constants.HTTPS_TOKEN, SP12Constants.HTTPS_TOKEN));
+        this.getOutInterceptors().add(new HttpsTokenOutInterceptor());
+        this.getOutFaultInterceptors().add(new HttpsTokenOutInterceptor());
+        this.getInInterceptors().add(new HttpsTokenInInterceptor());
+        this.getInFaultInterceptors().add(new HttpsTokenInInterceptor());
     }
     
     private static Map<String, List<String>> getSetProtocolHeaders(Message message) {
@@ -64,16 +65,14 @@
     }
 
     static class HttpsTokenOutInterceptor extends AbstractPhaseInterceptor<Message> {
-        QName name;
-        public HttpsTokenOutInterceptor(QName n) {
+        public HttpsTokenOutInterceptor() {
             super(Phase.PREPARE_SEND);
-            name = n;
         }
         public void handleMessage(Message message) throws Fault {
             AssertionInfoMap aim = message.get(AssertionInfoMap.class);
             // extract Assertion information
             if (aim != null) {
-                Collection<AssertionInfo> ais = aim.get(name);
+                Collection<AssertionInfo> ais = aim.get(SP12Constants.HTTPS_TOKEN);
                 if (ais == null) {
                     return;
                 }
@@ -126,17 +125,15 @@
     }
     
     static class HttpsTokenInInterceptor extends AbstractPhaseInterceptor<Message> {
-        QName name;
-        public HttpsTokenInInterceptor(QName n) {
+        public HttpsTokenInInterceptor() {
             super(Phase.PRE_STREAM);
-            name = n;
         }
 
         public void handleMessage(Message message) throws Fault {
             AssertionInfoMap aim = message.get(AssertionInfoMap.class);
             // extract Assertion information
             if (aim != null) {
-                Collection<AssertionInfo> ais = aim.get(name);
+                Collection<AssertionInfo> ais = aim.get(SP12Constants.HTTPS_TOKEN);
                 if (ais == null) {
                     return;
                 }

Added: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/interceptors/WSSecurityInterceptorProvider.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/interceptors/WSSecurityInterceptorProvider.java?rev=688791&view=auto
==============================================================================
--- cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/interceptors/WSSecurityInterceptorProvider.java (added)
+++ cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/interceptors/WSSecurityInterceptorProvider.java Mon Aug 25 10:42:43 2008
@@ -0,0 +1,65 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.cxf.ws.security.policy.interceptors;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import javax.xml.namespace.QName;
+
+import org.apache.cxf.ws.policy.AbstractPolicyInterceptorProvider;
+import org.apache.cxf.ws.security.policy.SP11Constants;
+import org.apache.cxf.ws.security.policy.SP12Constants;
+import org.apache.cxf.ws.security.wss4j.PolicyBasedWSS4JOutInterceptor;
+import org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor;
+
+/**
+ * 
+ */
+public class WSSecurityInterceptorProvider extends AbstractPolicyInterceptorProvider {
+    private static final Collection<QName> ASSERTION_TYPES;
+    static {
+        ASSERTION_TYPES = new ArrayList<QName>();
+        ASSERTION_TYPES.add(SP11Constants.LAYOUT);
+        ASSERTION_TYPES.add(SP11Constants.INCLUDE_TIMESTAMP);
+        ASSERTION_TYPES.add(SP11Constants.ALGORITHM_SUITE);
+        ASSERTION_TYPES.add(SP11Constants.WSS10);
+        ASSERTION_TYPES.add(SP11Constants.WSS11);
+        ASSERTION_TYPES.add(SP11Constants.SIGNED_SUPPORTING_TOKENS);
+        ASSERTION_TYPES.add(SP11Constants.USERNAME_TOKEN);
+
+        ASSERTION_TYPES.add(SP12Constants.LAYOUT);
+        ASSERTION_TYPES.add(SP12Constants.INCLUDE_TIMESTAMP);
+        ASSERTION_TYPES.add(SP12Constants.ALGORITHM_SUITE);
+        ASSERTION_TYPES.add(SP12Constants.WSS10);
+        ASSERTION_TYPES.add(SP12Constants.WSS11);
+        ASSERTION_TYPES.add(SP12Constants.SIGNED_SUPPORTING_TOKENS);
+        ASSERTION_TYPES.add(SP12Constants.USERNAME_TOKEN);
+
+    }
+
+    public WSSecurityInterceptorProvider() {
+        super(ASSERTION_TYPES);
+        this.getOutInterceptors().add(new PolicyBasedWSS4JOutInterceptor());
+        this.getOutFaultInterceptors().add(new PolicyBasedWSS4JOutInterceptor());
+        this.getInInterceptors().add(new WSS4JInInterceptor());
+        this.getInFaultInterceptors().add(new WSS4JInInterceptor());
+    }
+}

Propchange: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/interceptors/WSSecurityInterceptorProvider.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/interceptors/WSSecurityInterceptorProvider.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/interceptors/WSSecurityPolicyInterceptorProvider.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/interceptors/WSSecurityPolicyInterceptorProvider.java?rev=688791&r1=688790&r2=688791&view=diff
==============================================================================
--- cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/interceptors/WSSecurityPolicyInterceptorProvider.java (original)
+++ cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/interceptors/WSSecurityPolicyInterceptorProvider.java Mon Aug 25 10:42:43 2008
@@ -26,6 +26,7 @@
 
 import org.apache.cxf.ws.policy.AbstractPolicyInterceptorProvider;
 import org.apache.cxf.ws.security.policy.SP11Constants;
+import org.apache.cxf.ws.security.policy.SP12Constants;
 
 /**
  * 
@@ -36,15 +37,8 @@
         ASSERTION_TYPES = new ArrayList<QName>();
         ASSERTION_TYPES.add(SP11Constants.TRANSPORT_BINDING);
         ASSERTION_TYPES.add(SP11Constants.TRANSPORT_TOKEN);
-        ASSERTION_TYPES.add(SP11Constants.LAYOUT);
-        ASSERTION_TYPES.add(SP11Constants.INCLUDE_TIMESTAMP);
-        ASSERTION_TYPES.add(SP11Constants.ALGORITHM_SUITE);
-        ASSERTION_TYPES.add(SP11Constants.WSS10);
-        ASSERTION_TYPES.add(SP11Constants.WSS11);
-        ASSERTION_TYPES.add(SP11Constants.SIGNED_SUPPORTING_TOKENS);
-        ASSERTION_TYPES.add(SP11Constants.USERNAME_TOKEN);
-        
-        
+        ASSERTION_TYPES.add(SP12Constants.TRANSPORT_BINDING);
+        ASSERTION_TYPES.add(SP12Constants.TRANSPORT_TOKEN);
     }
 
     public WSSecurityPolicyInterceptorProvider() {

Modified: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/AlgorithmSuite.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/AlgorithmSuite.java?rev=688791&r1=688790&r2=688791&view=diff
==============================================================================
--- cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/AlgorithmSuite.java (original)
+++ cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/AlgorithmSuite.java Mon Aug 25 10:42:43 2008
@@ -26,9 +26,9 @@
 
 import org.apache.cxf.common.i18n.Message;
 import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.ws.security.policy.SP12Constants;
 import org.apache.cxf.ws.security.policy.SPConstants;
 import org.apache.cxf.ws.security.policy.WSSPolicyException;
-import org.apache.neethi.PolicyComponent;
 
 public class AlgorithmSuite extends AbstractSecurityAssertion {
     private static final Logger LOG = LogUtils.getL7dLogger(AlgorithmSuite.class);
@@ -235,22 +235,21 @@
     }
 
     public QName getName() {
-        return constants.getAlgorithmSuite();
+        return SP12Constants.INSTANCE.getAlgorithmSuite();
     }
-
-    public PolicyComponent normalize() {
-        throw new UnsupportedOperationException("AlgorithmSuite.normalize() is not supported");
+    public QName getRealName() {
+        return constants.getAlgorithmSuite();
     }
 
     public void serialize(XMLStreamWriter writer) throws XMLStreamException {
 
-        String localName = getName().getLocalPart();
-        String namespaceURI = getName().getNamespaceURI();
+        String localName = getRealName().getLocalPart();
+        String namespaceURI = getRealName().getNamespaceURI();
 
         String prefix = writer.getPrefix(namespaceURI);
 
         if (prefix == null) {
-            prefix = getName().getPrefix();
+            prefix = getRealName().getPrefix();
             writer.setPrefix(prefix, namespaceURI);
         }
 

Modified: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/AsymmetricBinding.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/AsymmetricBinding.java?rev=688791&r1=688790&r2=688791&view=diff
==============================================================================
--- cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/AsymmetricBinding.java (original)
+++ cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/AsymmetricBinding.java Mon Aug 25 10:42:43 2008
@@ -23,6 +23,7 @@
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamWriter;
 
+import org.apache.cxf.ws.security.policy.SP12Constants;
 import org.apache.cxf.ws.security.policy.SPConstants;
 import org.apache.neethi.All;
 import org.apache.neethi.ExactlyOne;
@@ -67,10 +68,12 @@
         this.recipientToken = recipientToken;
     }
 
-    public QName getName() {
+    public QName getRealName() {
         return constants.getAsymmetricBinding();
     }
-
+    public QName getName() {
+        return SP12Constants.INSTANCE.getAsymmetricBinding();
+    }
     public PolicyComponent normalize() {
 
         if (isNormalized()) {
@@ -107,13 +110,13 @@
     }
 
     public void serialize(XMLStreamWriter writer) throws XMLStreamException {
-        String localname = getName().getLocalPart();
-        String namespaceURI = getName().getNamespaceURI();
+        String localname = getRealName().getLocalPart();
+        String namespaceURI = getRealName().getNamespaceURI();
 
         String prefix = writer.getPrefix(namespaceURI);
 
         if (prefix == null) {
-            prefix = getName().getPrefix();
+            prefix = getRealName().getPrefix();
             writer.setPrefix(prefix, namespaceURI);
         }
 

Modified: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/ContentEncryptedElements.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/ContentEncryptedElements.java?rev=688791&r1=688790&r2=688791&view=diff
==============================================================================
--- cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/ContentEncryptedElements.java (original)
+++ cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/ContentEncryptedElements.java Mon Aug 25 10:42:43 2008
@@ -79,14 +79,14 @@
 
     public void serialize(XMLStreamWriter writer) throws XMLStreamException {
 
-        String localName = getName().getLocalPart();
-        String namespaceURI = getName().getNamespaceURI();
+        String localName = getRealName().getLocalPart();
+        String namespaceURI = getRealName().getNamespaceURI();
 
         String prefix;
         String writerPrefix = writer.getPrefix(namespaceURI);
 
         if (writerPrefix == null) {
-            prefix = getName().getPrefix();
+            prefix = getRealName().getPrefix();
             writer.setPrefix(prefix, namespaceURI);
         } else {
             prefix = writerPrefix;
@@ -121,10 +121,12 @@
         writer.writeEndElement();
     }
 
+    public QName getRealName() {
+        return SP12Constants.CONTENT_ENCRYPTED_ELEMENTS;
+    }
     public QName getName() {
         return SP12Constants.CONTENT_ENCRYPTED_ELEMENTS;
     }
-
     public PolicyComponent normalize() {
         return this;
     }

Modified: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/EncryptionToken.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/EncryptionToken.java?rev=688791&r1=688790&r2=688791&view=diff
==============================================================================
--- cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/EncryptionToken.java (original)
+++ cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/EncryptionToken.java Mon Aug 25 10:42:43 2008
@@ -22,6 +22,7 @@
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamWriter;
 
+import org.apache.cxf.ws.security.policy.SP12Constants;
 import org.apache.cxf.ws.security.policy.SPConstants;
 
 public class EncryptionToken extends AbstractSecurityAssertion implements TokenWrapper {
@@ -50,19 +51,22 @@
         this.setEncryptionToken(tok);
     }
 
-    public QName getName() {
+    public QName getRealName() {
         return constants.getEncryptionToken();
     }
+    public QName getName() {
+        return SP12Constants.INSTANCE.getEncryptionToken();
+    }
 
     public void serialize(XMLStreamWriter writer) throws XMLStreamException {
-        String localname = getName().getLocalPart();
-        String namespaceURI = getName().getNamespaceURI();
+        String localname = getRealName().getLocalPart();
+        String namespaceURI = getRealName().getNamespaceURI();
         String prefix;
 
         String writerPrefix = writer.getPrefix(namespaceURI);
 
         if (writerPrefix == null) {
-            prefix = getName().getPrefix();
+            prefix = getRealName().getPrefix();
             writer.setPrefix(prefix, namespaceURI);
         } else {
             prefix = writerPrefix;

Modified: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/HttpsToken.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/HttpsToken.java?rev=688791&r1=688790&r2=688791&view=diff
==============================================================================
--- cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/HttpsToken.java (original)
+++ cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/HttpsToken.java Mon Aug 25 10:42:43 2008
@@ -22,6 +22,7 @@
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamWriter;
 
+import org.apache.cxf.ws.security.policy.SP12Constants;
 import org.apache.cxf.ws.security.policy.SPConstants;
 
 /**
@@ -73,18 +74,21 @@
         this.httpDigestAuthentication = httpDigestAuthentication;
     }
 
-    public QName getName() {
+    public QName getRealName() {
         return constants.getHttpsToken();
     }
+    public QName getName() {
+        return SP12Constants.INSTANCE.getHttpsToken();
+    }
 
     public void serialize(XMLStreamWriter writer) throws XMLStreamException {
 
-        String localname = getName().getLocalPart();
-        String namespaceURI = getName().getNamespaceURI();
+        String localname = getRealName().getLocalPart();
+        String namespaceURI = getRealName().getNamespaceURI();
 
         String prefix = writer.getPrefix(namespaceURI);
         if (prefix == null) {
-            prefix = getName().getPrefix();
+            prefix = getRealName().getPrefix();
             writer.setPrefix(prefix, namespaceURI);
         }
 

Modified: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/InitiatorToken.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/InitiatorToken.java?rev=688791&r1=688790&r2=688791&view=diff
==============================================================================
--- cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/InitiatorToken.java (original)
+++ cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/InitiatorToken.java Mon Aug 25 10:42:43 2008
@@ -22,8 +22,8 @@
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamWriter;
 
+import org.apache.cxf.ws.security.policy.SP12Constants;
 import org.apache.cxf.ws.security.policy.SPConstants;
-import org.apache.neethi.PolicyComponent;
 
 public class InitiatorToken extends AbstractSecurityAssertion implements TokenWrapper {
 
@@ -51,22 +51,21 @@
         this.setInitiatorToken(tok);
     }
 
-    public QName getName() {
+    public QName getRealName() {
         return constants.getInitiatorToken();
     }
-
-    public PolicyComponent normalize() {
-        throw new UnsupportedOperationException();
+    public QName getName() {
+        return SP12Constants.INSTANCE.getInitiatorToken();
     }
 
     public void serialize(XMLStreamWriter writer) throws XMLStreamException {
-        String localName = getName().getLocalPart();
-        String namespaceURI = getName().getNamespaceURI();
+        String localName = getRealName().getLocalPart();
+        String namespaceURI = getRealName().getNamespaceURI();
 
         String prefix = writer.getPrefix(namespaceURI);
 
         if (prefix == null) {
-            prefix = getName().getPrefix();
+            prefix = getRealName().getPrefix();
             writer.setPrefix(prefix, namespaceURI);
         }
 

Modified: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/IssuedToken.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/IssuedToken.java?rev=688791&r1=688790&r2=688791&view=diff
==============================================================================
--- cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/IssuedToken.java (original)
+++ cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/IssuedToken.java Mon Aug 25 10:42:43 2008
@@ -25,6 +25,7 @@
 import org.w3c.dom.Element;
 
 import org.apache.cxf.staxutils.StaxUtils;
+import org.apache.cxf.ws.security.policy.SP12Constants;
 import org.apache.cxf.ws.security.policy.SPConstants;
 
 /**
@@ -102,19 +103,22 @@
         this.rstTemplate = rstTemplate;
     }
 
-    public QName getName() {
+    public QName getRealName() {
         return constants.getIssuedToken();
     }
+    public QName getName() {
+        return SP12Constants.INSTANCE.getIssuedToken();
+    }
 
     public void serialize(XMLStreamWriter writer) throws XMLStreamException {
-        String localname = getName().getLocalPart();
-        String namespaceURI = getName().getNamespaceURI();
+        String localname = getRealName().getLocalPart();
+        String namespaceURI = getRealName().getNamespaceURI();
 
         String prefix;
         String writerPrefix = writer.getPrefix(namespaceURI);
 
         if (writerPrefix == null) {
-            prefix = getName().getPrefix();
+            prefix = getRealName().getPrefix();
             writer.setPrefix(prefix, namespaceURI);
 
         } else {

Modified: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/Layout.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/Layout.java?rev=688791&r1=688790&r2=688791&view=diff
==============================================================================
--- cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/Layout.java (original)
+++ cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/Layout.java Mon Aug 25 10:42:43 2008
@@ -22,8 +22,8 @@
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamWriter;
 
+import org.apache.cxf.ws.security.policy.SP12Constants;
 import org.apache.cxf.ws.security.policy.SPConstants;
-import org.apache.neethi.PolicyComponent;
 
 public class Layout extends AbstractSecurityAssertion {
 
@@ -54,23 +54,22 @@
         }
     }
 
-    public QName getName() {
+    public QName getRealName() {
         return constants.getLayout();
     }
-
-    public PolicyComponent normalize() {
-        throw new UnsupportedOperationException();
+    public QName getName() {
+        return SP12Constants.INSTANCE.getLayout();
     }
 
     public void serialize(XMLStreamWriter writer) throws XMLStreamException {
 
-        String localName = getName().getLocalPart();
-        String namespaceURI = getName().getNamespaceURI();
+        String localName = getRealName().getLocalPart();
+        String namespaceURI = getRealName().getNamespaceURI();
 
         String prefix = writer.getPrefix(namespaceURI);
 
         if (prefix == null) {
-            prefix = getName().getPrefix();
+            prefix = getRealName().getPrefix();
             writer.setPrefix(prefix, namespaceURI);
         }
 

Modified: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/ProtectionToken.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/ProtectionToken.java?rev=688791&r1=688790&r2=688791&view=diff
==============================================================================
--- cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/ProtectionToken.java (original)
+++ cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/ProtectionToken.java Mon Aug 25 10:42:43 2008
@@ -22,6 +22,7 @@
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamWriter;
 
+import org.apache.cxf.ws.security.policy.SP12Constants;
 import org.apache.cxf.ws.security.policy.SPConstants;
 import org.apache.neethi.PolicyComponent;
 
@@ -51,9 +52,12 @@
         this.setProtectionToken(tok);
     }
 
-    public QName getName() {
+    public QName getRealName() {
         return constants.getProtectionToken();
     }
+    public QName getName() {
+        return SP12Constants.INSTANCE.getProtectionToken();
+    }
 
     public PolicyComponent normalize() {
         /*
@@ -64,14 +68,14 @@
     }
 
     public void serialize(XMLStreamWriter writer) throws XMLStreamException {
-        String localname = getName().getLocalPart();
-        String namespaceURI = getName().getNamespaceURI();
+        String localname = getRealName().getLocalPart();
+        String namespaceURI = getRealName().getNamespaceURI();
 
         String prefix;
 
         String writerPrefix = writer.getPrefix(namespaceURI);
         if (writerPrefix == null) {
-            prefix = getName().getPrefix();
+            prefix = getRealName().getPrefix();
             writer.setPrefix(prefix, namespaceURI);
 
         } else {

Modified: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/RecipientToken.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/RecipientToken.java?rev=688791&r1=688790&r2=688791&view=diff
==============================================================================
--- cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/RecipientToken.java (original)
+++ cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/RecipientToken.java Mon Aug 25 10:42:43 2008
@@ -22,8 +22,8 @@
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamWriter;
 
+import org.apache.cxf.ws.security.policy.SP12Constants;
 import org.apache.cxf.ws.security.policy.SPConstants;
-import org.apache.neethi.PolicyComponent;
 
 public class RecipientToken extends AbstractSecurityAssertion implements TokenWrapper {
 
@@ -55,22 +55,20 @@
         this.setReceipientToken(tok);
     }
 
-    public QName getName() {
+    public QName getRealName() {
         return constants.getRecipientToken();
     }
-
-    public PolicyComponent normalize() {
-        throw new UnsupportedOperationException();
+    public QName getName() {
+        return SP12Constants.INSTANCE.getRecipientToken();
     }
-
     public void serialize(XMLStreamWriter writer) throws XMLStreamException {
-        String localName = getName().getLocalPart();
-        String namespaceURI = getName().getNamespaceURI();
+        String localName = getRealName().getLocalPart();
+        String namespaceURI = getRealName().getNamespaceURI();
 
         String prefix = writer.getPrefix(namespaceURI);
 
         if (prefix == null) {
-            prefix = getName().getPrefix();
+            prefix = getRealName().getPrefix();
             writer.setPrefix(prefix, namespaceURI);
         }
 

Modified: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/RequiredElements.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/RequiredElements.java?rev=688791&r1=688790&r2=688791&view=diff
==============================================================================
--- cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/RequiredElements.java (original)
+++ cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/RequiredElements.java Mon Aug 25 10:42:43 2008
@@ -28,6 +28,7 @@
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamWriter;
 
+import org.apache.cxf.ws.security.policy.SP12Constants;
 import org.apache.cxf.ws.security.policy.SPConstants;
 import org.apache.neethi.PolicyComponent;
 
@@ -78,14 +79,14 @@
 
     public void serialize(XMLStreamWriter writer) throws XMLStreamException {
 
-        String localName = getName().getLocalPart();
-        String namespaceURI = getName().getNamespaceURI();
+        String localName = getRealName().getLocalPart();
+        String namespaceURI = getRealName().getNamespaceURI();
 
         String prefix;
         String writerPrefix = writer.getPrefix(namespaceURI);
 
         if (writerPrefix == null) {
-            prefix = getName().getPrefix();
+            prefix = getRealName().getPrefix();
             writer.setPrefix(prefix, namespaceURI);
         } else {
             prefix = writerPrefix;
@@ -120,9 +121,12 @@
         writer.writeEndElement();
     }
 
-    public QName getName() {
+    public QName getRealName() {
         return constants.getRequiredElements();
     }
+    public QName getName() {
+        return SP12Constants.INSTANCE.getRequiredElements();
+    }
 
     public PolicyComponent normalize() {
         return this;

Modified: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/RequiredParts.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/RequiredParts.java?rev=688791&r1=688790&r2=688791&view=diff
==============================================================================
--- cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/RequiredParts.java (original)
+++ cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/RequiredParts.java Mon Aug 25 10:42:43 2008
@@ -52,6 +52,9 @@
         this.headers.add(header);
     }
 
+    public QName getRealName() {
+        return SP12Constants.REQUIRED_PARTS;
+    }
     public QName getName() {
         return SP12Constants.REQUIRED_PARTS;
     }
@@ -61,13 +64,13 @@
     }
 
     public void serialize(XMLStreamWriter writer) throws XMLStreamException {
-        String localName = getName().getLocalPart();
-        String namespaceURI = getName().getNamespaceURI();
+        String localName = getRealName().getLocalPart();
+        String namespaceURI = getRealName().getNamespaceURI();
 
         String prefix = writer.getPrefix(namespaceURI);
 
         if (prefix == null) {
-            prefix = getName().getPrefix();
+            prefix = getRealName().getPrefix();
             writer.setPrefix(prefix, namespaceURI);
         }
 

Modified: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/SecureConversationToken.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/SecureConversationToken.java?rev=688791&r1=688790&r2=688791&view=diff
==============================================================================
--- cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/SecureConversationToken.java (original)
+++ cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/SecureConversationToken.java Mon Aug 25 10:42:43 2008
@@ -25,6 +25,7 @@
 import org.w3c.dom.Element;
 
 import org.apache.cxf.staxutils.StaxUtils;
+import org.apache.cxf.ws.security.policy.SP12Constants;
 import org.apache.cxf.ws.security.policy.SPConstants;
 import org.apache.neethi.Policy;
 
@@ -57,22 +58,25 @@
 
     /*
      * (non-Javadoc)
-     * @see org.apache.neethi.Assertion#getName()
+     * @see org.apache.neethi.Assertion#getRealName()
      */
-    public QName getName() {
+    public QName getRealName() {
         return constants.getSecureConversationToken();
     }
+    public QName getName() {
+        return SP12Constants.INSTANCE.getSecureConversationToken();
+    }
 
     public void serialize(XMLStreamWriter writer) throws XMLStreamException {
 
-        String localname = getName().getLocalPart();
-        String namespaceURI = getName().getNamespaceURI();
+        String localname = getRealName().getLocalPart();
+        String namespaceURI = getRealName().getNamespaceURI();
         String prefix;
 
         String writerPrefix = writer.getPrefix(namespaceURI);
 
         if (writerPrefix == null) {
-            prefix = getName().getPrefix();
+            prefix = getRealName().getPrefix();
             writer.setPrefix(prefix, namespaceURI);
         } else {
             prefix = writerPrefix;

Modified: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/SecurityContextToken.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/SecurityContextToken.java?rev=688791&r1=688790&r2=688791&view=diff
==============================================================================
--- cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/SecurityContextToken.java (original)
+++ cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/SecurityContextToken.java Mon Aug 25 10:42:43 2008
@@ -22,8 +22,8 @@
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamWriter;
 
+import org.apache.cxf.ws.security.policy.SP12Constants;
 import org.apache.cxf.ws.security.policy.SPConstants;
-import org.apache.neethi.PolicyComponent;
 
 /**
  * Model class of SecurityContextToken assertion
@@ -68,21 +68,16 @@
 
     /*
      * (non-Javadoc)
-     * @see org.apache.neethi.Assertion#getName()
+     * @see org.apache.neethi.Assertion#getRealName()
      */
-    public QName getName() {
+    public QName getRealName() {
         return constants.getSecurityContextToken();
     }
-
-    /*
-     * (non-Javadoc)
-     * @see org.apache.neethi.Assertion#normalize()
-     */
-    public PolicyComponent normalize() {
-        // TODO TODO Sanka
-        throw new UnsupportedOperationException("TODO Sanka");
+    public QName getName() {
+        return SP12Constants.INSTANCE.getSecurityContextToken();
     }
 
+
     /*
      * (non-Javadoc)
      * @see org.apache.neethi.PolicyComponent#serialize(javax.xml.stream.XMLStreamWriter)

Modified: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/SignatureToken.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/SignatureToken.java?rev=688791&r1=688790&r2=688791&view=diff
==============================================================================
--- cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/SignatureToken.java (original)
+++ cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/SignatureToken.java Mon Aug 25 10:42:43 2008
@@ -22,6 +22,7 @@
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamWriter;
 
+import org.apache.cxf.ws.security.policy.SP12Constants;
 import org.apache.cxf.ws.security.policy.SPConstants;
 
 public class SignatureToken extends AbstractSecurityAssertion implements TokenWrapper {
@@ -50,20 +51,23 @@
         this.setSignatureToken(tok);
     }
 
-    public QName getName() {
+    public QName getRealName() {
         return constants.getSignatureToken();
     }
+    public QName getName() {
+        return SP12Constants.INSTANCE.getSignatureToken();
+    }
 
     public void serialize(XMLStreamWriter writer) throws XMLStreamException {
 
-        String localname = getName().getLocalPart();
-        String namespaceURI = getName().getNamespaceURI();
+        String localname = getRealName().getLocalPart();
+        String namespaceURI = getRealName().getNamespaceURI();
 
         String prefix;
         String writerPrefix = writer.getPrefix(namespaceURI);
 
         if (writerPrefix == null) {
-            prefix = getName().getPrefix();
+            prefix = getRealName().getPrefix();
             writer.setPrefix(prefix, namespaceURI);
 
         } else {

Modified: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/SignedEncryptedElements.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/SignedEncryptedElements.java?rev=688791&r1=688790&r2=688791&view=diff
==============================================================================
--- cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/SignedEncryptedElements.java (original)
+++ cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/SignedEncryptedElements.java Mon Aug 25 10:42:43 2008
@@ -28,6 +28,7 @@
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamWriter;
 
+import org.apache.cxf.ws.security.policy.SP12Constants;
 import org.apache.cxf.ws.security.policy.SPConstants;
 import org.apache.neethi.PolicyComponent;
 
@@ -91,13 +92,13 @@
 
     public void serialize(XMLStreamWriter writer) throws XMLStreamException {
 
-        String localName = getName().getLocalPart();
-        String namespaceURI = getName().getNamespaceURI();
+        String localName = getRealName().getLocalPart();
+        String namespaceURI = getRealName().getNamespaceURI();
 
         String prefix = writer.getPrefix(namespaceURI);
 
         if (prefix == null) {
-            prefix = getName().getPrefix();
+            prefix = getRealName().getPrefix();
             writer.setPrefix(prefix, namespaceURI);
         }
 
@@ -125,12 +126,18 @@
         writer.writeEndElement();
     }
 
-    public QName getName() {
+    public QName getRealName() {
         if (signedElemets) {
             return constants.getSignedElements();
         }
         return constants.getEncryptedElements();
     }
+    public QName getName() {
+        if (signedElemets) {
+            return SP12Constants.INSTANCE.getSignedElements();
+        }
+        return SP12Constants.INSTANCE.getEncryptedElements();
+    }
 
     public PolicyComponent normalize() {
         return this;

Modified: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/SignedEncryptedParts.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/SignedEncryptedParts.java?rev=688791&r1=688790&r2=688791&view=diff
==============================================================================
--- cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/SignedEncryptedParts.java (original)
+++ cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/SignedEncryptedParts.java Mon Aug 25 10:42:43 2008
@@ -26,6 +26,7 @@
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamWriter;
 
+import org.apache.cxf.ws.security.policy.SP12Constants;
 import org.apache.cxf.ws.security.policy.SPConstants;
 import org.apache.neethi.PolicyComponent;
 
@@ -93,25 +94,31 @@
         return signedParts;
     }
 
-    public QName getName() {
+    public QName getRealName() {
         if (signedParts) {
             return constants.getSignedParts();
         }
         return constants.getEncryptedParts();
     }
-
+    public QName getName() {
+        if (signedParts) {
+            return SP12Constants.INSTANCE.getSignedParts();
+        }
+        return SP12Constants.INSTANCE.getEncryptedParts();
+    }
+    
     public PolicyComponent normalize() {
         return this;
     }
 
     public void serialize(XMLStreamWriter writer) throws XMLStreamException {
-        String localName = getName().getLocalPart();
-        String namespaceURI = getName().getNamespaceURI();
+        String localName = getRealName().getLocalPart();
+        String namespaceURI = getRealName().getNamespaceURI();
 
         String prefix = writer.getPrefix(namespaceURI);
 
         if (prefix == null) {
-            prefix = getName().getPrefix();
+            prefix = getRealName().getPrefix();
             writer.setPrefix(prefix, namespaceURI);
         }
 

Modified: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/SupportingToken.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/SupportingToken.java?rev=688791&r1=688790&r2=688791&view=diff
==============================================================================
--- cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/SupportingToken.java (original)
+++ cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/SupportingToken.java Mon Aug 25 10:42:43 2008
@@ -166,7 +166,7 @@
         this.addToken(tok);
     }
 
-    public QName getName() {
+    public QName getRealName() {
         QName ret = null;
         
         switch (type) {
@@ -200,6 +200,39 @@
         }
         return ret;
     }
+    public QName getName() {
+        QName ret = null;
+        switch (type) {
+        case SUPPORTING_TOKEN_SUPPORTING:
+            ret = SP12Constants.INSTANCE.getSupportingTokens();
+            break;
+        case SUPPORTING_TOKEN_SIGNED:
+            ret = SP12Constants.INSTANCE.getSignedSupportingTokens();
+            break;
+        case SUPPORTING_TOKEN_ENDORSING:
+            ret = SP12Constants.INSTANCE.getEndorsingSupportingTokens();
+            break;
+        case SUPPORTING_TOKEN_SIGNED_ENDORSING:
+            ret = SP12Constants.INSTANCE.getSignedEndorsingSupportingTokens();
+            break;
+        case SUPPORTING_TOKEN_ENCRYPTED:
+            ret = SP12Constants.ENCRYPTED_SUPPORTING_TOKENS;
+            break;
+        case SUPPORTING_TOKEN_SIGNED_ENCRYPTED:
+            ret = SP12Constants.SIGNED_ENCRYPTED_SUPPORTING_TOKENS;
+            break;
+        case SUPPORTING_TOKEN_ENDORSING_ENCRYPTED:
+            ret = SP12Constants.ENDORSING_ENCRYPTED_SUPPORTING_TOKENS;
+            break;
+        case SUPPORTING_TOKEN_SIGNED_ENDORSING_ENCRYPTED:
+            ret = SP12Constants.SIGNED_ENDORSING_ENCRYPTED_SUPPORTING_TOKENS;
+            break;
+        default:
+            ret = null;
+            break;
+        }
+        return ret;
+    }
 
     /**
      * @return true if the supporting token should be encrypted
@@ -221,15 +254,15 @@
     }
 
     public void serialize(XMLStreamWriter writer) throws XMLStreamException {
-        String namespaceURI = getName().getNamespaceURI();
+        String namespaceURI = getRealName().getNamespaceURI();
 
         String prefix = writer.getPrefix(namespaceURI);
         if (prefix == null) {
-            prefix = getName().getPrefix();
+            prefix = getRealName().getPrefix();
             writer.setPrefix(prefix, namespaceURI);
         }
 
-        String localname = getName().getLocalPart();
+        String localname = getRealName().getLocalPart();
 
         // <sp:SupportingToken>
         writer.writeStartElement(prefix, localname, namespaceURI);

Modified: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/SymmetricBinding.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/SymmetricBinding.java?rev=688791&r1=688790&r2=688791&view=diff
==============================================================================
--- cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/SymmetricBinding.java (original)
+++ cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/SymmetricBinding.java Mon Aug 25 10:42:43 2008
@@ -22,6 +22,7 @@
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamWriter;
 
+import org.apache.cxf.ws.security.policy.SP12Constants;
 import org.apache.cxf.ws.security.policy.SPConstants;
 import org.apache.neethi.All;
 import org.apache.neethi.ExactlyOne;
@@ -95,10 +96,12 @@
         this.signatureToken = signatureToken;
     }
 
-    public QName getName() {
+    public QName getRealName() {
         return constants.getSymmetricBinding();
     }
-
+    public QName getName() {
+        return SP12Constants.INSTANCE.getSymmetricBinding();
+    }
     public PolicyComponent normalize() {
         if (isNormalized()) {
             return this;
@@ -136,14 +139,14 @@
 
     public void serialize(XMLStreamWriter writer) throws XMLStreamException {
 
-        String localname = getName().getLocalPart();
-        String namespaceURI = getName().getNamespaceURI();
+        String localname = getRealName().getLocalPart();
+        String namespaceURI = getRealName().getNamespaceURI();
 
         String prefix;
         String writerPrefix = writer.getPrefix(namespaceURI);
 
         if (writerPrefix == null) {
-            prefix = getName().getPrefix();
+            prefix = getRealName().getPrefix();
             writer.setPrefix(prefix, namespaceURI);
         } else {
             prefix = writerPrefix;

Modified: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/TransportBinding.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/TransportBinding.java?rev=688791&r1=688790&r2=688791&view=diff
==============================================================================
--- cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/TransportBinding.java (original)
+++ cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/TransportBinding.java Mon Aug 25 10:42:43 2008
@@ -22,6 +22,8 @@
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamWriter;
 
+import org.apache.cxf.ws.policy.builder.primitive.PrimitiveAssertion;
+import org.apache.cxf.ws.security.policy.SP12Constants;
 import org.apache.cxf.ws.security.policy.SPConstants;
 import org.apache.neethi.All;
 import org.apache.neethi.ExactlyOne;
@@ -50,19 +52,22 @@
         this.transportToken = transportToken;
     }
 
-    public QName getName() {
+    public QName getRealName() {
         return constants.getTransportBinding();
     }
+    public QName getName() {
+        return SP12Constants.INSTANCE.getTransportBinding();
+    }
 
 
     public void serialize(XMLStreamWriter writer) throws XMLStreamException {
-        String localName = getName().getLocalPart();
-        String namespaceURI = getName().getNamespaceURI();
+        String localName = getRealName().getLocalPart();
+        String namespaceURI = getRealName().getNamespaceURI();
 
         String prefix = writer.getPrefix(namespaceURI);
 
         if (prefix == null) {
-            prefix = getName().getPrefix();
+            prefix = getRealName().getPrefix();
             writer.setPrefix(prefix, namespaceURI);
         }
 
@@ -125,7 +130,16 @@
         p.addPolicyComponent(ea);
         All all = new All();
         ea.addPolicyComponent(all);
-        all.addPolicyComponent(transportToken);
+        if (transportToken != null) {
+            all.addPolicyComponent(transportToken);
+        }
+        if (isIncludeTimestamp()) {
+            all.addPolicyComponent(new PrimitiveAssertion(SP12Constants.INCLUDE_TIMESTAMP));
+        }
+        if (getLayout() != null) {
+            all.addPolicyComponent(getLayout());
+        }
+        
         return p.normalize(true);
     }
 }

Modified: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/TransportToken.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/TransportToken.java?rev=688791&r1=688790&r2=688791&view=diff
==============================================================================
--- cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/TransportToken.java (original)
+++ cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/TransportToken.java Mon Aug 25 10:42:43 2008
@@ -22,6 +22,7 @@
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamWriter;
 
+import org.apache.cxf.ws.security.policy.SP12Constants;
 import org.apache.cxf.ws.security.policy.SPConstants;
 import org.apache.neethi.PolicyComponent;
 
@@ -40,9 +41,12 @@
         return transportToken;
     }
 
-    public QName getName() {
+    public QName getRealName() {
         return constants.getTransportToken();
     }
+    public QName getName() {
+        return SP12Constants.INSTANCE.getTransportToken();
+    }
 
     public boolean isOptional() {
         return false;
@@ -58,13 +62,13 @@
 
     public void serialize(XMLStreamWriter writer) throws XMLStreamException {
 
-        String localName = getName().getLocalPart();
-        String namespaceURI = getName().getNamespaceURI();
+        String localName = getRealName().getLocalPart();
+        String namespaceURI = getRealName().getNamespaceURI();
 
         String prefix = writer.getPrefix(namespaceURI);
 
         if (prefix == null) {
-            prefix = getName().getPrefix();
+            prefix = getRealName().getPrefix();
             writer.setPrefix(prefix, namespaceURI);
         }
 

Modified: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/Trust10.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/Trust10.java?rev=688791&r1=688790&r2=688791&view=diff
==============================================================================
--- cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/Trust10.java (original)
+++ cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/Trust10.java Mon Aug 25 10:42:43 2008
@@ -24,7 +24,6 @@
 
 import org.apache.cxf.ws.security.policy.SP11Constants;
 import org.apache.cxf.ws.security.policy.SPConstants;
-import org.apache.neethi.PolicyComponent;
 
 /**
  * Model bean to capture Trust10 assertion info
@@ -111,35 +110,21 @@
         this.requireServerEntropy = requireServerEntropy;
     }
 
-    /*
-     * (non-Javadoc)
-     * @see org.apache.neethi.Assertion#getName()
-     */
-    public QName getName() {
+    public QName getRealName() {
         return SP11Constants.TRUST_10;
     }
-
-    /*
-     * (non-Javadoc)
-     * @see org.apache.neethi.Assertion#isOptional()
-     */
-    public boolean isOptional() {
-        // TODO TODO Sanka
-        throw new UnsupportedOperationException("TODO Sanka");
-    }
-
-    public PolicyComponent normalize() {
-        return this;
+    public QName getName() {
+        return SP11Constants.TRUST_10;
     }
 
     public void serialize(XMLStreamWriter writer) throws XMLStreamException {
 
-        String localname = getName().getLocalPart();
-        String namespaceURI = getName().getNamespaceURI();
+        String localname = getRealName().getLocalPart();
+        String namespaceURI = getRealName().getNamespaceURI();
 
         String prefix = writer.getPrefix(namespaceURI);
         if (prefix == null) {
-            prefix = getName().getPrefix();
+            prefix = getRealName().getPrefix();
             writer.setPrefix(prefix, namespaceURI);
         }
 

Modified: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/Trust13.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/Trust13.java?rev=688791&r1=688790&r2=688791&view=diff
==============================================================================
--- cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/Trust13.java (original)
+++ cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/Trust13.java Mon Aug 25 10:42:43 2008
@@ -24,7 +24,6 @@
 
 import org.apache.cxf.ws.security.policy.SP12Constants;
 import org.apache.cxf.ws.security.policy.SPConstants;
-import org.apache.neethi.PolicyComponent;
 
 /**
  * Model bean to capture Trust10 assertion info
@@ -141,35 +140,22 @@
         this.requireAppliesTo = requireAppliesTo;
     }
 
-    /*
-     * (non-Javadoc)
-     * @see org.apache.neethi.Assertion#getName()
-     */
-    public QName getName() {
+    public QName getRealName() {
         return SP12Constants.TRUST_13;
     }
-
-    /*
-     * (non-Javadoc)
-     * @see org.apache.neethi.Assertion#isOptional()
-     */
-    public boolean isOptional() {
-        // TODO TODO Sanka
-        throw new UnsupportedOperationException("TODO Sanka");
+    public QName getName() {
+        return SP12Constants.TRUST_13;
     }
 
-    public PolicyComponent normalize() {
-        return this;
-    }
 
     public void serialize(XMLStreamWriter writer) throws XMLStreamException {
 
-        String localname = getName().getLocalPart();
-        String namespaceURI = getName().getNamespaceURI();
+        String localname = getRealName().getLocalPart();
+        String namespaceURI = getRealName().getNamespaceURI();
 
         String prefix = writer.getPrefix(namespaceURI);
         if (prefix == null) {
-            prefix = getName().getPrefix();
+            prefix = getRealName().getPrefix();
             writer.setPrefix(prefix, namespaceURI);
         }
 

Modified: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/UsernameToken.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/UsernameToken.java?rev=688791&r1=688790&r2=688791&view=diff
==============================================================================
--- cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/UsernameToken.java (original)
+++ cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/UsernameToken.java Mon Aug 25 10:42:43 2008
@@ -22,17 +22,13 @@
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamWriter;
 
+import org.apache.cxf.ws.security.policy.SP12Constants;
 import org.apache.cxf.ws.security.policy.SPConstants;
-import org.apache.neethi.PolicyComponent;
 
 public class UsernameToken extends Token {
-
     private boolean useUTProfile10;
-
     private boolean useUTProfile11;
-
     private boolean noPassword;
-
     private boolean hashPassword;
 
     public UsernameToken(SPConstants version) {
@@ -78,20 +74,17 @@
     }
 
     public QName getName() {
-        return constants.getUserNameToken();
-    }
-
-    public PolicyComponent normalize() {
-        throw new UnsupportedOperationException();
+        return SP12Constants.INSTANCE.getUserNameToken();
     }
 
     public void serialize(XMLStreamWriter writer) throws XMLStreamException {
-        String localname = getName().getLocalPart();
-        String namespaceURI = getName().getNamespaceURI();
+        QName name = constants.getUserNameToken();
+        String localname = name.getLocalPart();
+        String namespaceURI = name.getNamespaceURI();
 
         String prefix = writer.getPrefix(namespaceURI);
         if (prefix == null) {
-            prefix = getName().getPrefix();
+            prefix = name.getPrefix();
             writer.setPrefix(prefix, namespaceURI);
         }
 

Modified: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/Wss10.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/Wss10.java?rev=688791&r1=688790&r2=688791&view=diff
==============================================================================
--- cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/Wss10.java (original)
+++ cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/Wss10.java Mon Aug 25 10:42:43 2008
@@ -22,8 +22,8 @@
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamWriter;
 
+import org.apache.cxf.ws.security.policy.SP12Constants;
 import org.apache.cxf.ws.security.policy.SPConstants;
-import org.apache.neethi.PolicyComponent;
 
 public class Wss10 extends AbstractSecurityAssertion {
 
@@ -92,21 +92,21 @@
         this.mustSupportRefKeyIdentifier = mustSupportRefKeyIdentifier;
     }
 
-    public QName getName() {
+    public QName getRealName() {
         return constants.getWSS10();
     }
-
-    public PolicyComponent normalize() {
-        return this;
+    public QName getName() {
+        return SP12Constants.INSTANCE.getWSS10();
     }
 
+
     public void serialize(XMLStreamWriter writer) throws XMLStreamException {
-        String localname = getName().getLocalPart();
-        String namespaceURI = getName().getNamespaceURI();
+        String localname = getRealName().getLocalPart();
+        String namespaceURI = getRealName().getNamespaceURI();
 
         String prefix = writer.getPrefix(namespaceURI);
         if (prefix == null) {
-            prefix = getName().getPrefix();
+            prefix = getRealName().getPrefix();
             writer.setPrefix(prefix, namespaceURI);
         }
 

Modified: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/Wss11.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/Wss11.java?rev=688791&r1=688790&r2=688791&view=diff
==============================================================================
--- cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/Wss11.java (original)
+++ cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/Wss11.java Mon Aug 25 10:42:43 2008
@@ -22,6 +22,7 @@
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamWriter;
 
+import org.apache.cxf.ws.security.policy.SP12Constants;
 import org.apache.cxf.ws.security.policy.SPConstants;
 
 public class Wss11 extends Wss10 {
@@ -76,17 +77,20 @@
         this.requireSignatureConfirmation = requireSignatureConfirmation;
     }
 
-    public QName getName() {
+    public QName getRealName() {
         return constants.getWSS11();
     }
+    public QName getName() {
+        return SP12Constants.INSTANCE.getWSS11();
+    }
 
     public void serialize(XMLStreamWriter writer) throws XMLStreamException {
-        String localname = getName().getLocalPart();
-        String namespaceURI = getName().getNamespaceURI();
+        String localname = getRealName().getLocalPart();
+        String namespaceURI = getRealName().getNamespaceURI();
 
         String prefix = writer.getPrefix(namespaceURI);
         if (prefix == null) {
-            prefix = getName().getPrefix();
+            prefix = getRealName().getPrefix();
             writer.setPrefix(prefix, namespaceURI);
         }
 

Modified: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/X509Token.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/X509Token.java?rev=688791&r1=688790&r2=688791&view=diff
==============================================================================
--- cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/X509Token.java (original)
+++ cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/X509Token.java Mon Aug 25 10:42:43 2008
@@ -22,8 +22,8 @@
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamWriter;
 
+import org.apache.cxf.ws.security.policy.SP12Constants;
 import org.apache.cxf.ws.security.policy.SPConstants;
-import org.apache.neethi.PolicyComponent;
 
 public class X509Token extends Token {
     
@@ -112,22 +112,21 @@
         this.tokenVersionAndType = tokenVersionAndType;
     }
 
-    public QName getName() {
+    public QName getRealName() {
         return constants.getX509Token();
     }
-
-    public PolicyComponent normalize() {
-        throw new UnsupportedOperationException();
+    public QName getName() {
+        return SP12Constants.INSTANCE.getX509Token();
     }
 
     public void serialize(XMLStreamWriter writer) throws XMLStreamException {
-        String localName = getName().getLocalPart();
-        String namespaceURI = getName().getNamespaceURI();
+        String localName = getRealName().getLocalPart();
+        String namespaceURI = getRealName().getNamespaceURI();
 
         String prefix = writer.getPrefix(namespaceURI);
 
         if (prefix == null) {
-            prefix = getName().getPrefix();
+            prefix = getRealName().getPrefix();
             writer.setPrefix(prefix, namespaceURI);
         }
 

Modified: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/AbstractWSS4JInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/AbstractWSS4JInterceptor.java?rev=688791&r1=688790&r2=688791&view=diff
==============================================================================
--- cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/AbstractWSS4JInterceptor.java (original)
+++ cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/AbstractWSS4JInterceptor.java Mon Aug 25 10:42:43 2008
@@ -19,6 +19,7 @@
 package org.apache.cxf.ws.security.wss4j;
 
 import java.net.URI;
+import java.util.Collection;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Map;
@@ -31,8 +32,15 @@
 import org.apache.cxf.interceptor.Fault;
 import org.apache.cxf.message.Message;
 import org.apache.cxf.phase.PhaseInterceptor;
+import org.apache.cxf.ws.policy.AssertionInfo;
+import org.apache.cxf.ws.policy.AssertionInfoMap;
+import org.apache.cxf.ws.security.policy.SP12Constants;
+import org.apache.cxf.ws.security.policy.SPConstants;
+import org.apache.cxf.ws.security.policy.model.Layout;
 import org.apache.ws.security.WSConstants;
+import org.apache.ws.security.handler.RequestData;
 import org.apache.ws.security.handler.WSHandler;
+import org.apache.ws.security.handler.WSHandlerConstants;
 
 public abstract class AbstractWSS4JInterceptor extends WSHandler implements SoapInterceptor, 
     PhaseInterceptor<SoapMessage> {
@@ -136,4 +144,35 @@
     public void setBefore(Set<String> before) {
         this.before = before;
     }
+    
+    protected void checkPolicies(SoapMessage message, RequestData data) {
+        AssertionInfoMap aim = message.get(AssertionInfoMap.class);
+        // extract Assertion information
+        if (aim != null) {
+            Collection<AssertionInfo> ais = aim.get(SP12Constants.INCLUDE_TIMESTAMP);
+            if (ais != null) {
+                for (AssertionInfo ai : ais) {
+                    String action = getString(WSHandlerConstants.ACTION, message);
+                    if (action == null) {
+                        action = WSHandlerConstants.TIMESTAMP;
+                    } else {
+                        action += " " + WSHandlerConstants.TIMESTAMP;
+                    }
+                    message.put(WSHandlerConstants.ACTION, action);
+                    ai.setAsserted(true);
+                }                    
+            }
+            ais = aim.get(SP12Constants.LAYOUT);
+            if (ais != null) {
+                for (AssertionInfo ai : ais) {
+                    Layout lay = (Layout)ai.getAssertion();
+                    //wss4j can only do "Lax"
+                    if (SPConstants.LAYOUT_LAX.equals(lay.getValue())) {
+                        ai.setAsserted(true);
+                    }
+                }                    
+            }
+        }
+    }
+
 }

Modified: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JInInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JInInterceptor.java?rev=688791&r1=688790&r2=688791&view=diff
==============================================================================
--- cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JInInterceptor.java (original)
+++ cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JInInterceptor.java Mon Aug 25 10:42:43 2008
@@ -105,6 +105,7 @@
             doc = msg.getContent(SOAPMessage.class);
         }
         
+        
         boolean doDebug = LOG.isLoggable(Level.FINE);
         boolean doTimeLog = TIME_LOG.isLoggable(Level.FINE);
 
@@ -129,6 +130,7 @@
          */
         try {
             reqData.setMsgContext(msg);
+            checkPolicies(msg, reqData);
 
             Vector actions = new Vector();
             String action = getAction(msg, version);

Modified: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JOutInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JOutInterceptor.java?rev=688791&r1=688790&r2=688791&view=diff
==============================================================================
--- cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JOutInterceptor.java (original)
+++ cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JOutInterceptor.java Mon Aug 25 10:42:43 2008
@@ -111,6 +111,7 @@
         }
 
         public void handleMessage(SoapMessage mc) throws Fault {
+            
             boolean doDebug = LOG.isLoggable(Level.FINE);
             boolean doTimeDebug = TIME_LOG.isLoggable(Level.FINE);
             SoapVersion version = mc.getVersion();
@@ -130,6 +131,8 @@
             RequestData reqData = new RequestData();
     
             reqData.setMsgContext(mc);
+            checkPolicies(mc, reqData);
+            
             /*
              * The overall try, just to have a finally at the end to perform some
              * housekeeping.

Modified: cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/security/SecurityPolicyTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/security/SecurityPolicyTest.java?rev=688791&r1=688790&r2=688791&view=diff
==============================================================================
--- cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/security/SecurityPolicyTest.java (original)
+++ cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/security/SecurityPolicyTest.java Mon Aug 25 10:42:43 2008
@@ -24,6 +24,7 @@
 import javax.jws.WebService;
 import javax.xml.ws.Endpoint;
 
+import org.apache.cxf.interceptor.LoggingOutInterceptor;
 import org.apache.cxf.policytest.doubleit.DoubleItPortType;
 import org.apache.cxf.policytest.doubleit.DoubleItService;
 import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
@@ -42,6 +43,7 @@
         
         createStaticBus(SecurityPolicyTest.class.getResource("https_config.xml").toString())
             .getExtension(PolicyEngine.class).setEnabled(true);
+        getStaticBus().getOutInterceptors().add(new LoggingOutInterceptor());
         Endpoint.publish(POLICY_HTTPS_ADDRESS,
                          new DoubleItImplHttps());
         Endpoint.publish(POLICY_ADDRESS,
@@ -51,16 +53,21 @@
     @Test
     public void testPolicy() throws Exception {
         DoubleItService service = new DoubleItService();
-        DoubleItPortType pt = service.getDoubleItPortHttp();
+        DoubleItPortType pt;
+
+        pt = service.getDoubleItPortHttps();
+        pt.doubleIt(BigInteger.valueOf(25));
+        
         try {
+            pt = service.getDoubleItPortHttp();
             pt.doubleIt(BigInteger.valueOf(25));
             fail("https policy should have triggered");
         } catch (Exception ex) {
-            assertTrue(ex.getCause().getCause() instanceof PolicyException);
+            if (!(ex.getCause().getCause() instanceof PolicyException)) {
+                throw ex;
+            }
         }
         
-        pt = service.getDoubleItPortHttps();
-        pt.doubleIt(BigInteger.valueOf(25));
     }
     
     

Modified: cxf/trunk/systests/src/test/resources/wsdl_systest/DoubleIt.wsdl
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/src/test/resources/wsdl_systest/DoubleIt.wsdl?rev=688791&r1=688790&r2=688791&view=diff
==============================================================================
--- cxf/trunk/systests/src/test/resources/wsdl_systest/DoubleIt.wsdl (original)
+++ cxf/trunk/systests/src/test/resources/wsdl_systest/DoubleIt.wsdl Mon Aug 25 10:42:43 2008
@@ -90,25 +90,25 @@
                         <sp:HttpsToken RequireClientCertificate="false"/>
                      </wsp:Policy>
                   </sp:TransportToken>
-                  <sp:Layout>
+                  <!--sp:Layout>
                      <wsp:Policy>
                         <sp:Lax/>
                      </wsp:Policy>
-                  </sp:Layout>
+                  </sp:Layout-->
                   <sp:IncludeTimestamp/>
-                  <sp:AlgorithmSuite>
+                  <!--sp:AlgorithmSuite>
                      <wsp:Policy>
                         <sp:Basic128/>
                      </wsp:Policy>
-                  </sp:AlgorithmSuite>
+                  </sp:AlgorithmSuite-->
                </wsp:Policy>
             </sp:TransportBinding>
             <!-- sp:Wss10>
                <wsp:Policy>
                   <sp:MustSupportRefKeyIdentifier/>
                </wsp:Policy>
-            </sp:Wss10>
-            <sp:SignedSupportingTokens>
+            </sp:Wss10-->
+            <!-- sp:SignedSupportingTokens>
                <wsp:Policy>
                   <sp:UsernameToken sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient">
                      <wsp:Policy>
@@ -116,7 +116,7 @@
                      </wsp:Policy>
                   </sp:UsernameToken>
                </wsp:Policy>
-            </sp:SignedSupportingTokens -->
+            </sp:SignedSupportingTokens-->
          </wsp:All>
       </wsp:ExactlyOne>
    </wsp:Policy>

Modified: cxf/trunk/testutils/src/main/java/org/apache/cxf/testutil/common/AbstractBusClientServerTestBase.java
URL: http://svn.apache.org/viewvc/cxf/trunk/testutils/src/main/java/org/apache/cxf/testutil/common/AbstractBusClientServerTestBase.java?rev=688791&r1=688790&r2=688791&view=diff
==============================================================================
--- cxf/trunk/testutils/src/main/java/org/apache/cxf/testutil/common/AbstractBusClientServerTestBase.java (original)
+++ cxf/trunk/testutils/src/main/java/org/apache/cxf/testutil/common/AbstractBusClientServerTestBase.java Mon Aug 25 10:42:43 2008
@@ -59,7 +59,9 @@
         bus = bf.createBus();
         BusFactory.setDefaultBus(bus);
     }
-    
+    public static Bus getStaticBus() {
+        return staticBus;
+    }
     public static Bus createStaticBus(String config) throws Exception {
         defaultConfigFileName = config;
         return createStaticBus();



Mime
View raw message