cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject svn commit: r1097146 - /cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/trust/AuthPolicyValidatingInterceptor.java
Date Wed, 27 Apr 2011 15:29:48 GMT
Author: sergeyb
Date: Wed Apr 27 15:29:48 2011
New Revision: 1097146

URL: http://svn.apache.org/viewvc?rev=1097146&view=rev
Log:
[CXF-3462] Simplifying the conversion from BasicAuth to UsernameToken

Modified:
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/trust/AuthPolicyValidatingInterceptor.java

Modified: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/trust/AuthPolicyValidatingInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/trust/AuthPolicyValidatingInterceptor.java?rev=1097146&r1=1097145&r2=1097146&view=diff
==============================================================================
--- cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/trust/AuthPolicyValidatingInterceptor.java
(original)
+++ cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/trust/AuthPolicyValidatingInterceptor.java
Wed Apr 27 15:29:48 2011
@@ -25,7 +25,6 @@ import javax.xml.parsers.DocumentBuilder
 import javax.xml.parsers.DocumentBuilderFactory;
 
 import org.w3c.dom.Document;
-import org.w3c.dom.Element;
 
 import org.apache.cxf.common.i18n.BundleUtils;
 import org.apache.cxf.common.logging.LogUtils;
@@ -84,21 +83,12 @@ public class AuthPolicyValidatingInterce
         DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
         DocumentBuilder builder = factory.newDocumentBuilder();
         Document doc = builder.newDocument();
-        Element utElement = 
-            doc.createElementNS(WSConstants.WSSE_NS, "wsse:" + WSConstants.USERNAME_TOKEN_LN);
         
-        Element nameElement = 
-            doc.createElementNS(WSConstants.WSSE_NS, "wsse:" + WSConstants.USERNAME_LN);
-        nameElement.setTextContent(policy.getUserName());
-        Element passwordElement = 
-            doc.createElementNS(WSConstants.WSSE_NS, "wsse:" + WSConstants.PASSWORD_LN);
-        passwordElement.setTextContent(policy.getPassword());
-        passwordElement.setAttribute(WSConstants.PASSWORD_TYPE_ATTR, 
-                                     WSConstants.USERNAMETOKEN_NS + "#"  + WSConstants.PASSWORD_TEXT);
-        
-        utElement.appendChild(nameElement);
-        utElement.appendChild(passwordElement);
-        return new UsernameToken(utElement);
+        UsernameToken token = new UsernameToken(false, doc, 
+                                                WSConstants.PASSWORD_TEXT);
+        token.setName(policy.getUserName());
+        token.setPassword(policy.getPassword());
+        return token;
     }
 
     public void setValidator(STSTokenValidator validator) {



Mime
View raw message