Search in sources :

Example 1 with WrapThreadContextClassLoader

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

the class WSSecurityPolicyExamples21xTestCase method test2111.

/**
 * 2.1.1.1 UsernameToken with plain text password
 *
 * @throws Exception
 */
@Test
@RunAsClient
@WrapThreadContextClassLoader
public void test2111() throws Exception {
    Service service = Service.create(new URL(baseURL + "/SecurityService2111?wsdl"), serviceName);
    ServiceIface proxy = (ServiceIface) service.getPort(new QName(NS, "SecurityService2111Port"), ServiceIface.class);
    setupWsse(proxy, true);
    assertTrue(proxy.sayHello().equals("Hello - UsernameToken with plain text 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 2 with WrapThreadContextClassLoader

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

the class WSSecurityPolicyExamples21xTestCase method test214.

/**
 * 2.1.4  (WSS 1.1) User Name with Certificates, Sign, Encrypt
 *
 * @throws Exception
 */
@Test
@RunAsClient
@WrapThreadContextClassLoader
public void test214() throws Exception {
    Service service = Service.create(new URL(baseURL + "/SecurityService214?wsdl"), serviceName);
    ServiceIface proxy = (ServiceIface) service.getPort(new QName(NS, "SecurityService214Port"), ServiceIface.class);
    setupWsse(proxy, false);
    assertTrue(proxy.sayHello().equals("Hello - (WSS 1.1) User Name with Certificates, 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 3 with WrapThreadContextClassLoader

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

the class WSSecurityPolicyExamples22xTestCase method test221.

/**
 * 2.2.1 (WSS1.0) X.509 Certificates, Sign, Encrypt
 *
 * This use-case corresponds to the situation where both parties have X.509v3 certificates (and public-private key pairs).
 * The requestor identifies itself to the service. The message exchange is integrity protected and encrypted.
 *
 * @throws Exception
 */
@Test
@RunAsClient
@WrapThreadContextClassLoader
public void test221() throws Exception {
    Service service = Service.create(new URL(baseURL + "SecurityService221?wsdl"), serviceName);
    ServiceIface proxy = (ServiceIface) service.getPort(new QName(NS, "SecurityService221Port"), ServiceIface.class);
    setupWsse(proxy, true);
    try {
        assertTrue(proxy.sayHello().equals("Hello - (WSS1.0) 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)

Example 4 with WrapThreadContextClassLoader

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

the class WSSecurityPolicyExamples22xTestCase method test222.

/**
 * 2.2.2  (WSS1.0) Mutual Authentication with X.509 Certificates, Sign, Encrypt
 *
 * This use case corresponds to the situation where both parties have X.509v3 certificates (and public-private key pairs).
 * The requestor wishes to identify itself to the service using its X.509 credential (strong authentication).
 * The message exchange needs to be integrity protected and encrypted as well. The difference from previous use case is
 * that the X509 token inserted by the client is included in the message signature (see <ProtectTokens />).
 *
 * @throws Exception
 */
@Test
@RunAsClient
@WrapThreadContextClassLoader
public void test222() throws Exception {
    Service service = Service.create(new URL(baseURL + "SecurityService222?wsdl"), serviceName);
    ServiceIface proxy = (ServiceIface) service.getPort(new QName(NS, "SecurityService222Port"), ServiceIface.class);
    setupWsse(proxy, true);
    try {
        assertTrue(proxy.sayHello().equals("Hello - (WSS1.0) 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)

Example 5 with WrapThreadContextClassLoader

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

the class WSSecurityPolicyExamples23xTestCase method test2313.

/**
 * 2.3.1.3 (WSS1.0) SAML1.1 Assertion (HK) over SSL
 *
 * @throws Exception
 */
@Test
@RunAsClient
@WrapThreadContextClassLoader
public void test2313() throws Exception {
    Service service = Service.create(new URL(serviceURLHttps + "SecurityService2313?wsdl"), serviceName);
    ServiceIface proxy = (ServiceIface) service.getPort(new QName(NS, "SecurityService2313Port"), ServiceIface.class);
    Map<String, Object> reqCtx = ((BindingProvider) proxy).getRequestContext();
    SamlCallbackHandler cbh = new SamlCallbackHandler();
    cbh.setConfirmationMethod("urn:oasis:names:tc:SAML:1.0:cm:holder-of-key");
    cbh.setSigned(true);
    reqCtx.put(SecurityConstants.SAML_CALLBACK_HANDLER, cbh);
    reqCtx.put(SecurityConstants.SIGNATURE_PROPERTIES, Thread.currentThread().getContextClassLoader().getResource("META-INF/alice.properties"));
    reqCtx.put(SecurityConstants.SIGNATURE_USERNAME, "alice");
    reqCtx.put(SecurityConstants.CALLBACK_HANDLER, new KeystorePasswordCallback());
    assertTrue(proxy.sayHello().equals("Hello -  (WSS1.0) SAML1.1 Assertion (HK) over SSL"));
}
Also used : QName(javax.xml.namespace.QName) Service(javax.xml.ws.Service) BindingProvider(javax.xml.ws.BindingProvider) 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