Author: alessio.soldano(a)jboss.com
Date: 2011-02-07 12:22:45 -0500 (Mon, 07 Feb 2011)
New Revision: 13682
Removed:
stack/cxf/branches/JBPAPP-5764/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/CustomSubjectCreatingInterceptor.java
stack/cxf/branches/JBPAPP-5764/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/UsernameAuthorizationCustomFileTestCase.java
stack/cxf/branches/JBPAPP-5764/modules/testsuite/cxf-tests/src/test/resources/jaxws/samples/wsse/username-authorize-custom/
Modified:
stack/cxf/branches/JBPAPP-5764/modules/testsuite/cxf-tests/pom.xml
stack/cxf/branches/JBPAPP-5764/modules/testsuite/cxf-tests/scripts/cxf-samples-jaxws.xml
stack/cxf/branches/JBPAPP-5764/pom.xml
Log:
Removing testcase using PicketBox API for loading security config from a custom file;
that's doable differently in any case, see wsseDigest testcase for instance
Modified: stack/cxf/branches/JBPAPP-5764/modules/testsuite/cxf-tests/pom.xml
===================================================================
--- stack/cxf/branches/JBPAPP-5764/modules/testsuite/cxf-tests/pom.xml 2011-02-07 14:09:52
UTC (rev 13681)
+++ stack/cxf/branches/JBPAPP-5764/modules/testsuite/cxf-tests/pom.xml 2011-02-07 17:22:45
UTC (rev 13682)
@@ -20,11 +20,6 @@
<artifactId>jbossws-cxf-server</artifactId>
<version>${version}</version>
</dependency>
- <dependency>
- <groupId>org.picketbox</groupId>
- <artifactId>picketbox-bare</artifactId>
- <scope>test</scope>
- </dependency>
</dependencies>
<!-- Profiles -->
Modified:
stack/cxf/branches/JBPAPP-5764/modules/testsuite/cxf-tests/scripts/cxf-samples-jaxws.xml
===================================================================
---
stack/cxf/branches/JBPAPP-5764/modules/testsuite/cxf-tests/scripts/cxf-samples-jaxws.xml 2011-02-07
14:09:52 UTC (rev 13681)
+++
stack/cxf/branches/JBPAPP-5764/modules/testsuite/cxf-tests/scripts/cxf-samples-jaxws.xml 2011-02-07
17:22:45 UTC (rev 13682)
@@ -143,25 +143,6 @@
</webinf>
</war>
- <!-- jaxws-samples-wsse-username-authorize-custom -->
- <war
-
warfile="${tests.output.dir}/test-libs/jaxws-samples-wsse-username-authorize-custom.war"
-
webxml="${tests.output.dir}/test-resources/jaxws/samples/wsse/username-authorize-custom/WEB-INF/web.xml">
- <classes dir="${tests.output.dir}/test-classes">
- <include
name="org/jboss/test/ws/jaxws/samples/wsse/Service*.class"/>
- <include
name="org/jboss/test/ws/jaxws/samples/wsse/CustomSubjectCreatingInterceptor.class"/>
- <include
name="org/jboss/test/ws/jaxws/samples/wsse/jaxws/*.class"/>
- </classes>
- <webinf
dir="${tests.output.dir}/test-resources/jaxws/samples/wsse/username-authorize-custom/WEB-INF">
- <include name="jboss-web.xml"/>
- <include name="login-config.xml"/>
- <include name="users.properties"/>
- <include name="roles.properties"/>
- <include name="jbossws-cxf.xml"/>
- <include name="wsdl/*"/>
- </webinf>
- </war>
-
<!-- jaxws-samples-wsse-username-digest -->
<war
warfile="${tests.output.dir}/test-libs/jaxws-samples-wsse-username-digest.war"
Deleted:
stack/cxf/branches/JBPAPP-5764/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/CustomSubjectCreatingInterceptor.java
===================================================================
---
stack/cxf/branches/JBPAPP-5764/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/CustomSubjectCreatingInterceptor.java 2011-02-07
14:09:52 UTC (rev 13681)
+++
stack/cxf/branches/JBPAPP-5764/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/CustomSubjectCreatingInterceptor.java 2011-02-07
17:22:45 UTC (rev 13682)
@@ -1,66 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2010, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.jaxws.samples.wsse;
-
-import java.util.Collections;
-import org.jboss.wsf.stack.cxf.security.authentication.SubjectCreatingInterceptor;
-import org.picketbox.config.PicketBoxConfiguration;
-import org.picketbox.exceptions.ConfigurationStreamNullException;
-import org.picketbox.factories.SecurityFactory;
-
-
-/**
- * Interceptor which authenticates a current principal and populates Subject
- *
- * @author Sergey Beryozkin
- *
- */
-public class CustomSubjectCreatingInterceptor extends SubjectCreatingInterceptor
-{
-
- public CustomSubjectCreatingInterceptor()
- {
- super(Collections.<String, Object> singletonMap("action",
"UsernameToken"));
- }
-
- public void setSecurityConfigFile(String configFilePath)
- {
- SecurityFactory.prepare();
- try
- {
- PicketBoxConfiguration idtrustConfig = new PicketBoxConfiguration();
- idtrustConfig.load(configFilePath);
- }
- catch (ConfigurationStreamNullException ex) {
- throw new SecurityException("Unable to load the configuration file " +
configFilePath);
- }
- catch (Exception ex) {
- throw new SecurityException("Unable to read the configuration file " +
configFilePath, ex);
- }
- finally
- {
- SecurityFactory.release();
- }
- }
-
-
-}
Deleted:
stack/cxf/branches/JBPAPP-5764/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/UsernameAuthorizationCustomFileTestCase.java
===================================================================
---
stack/cxf/branches/JBPAPP-5764/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/UsernameAuthorizationCustomFileTestCase.java 2011-02-07
14:09:52 UTC (rev 13681)
+++
stack/cxf/branches/JBPAPP-5764/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/UsernameAuthorizationCustomFileTestCase.java 2011-02-07
17:22:45 UTC (rev 13682)
@@ -1,127 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2010, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.jaxws.samples.wsse;
-
-import java.net.URL;
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.xml.namespace.QName;
-import javax.xml.ws.Service;
-
-import junit.framework.Test;
-
-import org.apache.cxf.binding.soap.saaj.SAAJOutInterceptor;
-import org.apache.cxf.endpoint.Client;
-import org.apache.cxf.endpoint.Endpoint;
-import org.apache.cxf.frontend.ClientProxy;
-import org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor;
-import org.jboss.wsf.test.JBossWSTest;
-import org.jboss.wsf.test.JBossWSTestSetup;
-
-/**
- * WS-Security username authorization test case
- *
- * @author Sergey Beryozkin
- *
- */
-public final class UsernameAuthorizationCustomFileTestCase extends JBossWSTest
-{
- private final String serviceURL = "http://" + getServerHost() +
":8080/jaxws-samples-wsse-username-authorize-custom";
- private final QName servicePort = new
QName("http://www.jboss.org/jbossws/ws-extensions/wssecurity",
"SecurityServicePort");
-
- public static Test suite()
- {
- return new JBossWSTestSetup(UsernameAuthorizationCustomFileTestCase.class,
"jaxws-samples-wsse-username-authorize-custom.war");
- }
-
- public void testAuthorizedCustomConfig() throws Exception
- {
- doTestAuthorized(serviceURL, servicePort, "theKermit");
- }
-
-private void doTestAuthorized(String endpointAddress, QName portName, String userName)
throws Exception
- {
- QName serviceName = new
QName("http://www.jboss.org/jbossws/ws-extensions/wssecurity",
"SecurityService");
- URL wsdlURL = new URL(endpointAddress + "?wsdl");
- Service service = Service.create(wsdlURL, serviceName);
- ServiceIface proxy = (ServiceIface)service.getPort(portName, ServiceIface.class);
- setupWsse(proxy, userName);
- assertEquals("Secure Hello World!", proxy.sayHello());
- }
-
- public void testUnauthenticated() throws Exception
- {
- QName serviceName = new
QName("http://www.jboss.org/jbossws/ws-extensions/wssecurity",
"SecurityService");
- URL wsdlURL = new URL(serviceURL + "?wsdl");
- Service service = Service.create(wsdlURL, serviceName);
- ServiceIface proxy = (ServiceIface)service.getPort(ServiceIface.class);
- setupWsse(proxy, "foo");
- try
- {
- proxy.sayHello();
- fail("User foo should not be authenticated.");
- }
- catch (Exception ex)
- {
- //expected
- }
- }
-
- public void testUnauthorizedCustomConfig() throws Exception
- {
- doTestUnauthorized(serviceURL, servicePort, "theKermit");
- }
-
-private void doTestUnauthorized(String endpointAddress, QName portName, String userName)
throws Exception
- {
- QName serviceName = new
QName("http://www.jboss.org/jbossws/ws-extensions/wssecurity",
"SecurityService");
- URL wsdlURL = new URL(endpointAddress + "?wsdl");
- Service service = Service.create(wsdlURL, serviceName);
- ServiceIface proxy = (ServiceIface)service.getPort(portName, ServiceIface.class);
- setupWsse(proxy, userName);
- try
- {
- proxy.greetMe();
- fail("User kermit should not be authorized to invoke greetMe.");
- }
- catch (Exception ex)
- {
- assertEquals("Unauthorized", ex.getMessage());
- }
- }
-
- private void setupWsse(ServiceIface proxy, String username)
- {
- Client client = ClientProxy.getClient(proxy);
- Endpoint cxfEndpoint = client.getEndpoint();
-
- Map<String, Object> outProps = new HashMap<String, Object>();
- outProps.put("action", "UsernameToken");
- outProps.put("user", username);
- outProps.put("passwordType", "PasswordText");
- outProps.put("passwordCallbackClass",
"org.jboss.test.ws.jaxws.samples.wsse.UsernamePasswordCallback");
- WSS4JOutInterceptor wssOut = new WSS4JOutInterceptor(outProps); //request
- cxfEndpoint.getOutInterceptors().add(wssOut);
- cxfEndpoint.getOutInterceptors().add(new SAAJOutInterceptor());
- }
-}
Modified: stack/cxf/branches/JBPAPP-5764/pom.xml
===================================================================
--- stack/cxf/branches/JBPAPP-5764/pom.xml 2011-02-07 14:09:52 UTC (rev 13681)
+++ stack/cxf/branches/JBPAPP-5764/pom.xml 2011-02-07 17:22:45 UTC (rev 13682)
@@ -61,7 +61,6 @@
<jboss.security.spi.version>2.0.4.SP4</jboss.security.spi.version>
<jboss.security.sx.version>2.0.4</jboss.security.sx.version>
<jboss.xb.version>2.0.2.Beta7</jboss.xb.version>
- <picketbox.version>3.0.0.Beta5</picketbox.version>
<jaxb.api.version>2.1</jaxb.api.version>
<jaxb.impl.version>2.1.12.patch01</jaxb.impl.version>
<jaxrpc.api.version>1.1</jaxrpc.api.version>
@@ -486,22 +485,6 @@
<scope>provided</scope>
</dependency>
<dependency>
- <groupId>org.picketbox</groupId>
- <artifactId>picketbox-bare</artifactId>
- <version>${picketbox.version}</version>
- <scope>provided</scope>
- <exclusions>
- <exclusion>
- <groupId>org.jboss.security</groupId>
- <artifactId>jboss-security-spi</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.jboss.security</groupId>
- <artifactId>jbosssx</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
<groupId>org.jboss.security</groupId>
<artifactId>jboss-security-spi</artifactId>
<version>${jboss.security.spi.version}</version>