[jboss-svn-commits] JBossWS SVN: r795 - in trunk/src: main/java/org/jboss/ws/wsse test/java/org/jboss/test/ws/wsse
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Sun Aug 20 16:17:04 EDT 2006
Author: darran.lofthouse at jboss.com
Date: 2006-08-20 16:17:00 -0400 (Sun, 20 Aug 2006)
New Revision: 795
Modified:
trunk/src/main/java/org/jboss/ws/wsse/WSSecurityDispatcher.java
trunk/src/test/java/org/jboss/test/ws/wsse/UsernameTestCase.java
Log:
JBWS-1117 - If the username and password are not set adding the username token should be skipped. We were using these values before we checked if they were null.
Modified: trunk/src/main/java/org/jboss/ws/wsse/WSSecurityDispatcher.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/wsse/WSSecurityDispatcher.java 2006-08-20 20:12:29 UTC (rev 794)
+++ trunk/src/main/java/org/jboss/ws/wsse/WSSecurityDispatcher.java 2006-08-20 20:17:00 UTC (rev 795)
@@ -246,12 +246,12 @@
if (operationConfig.getUsername() != null)
{
- String user = ctx.getProperty(Stub.USERNAME_PROPERTY).toString();
- String pass = ctx.getProperty(Stub.PASSWORD_PROPERTY).toString();
+ Object user = ctx.getProperty(Stub.USERNAME_PROPERTY);
+ Object pass = ctx.getProperty(Stub.PASSWORD_PROPERTY);
if (user != null && pass != null)
{
- operations.add(new OperationDescription<EncodingOperation>(SendUsernameOperation.class, null, user, pass, null));
+ operations.add(new OperationDescription<EncodingOperation>(SendUsernameOperation.class, null, user.toString(), pass.toString(), null));
ctx.setProperty(StubExt.PROPERTY_AUTH_TYPE, StubExt.PROPERTY_AUTH_TYPE_WSSE);
}
}
Modified: trunk/src/test/java/org/jboss/test/ws/wsse/UsernameTestCase.java
===================================================================
--- trunk/src/test/java/org/jboss/test/ws/wsse/UsernameTestCase.java 2006-08-20 20:12:29 UTC (rev 794)
+++ trunk/src/test/java/org/jboss/test/ws/wsse/UsernameTestCase.java 2006-08-20 20:17:00 UTC (rev 795)
@@ -1,26 +1,28 @@
/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
package org.jboss.test.ws.wsse;
+import java.rmi.RemoteException;
+
import javax.naming.InitialContext;
import javax.xml.rpc.Service;
import javax.xml.rpc.Stub;
@@ -39,7 +41,7 @@
public class UsernameTestCase extends JBossWSTest
{
private static JaxRpcTestService endpoint;
-
+
public static Test suite()
{
return JBossWSTestSetup.newTestSetup(UsernameTestCase.class, "jbossws-wsse-username.jar, jbossws-wsse-username-client.jar");
@@ -57,7 +59,7 @@
((Stub)endpoint)._setProperty(Stub.USERNAME_PROPERTY, "kermit");
((Stub)endpoint)._setProperty(Stub.PASSWORD_PROPERTY, "thefrog");
}
-
+
System.clearProperty("org.jboss.ws.wsse.keyStore");
System.clearProperty("org.jboss.ws.wsse.trustStore");
System.clearProperty("org.jboss.ws.wsse.keyStorePassword");
@@ -65,7 +67,7 @@
System.clearProperty("org.jboss.ws.wsse.keyStoreType");
System.clearProperty("org.jboss.ws.wsse.trustStoreType");
}
-
+
public void testEchoString() throws Exception
{
String hello = "Hello";
@@ -81,4 +83,23 @@
Object retObj = endpoint.echoSimpleUserType(hello, userType);
assertEquals(userType, retObj);
}
+
+ public void testEchoStringNoUsername() throws Exception
+ {
+ String hello = "Hello";
+ String world = "world!";
+
+ ((Stub)endpoint)._setProperty(Stub.USERNAME_PROPERTY, null);
+ ((Stub)endpoint)._setProperty(Stub.PASSWORD_PROPERTY, null);
+
+ try
+ {
+ endpoint.echoString(hello, world);
+ fail("Expected exception not thrown");
+ }
+ catch (RemoteException e)
+ {
+ }
+
+ }
}
More information about the jboss-svn-commits
mailing list