Search in sources :

Example 96 with RunAsClient

use of org.jboss.arquillian.container.test.api.RunAsClient in project jbossws-cxf by jbossws.

the class WSSecurityPolicyExamples23xTestCase method test2323.

/**
 * 2.3.2.3 (WSS1.1) SAML2.0 HoK over SSL
 *
 * @throws Exception
 */
@Test
@RunAsClient
@WrapThreadContextClassLoader
public void test2323() throws Exception {
    Service service = Service.create(new URL(serviceURLHttps + "SecurityService2323?wsdl"), serviceName);
    ServiceIface proxy = (ServiceIface) service.getPort(new QName(NS, "SecurityService2323Port"), ServiceIface.class);
    Map<String, Object> reqCtx = ((BindingProvider) proxy).getRequestContext();
    SamlCallbackHandler cbh = new SamlCallbackHandler();
    cbh.setConfirmationMethod("urn:oasis:names:tc:SAML:2.0:cm:holder-of-key");
    cbh.setSaml2(true);
    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.1) SAML2.0 HoK 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)

Example 97 with RunAsClient

use of org.jboss.arquillian.container.test.api.RunAsClient in project jbossws-cxf by jbossws.

the class SecureConversationTestCase method test.

@Test
@RunAsClient
@WrapThreadContextClassLoader
public void test() throws Exception {
    QName serviceName = new QName("http://www.jboss.org/jbossws/ws-extensions/wssecuritypolicy", "SecurityService");
    URL wsdlURL = new URL("http://" + getServerHost() + ":" + getServerPort() + "/jaxws-samples-wsse-policy-secconv/SecureConversationService?wsdl");
    Service service = Service.create(wsdlURL, serviceName);
    ServiceIface proxy = (ServiceIface) service.getPort(ServiceIface.class);
    setupWsse(proxy, true);
    assertTrue(proxy.sayHello().startsWith("Secure Conversation Hello World!"));
    assertTrue(proxy.sayHello().startsWith("Secure Conversation Hello World!"));
}
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 98 with RunAsClient

use of org.jboss.arquillian.container.test.api.RunAsClient in project jbossws-cxf by jbossws.

the class WSTrustTestCase method testUsingEPR.

/**
 * WS-Trust test with the STS information coming from EPR specified in service endpoint contract policy
 *
 * @throws Exception
 */
@Test
@RunAsClient
@OperateOnDeployment(SERVER_DEP)
@WrapThreadContextClassLoader
public void testUsingEPR() throws Exception {
    Bus bus = BusFactory.newInstance().createBus();
    try {
        BusFactory.setThreadDefaultBus(bus);
        final QName serviceName = new QName("http://www.jboss.org/jbossws/ws-extensions/wssecuritypolicy", "SecurityService");
        final URL wsdlURL = new URL(serviceURL + "SecurityService?wsdl");
        Service service = Service.create(wsdlURL, serviceName);
        ServiceIface proxy = (ServiceIface) service.getPort(ServiceIface.class);
        WSTrustTestUtils.setupWsse(proxy, bus);
        try {
            assertEquals("WS-Trust Hello World!", proxy.sayHello());
        } catch (Exception e) {
            throw CryptoCheckHelper.checkAndWrapException(e);
        }
    } finally {
        bus.shutdown(true);
    }
}
Also used : Bus(org.apache.cxf.Bus) ServiceIface(org.jboss.test.ws.jaxws.samples.wsse.policy.trust.service.ServiceIface) ActAsServiceIface(org.jboss.test.ws.jaxws.samples.wsse.policy.trust.actas.ActAsServiceIface) OnBehalfOfServiceIface(org.jboss.test.ws.jaxws.samples.wsse.policy.trust.onbehalfof.OnBehalfOfServiceIface) QName(javax.xml.namespace.QName) Service(javax.xml.ws.Service) URL(java.net.URL) OperateOnDeployment(org.jboss.arquillian.container.test.api.OperateOnDeployment) 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 99 with RunAsClient

use of org.jboss.arquillian.container.test.api.RunAsClient in project jbossws-cxf by jbossws.

the class WSTrustTestCase method testOnBehalfOf.

/**
 *  Request a security token that allows it to act on behalf of somebody else.
 *
 * @throws Exception
 */
