Search in sources :

Example 26 with WrapThreadContextClassLoader

use of org.jboss.wsf.test.WrapThreadContextClassLoader in project jbossws-cxf by jbossws.

the class WSSecurityPolicyExamples21xTestCase method test2121.

/**
 * 2.1.2.1  UsernameToken as supporting token
 *
 * @throws Exception
 */
@Test
@RunAsClient
@WrapThreadContextClassLoader
public void test2121() throws Exception {
    Service service = Service.create(new URL("https", baseURL.getHost(), (baseURL.getPort() - 8080 + 8443), "/jaxws-samples-wsse-policy-oasis-21x/SecurityService2121?wsdl"), serviceName);
    ServiceIface proxy = (ServiceIface) service.getPort(new QName(NS, "SecurityService2121Port"), ServiceIface.class);
    setupWsse(proxy, false);
    assertTrue(proxy.sayHello().equals("Hello - UsernameToken as supporting token"));
}
Also used : QName(javax.xml.namespace.QName) Service(javax.xml.ws.Service) URL(java.net.URL) RunAsClient(org.jboss.arquillian.container.test.api.RunAsClient) Test(org.junit.Test) JBossWSTest(org.jboss.wsf.test.JBossWSTest) WrapThreadContextClassLoader(org.jboss.wsf.test.WrapThreadContextClassLoader)

Example 27 with WrapThreadContextClassLoader

use of org.jboss.wsf.test.WrapThreadContextClassLoader in project jbossws-cxf by jbossws.

the class WSSecurityPolicyExamples21xTestCase method test2112.

/**
 * 2.1.1.2 UsernameToken without password
 *
 * @throws Exception
 */
@Test
@RunAsClient
@WrapThreadContextClassLoader
public void test2112() throws Exception {
    Service service = Service.create(new URL(baseURL + "/SecurityService2112?wsdl"), serviceName);
    ServiceIface proxy = (ServiceIface) service.getPort(new QName(NS, "SecurityService2112Port"), ServiceIface.class);
    setupWsse(proxy, false);
    assertTrue(proxy.sayHello().equals("Hello - UsernameToken without password"));
}
Also used : QName(javax.xml.namespace.QName) Service(javax.xml.ws.Service) URL(java.net.URL) RunAsClient(org.jboss.arquillian.container.test.api.RunAsClient) Test(org.junit.Test) JBossWSTest(org.jboss.wsf.test.JBossWSTest) WrapThreadContextClassLoader(org.jboss.wsf.test.WrapThreadContextClassLoader)

Example 28 with WrapThreadContextClassLoader

use of org.jboss.wsf.test.WrapThreadContextClassLoader in project jbossws-cxf by jbossws.

the class WSSecurityPolicyExamples21xTestCase method test2113.

/**
 * 2.1.1.3  UsernameToken with timestamp, nonce and password hash
 *
 * @throws Exception
 */
@Test
@RunAsClient
@WrapThreadContextClassLoader
public void test2113() throws Exception {
    Service service = Service.create(new URL(baseURL + "/SecurityService2113?wsdl"), serviceName);
    ServiceIface proxy = (ServiceIface) service.getPort(new QName(NS, "SecurityService2113Port"), ServiceIface.class);
    setupWsse(proxy, true);
    assertTrue(proxy.sayHello().equals("Hello - UsernameToken with timestamp, nonce and password hash"));
}
Also used : QName(javax.xml.namespace.QName) Service(javax.xml.ws.Service) URL(java.net.URL) RunAsClient(org.jboss.arquillian.container.test.api.RunAsClient) Test(org.junit.Test) JBossWSTest(org.jboss.wsf.test.JBossWSTest) WrapThreadContextClassLoader(org.jboss.wsf.test.WrapThreadContextClassLoader)

Example 29 with WrapThreadContextClassLoader

use of org.jboss.wsf.test.WrapThreadContextClassLoader in project jbossws-cxf by jbossws.

the class WSSecurityPolicyExamples21xTestCase method test213.

/**
 * 2.1.3  (WSS 1.0) UsernameToken with Mutual X.509v3 Authentication, Sign, Encrypt
 *
 * @throws Exception
 */
