You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by ng...@apache.org on 2008/01/03 19:39:49 UTC

svn commit: r608590 - in /webservices/axis2/trunk/java/modules/jaxws: src/org/apache/axis2/jaxws/core/controller/AxisInvocationController.java test/org/apache/axis2/jaxws/security/BasicAuthSecurityTests.java

Author: ngallardo
Date: Thu Jan  3 10:39:48 2008
New Revision: 608590

URL: http://svn.apache.org/viewvc?rev=608590&view=rev
Log:
AXIS2-3403

Changes as documented in the JIRA.

Modified:
    webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/core/controller/AxisInvocationController.java
    webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/security/BasicAuthSecurityTests.java

Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/core/controller/AxisInvocationController.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/core/controller/AxisInvocationController.java?rev=608590&r1=608589&r2=608590&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/core/controller/AxisInvocationController.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/core/controller/AxisInvocationController.java Thu Jan  3 10:39:48 2008
@@ -496,8 +496,8 @@
 
         // Check to see if BASIC_AUTH is enabled.  If so, make sure
         // the properties are setup correctly.
-        if (mc.containsKey(BindingProvider.USERNAME_PROPERTY) &&
-                mc.containsKey(BindingProvider.PASSWORD_PROPERTY)) {
+        if (mc.containsKey(BindingProvider.USERNAME_PROPERTY) ||
+            mc.containsKey(BindingProvider.PASSWORD_PROPERTY)) {
 
             String userId = (String)mc.getProperty(BindingProvider.USERNAME_PROPERTY);
             if (userId == null || userId == "") {
@@ -505,10 +505,9 @@
                         .makeWebServiceException(Messages.getMessage("checkUserName"));
             }
 
-            String password = (String)mc.getProperty(BindingProvider.PASSWORD_PROPERTY);
-            if (password == null || password == "") {
-                throw ExceptionFactory
-                        .makeWebServiceException(Messages.getMessage("checkPassword"));
+            String password = null;
+            if (mc.containsKey(BindingProvider.PASSWORD_PROPERTY)) {
+                password = (String) mc.getProperty(BindingProvider.PASSWORD_PROPERTY);
             }
 
             URL url = null;
@@ -529,12 +528,6 @@
             basicAuthentication.setPreemptiveAuthentication(true);
 
             mc.setProperty(HTTPConstants.AUTHENTICATE, basicAuthentication);
-        } else if ((!mc.containsKey(BindingProvider.USERNAME_PROPERTY) &&
-                mc.containsKey(BindingProvider.PASSWORD_PROPERTY)) ||
-                (mc.containsKey(BindingProvider.USERNAME_PROPERTY) &&
-                        !mc.containsKey(BindingProvider.PASSWORD_PROPERTY))) {
-            throw ExceptionFactory
-                    .makeWebServiceException(Messages.getMessage("checkUsernameAndPassword"));
         }
     }
 

Modified: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/security/BasicAuthSecurityTests.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/security/BasicAuthSecurityTests.java?rev=608590&r1=608589&r2=608590&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/security/BasicAuthSecurityTests.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/security/BasicAuthSecurityTests.java Thu Jan  3 10:39:48 2008
@@ -35,8 +35,8 @@
     private QName SERVICE_QNAME = new QName("http://ws.apache.org/axis2", "BasicAuthSecurityService");
     private QName PORT_QNAME = new QName("http://ws.apache.org/axis2", "SimpleProviderServiceSOAP11port0");
 
-	private String USER_ID = "testid";
-	private String PASSWORD = "testid";
+    private String USER_ID = "testid";
+    private String PASSWORD = "testid";
 
     protected void setUp() throws Exception {
             super.setUp();
@@ -61,6 +61,8 @@
         TestLogger.logger.debug(">> Invoking Dispatch<String> BasicAuthSecurityService");
         String retVal = dispatch.invoke(xmlString);
         TestLogger.logger.debug(">> Response [" + retVal + "]");
+        
+        assertTrue(retVal != null);
     }
     
     public void testBasicAuth_uid_pwd() throws Exception {
@@ -77,6 +79,8 @@
         TestLogger.logger.debug(">> Invoking Dispatch<String> BasicAuthSecurityService");
         String retVal = dispatch.invoke(xmlString);
         TestLogger.logger.debug(">> Response [" + retVal + "]");
+        
+        assertTrue(retVal != null);
     }
     
     public void testBasicAuth_uid()throws Exception{
@@ -90,16 +94,8 @@
         dispatch.getRequestContext().put(BindingProvider.USERNAME_PROPERTY, USER_ID);
 
         TestLogger.logger.debug(">> Invoking Dispatch<String> BasicAuthSecurityService");
-        
-        try{
-        	String retVal = dispatch.invoke(xmlString);
-            TestLogger.logger.debug(">> Response [" + retVal + "]");
-            
-            fail("Set USERID with no PASSWORD: WebServiceException is expected");
-        }
-        catch(WebServiceException wse){
-            TestLogger.logger.debug(getName() + ": " + wse);
-        }
+        String retVal = dispatch.invoke(xmlString);
+       	TestLogger.logger.debug(">> Response [" + retVal + "]");
     }
     
     public void testBasicAuth_pwd()throws Exception{



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