@Test
@RunAsClient
@OperateOnDeployment(ON_BEHALF_OF_SERVER_DEP)
@WrapThreadContextClassLoader
public void testOnBehalfOf() throws Exception {
    Bus bus = BusFactory.newInstance().createBus();
    try {
        BusFactory.setThreadDefaultBus(bus);
        final QName serviceName = new QName("http://www.jboss.org/jbossws/ws-extensions/onbehalfofwssecuritypolicy", "OnBehalfOfService");
        final URL wsdlURL = new URL(serviceURL + "OnBehalfOfService?wsdl");
        Service service = Service.create(wsdlURL, serviceName);
        OnBehalfOfServiceIface proxy = (OnBehalfOfServiceIface) service.getPort(OnBehalfOfServiceIface.class);
        /* TODO explain why this is not needed for setup and then remove
         final QName stsServiceName = new QName("http://docs.oasis-open.org/ws-sx/ws-trust/200512/", "SecurityTokenService");
         final QName stsPortName = new QName("http://docs.oasis-open.org/ws-sx/ws-trust/200512/", "UT_Port");
         */
        WSTrustTestUtils.setupWsseAndSTSClientOnBehalfOf((BindingProvider) proxy, bus);
        assertEquals("OnBehalfOf WS-Trust Hello World!", proxy.sayHello(getServerHost(), String.valueOf(getServerPort())));
    } finally {
        bus.shutdown(true);
    }
}
Also used : Bus(org.apache.cxf.Bus) QName(javax.xml.namespace.QName) Service(javax.xml.ws.Service) OnBehalfOfServiceIface(org.jboss.test.ws.jaxws.samples.wsse.policy.trust.onbehalfof.OnBehalfOfServiceIface) URL(java.net.URL) OperateOnDeployment(org.jboss.arquillian.container.test.api.OperateOnDeployment) 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 100 with RunAsClient

use of org.jboss.arquillian.container.test.api.RunAsClient in project jbossws-cxf by jbossws.

the class WSTrustTestCase method testActAs.

/**
 *  Request a security token that allows it to act as if it were somebody else.
 *
 * @throws Exception
 */
@Test
@RunAsClient
@OperateOnDeployment(ACT_AS_SERVER_DEP)
@WrapThreadContextClassLoader
public void testActAs() throws Exception {
    Bus bus = BusFactory.newInstance().createBus();
    try {
        BusFactory.setThreadDefaultBus(bus);
        final QName serviceName = new QName("http://www.jboss.org/jbossws/ws-extensions/actaswssecuritypolicy", "ActAsService");
        final URL wsdlURL = new URL(serviceURL + "ActAsService?wsdl");
        Service service = Service.create(wsdlURL, serviceName);
        ActAsServiceIface proxy = (ActAsServiceIface) service.getPort(ActAsServiceIface.class);
        WSTrustTestUtils.setupWsseAndSTSClientActAs((BindingProvider) proxy, bus);
        assertEquals("ActAs WS-Trust Hello World!", proxy.sayHello(getServerHost(), String.valueOf(getServerPort())));
    } finally {
        bus.shutdown(true);
    }
}
Also used : Bus(org.apache.cxf.Bus) ActAsServiceIface(org.jboss.test.ws.jaxws.samples.wsse.policy.trust.actas.ActAsServiceIface) QName(javax.xml.namespace.QName) Service(javax.xml.ws.Service) URL(java.net.URL) OperateOnDeployment(org.jboss.arquillian.container.test.api.OperateOnDeployment) 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

RunAsClient (org.jboss.arquillian.container.test.api.RunAsClient)878 Test (org.junit.Test)862 URL (java.net.URL)492 JBossWSTest (org.jboss.wsf.test.JBossWSTest)410 QName (javax.xml.namespace.QName)289 UserVO (org.olat.user.restapi.UserVO)260 Service (javax.xml.ws.Service)254 UserRestClient (org.olat.test.rest.UserRestClient)254 LoginPage (org.olat.selenium.page.LoginPage)116 NavigationPage (org.olat.selenium.page.NavigationPage)112 CoursePageFragment (org.olat.selenium.page.course.CoursePageFragment)102 File (java.io.File)99 QTI21Page (org.olat.selenium.page.qti.QTI21Page)96 CourseEditorPageFragment (org.olat.selenium.page.course.CourseEditorPageFragment)86 OperateOnDeployment (org.jboss.arquillian.container.test.api.OperateOnDeployment)82 WebElement (org.openqa.selenium.WebElement)78 UserToolsPage (org.olat.selenium.page.user.UserToolsPage)60 QTI21EditorPage (org.olat.selenium.page.qti.QTI21EditorPage)46 Bus (org.apache.cxf.Bus)44 HashMap (java.util.HashMap)41