use of org.jboss.arquillian.container.test.api.RunAsClient 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"));
}
use of org.jboss.arquillian.container.test.api.RunAsClient 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);
}
}
use of org.jboss.arquillian.container.test.api.RunAsClient 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);
}
}
use of org.jboss.arquillian.container.test.api.RunAsClient 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"));
}
use of org.jboss.arquillian.container.test.api.RunAsClient in project jbossws-cxf by jbossws.
the class WSSecurityPolicyExamples23xTestCase method test2324.
/**
* 2.3.2.4 (WSS1.1) SAML1.1/2.0 Sender Vouches with X.509 Certificate, Sign, Encrypt
*
* @throws Exception
*/
@Test
@RunAsClient
@WrapThreadContextClassLoader
public void test2324() throws Exception {
Service service = Service.create(new URL(serviceURL + "SecurityService2324?wsdl"), serviceName);
ServiceIface proxy = (ServiceIface) service.getPort(new QName(NS, "SecurityService2324Port"), ServiceIface.class);
Map<String, Object> reqCtx = ((BindingProvider) proxy).getRequestContext();
SamlCallbackHandler cbh = new SamlCallbackHandler();
cbh.setConfirmationMethod("urn:oasis:names:tc:SAML:1.0:cm:sender-vouches");
reqCtx.put(SecurityConstants.SAML_CALLBACK_HANDLER, cbh);
reqCtx.put(SecurityConstants.CALLBACK_HANDLER, new KeystorePasswordCallback());
reqCtx.put(SecurityConstants.SIGNATURE_PROPERTIES, Thread.currentThread().getContextClassLoader().getResource("META-INF/alice.properties"));
reqCtx.put(SecurityConstants.ENCRYPT_PROPERTIES, Thread.currentThread().getContextClassLoader().getResource("META-INF/alice.properties"));
reqCtx.put(SecurityConstants.SIGNATURE_USERNAME, "alice");
reqCtx.put(SecurityConstants.ENCRYPT_USERNAME, "bob");
try {
assertTrue(proxy.sayHello().equals("Hello - (WSS1.1) SAML1.1/2.0 Sender Vouches with X.509 Certificate, Sign, Encrypt"));
} catch (Exception e) {
throw CryptoCheckHelper.checkAndWrapException(e);
}
}
Aggregations