@Test
@RunAsClient
@WrapThreadContextClassLoader
public void test213() throws Exception {
    Service service = Service.create(new URL(baseURL + "/SecurityService213?wsdl"), serviceName);
    ServiceIface proxy = (ServiceIface) service.getPort(new QName(NS, "SecurityService213Port"), ServiceIface.class);
    setupWsse(proxy, true);
    assertTrue(proxy.sayHello().equals("Hello - (WSS 1.0) UsernameToken with Mutual X.509v3 Authentication, Sign, Encrypt"));
}
Also used : QName(javax.xml.namespace.QName) Service(javax.xml.ws.Service) URL(java.net.URL) RunAsClient(org.jboss.arquillian.container.test.api.RunAsClient) Test(org.junit.Test) JBossWSTest(org.jboss.wsf.test.JBossWSTest) WrapThreadContextClassLoader(org.jboss.wsf.test.WrapThreadContextClassLoader)

Example 30 with WrapThreadContextClassLoader

use of org.jboss.wsf.test.WrapThreadContextClassLoader in project jbossws-cxf by jbossws.

the class WSSecurityPolicyExamples22xTestCase method test224.

/**
 * 2.2.4  (WSS1.1) Mutual Authentication with X.509 Certificates, Sign, Encrypt
 *
 * Client and server X509 certificates are used for client and server authorization respectively. Request is signed using K, then
 * encrypted using K, K is ephemeral key protected for server's certificate. Signature corresponding to K is signed using client certificate.
 * Response is signed using K, encrypted using K, encrypted key K is not included in response. Alternatively, derived keys can be used for
 * each of the encryption and signature operations by simply adding an sp:RequireDerivedKeys assertion.
 *
 * @throws Exception
 */
@Test
@RunAsClient
@WrapThreadContextClassLoader
public void test224() throws Exception {
    Service service = Service.create(new URL(baseURL + "SecurityService224?wsdl"), serviceName);
    ServiceIface proxy = (ServiceIface) service.getPort(new QName(NS, "SecurityService224Port"), ServiceIface.class);
    setupWsse(proxy, false);
    try {
        assertTrue(proxy.sayHello().equals("Hello - (WSS1.1) Mutual Authentication with X.509 Certificates, Sign, Encrypt"));
    } catch (Exception e) {
        throw CryptoCheckHelper.checkAndWrapException(e);
    }
}
Also used : QName(javax.xml.namespace.QName) Service(javax.xml.ws.Service) URL(java.net.URL) RunAsClient(org.jboss.arquillian.container.test.api.RunAsClient) Test(org.junit.Test) JBossWSTest(org.jboss.wsf.test.JBossWSTest) WrapThreadContextClassLoader(org.jboss.wsf.test.WrapThreadContextClassLoader)

Aggregations

QName (javax.xml.namespace.QName)41 RunAsClient (org.jboss.arquillian.container.test.api.RunAsClient)41 JBossWSTest (org.jboss.wsf.test.JBossWSTest)41 WrapThreadContextClassLoader (org.jboss.wsf.test.WrapThreadContextClassLoader)41 Test (org.junit.Test)41 URL (java.net.URL)40 Service (javax.xml.ws.Service)39 OperateOnDeployment (org.jboss.arquillian.container.test.api.OperateOnDeployment)15 Bus (org.apache.cxf.Bus)13 BindingProvider (javax.xml.ws.BindingProvider)6 ActAsServiceIface (org.jboss.test.ws.jaxws.samples.wsse.policy.trust.actas.ActAsServiceIface)6 OnBehalfOfServiceIface (org.jboss.test.ws.jaxws.samples.wsse.policy.trust.onbehalfof.OnBehalfOfServiceIface)6 ServiceIface (org.jboss.test.ws.jaxws.samples.wsse.policy.trust.service.ServiceIface)5 ByteArrayOutputStream (java.io.ByteArrayOutputStream)2 PrintWriter (java.io.PrintWriter)2 SOAPFaultException (javax.xml.ws.soap.SOAPFaultException)2 LoggingInInterceptor (org.apache.cxf.interceptor.LoggingInInterceptor)2 UseThreadBusFeature (org.jboss.wsf.stack.cxf.client.UseThreadBusFeature)2 Endpoint (javax.xml.ws.Endpoint)1 HelloResponse (org.jboss.test.ws.jaxws.samples.schemavalidation.types.HelloResponse)1