use of org.apache.cxf.ws.security.trust.STSAuthParams in project cxf by apache.
the class STSTokenOutInterceptorTest method testBasicAsymmetricBinding.
@Test
public void testBasicAsymmetricBinding() throws Exception {
Bus bus = BusFactory.getThreadDefaultBus();
STSAuthParams authParams = new STSAuthParams(AuthMode.X509_ASSYMETRIC, null, "org.apache.cxf.systest.sts.common.CommonCallbackHandler", "mystskey", "clientKeystore.properties");
STSTokenOutInterceptor interceptor = new STSTokenOutInterceptor(authParams, "http://localhost:" + STSPORT2 + STS_X509_WSDL_LOCATION_RELATIVE, bus);
MessageImpl message = prepareMessage(bus, null, SERVICE_ENDPOINT_ASSYMETRIC);
interceptor.handleMessage(message);
SecurityToken token = (SecurityToken) message.getExchange().get(SecurityConstants.TOKEN);
validateSecurityToken(token);
}
use of org.apache.cxf.ws.security.trust.STSAuthParams in project cxf by apache.
the class STSTokenOutInterceptorTest method testBasicTransportBinding.
@Test
public void testBasicTransportBinding() throws Exception {
// Setup HttpsURLConnection to get STS WSDL
configureDefaultHttpsConnection();
Bus bus = BusFactory.getThreadDefaultBus();
STSAuthParams authParams = new STSAuthParams(AuthMode.UT_TRANSPORT, "alice", "org.apache.cxf.systest.sts.common.CommonCallbackHandler", null, null);
STSTokenOutInterceptor interceptor = new STSTokenOutInterceptor(authParams, "https://localhost:" + STSPORT + STS_TRANSPORT_WSDL_LOCATION_RELATIVE, bus);
TLSClientParameters tlsParams = prepareTLSParams();
STSClient stsClient = interceptor.getSTSClient();
((HTTPConduit) stsClient.getClient().getConduit()).setTlsClientParameters(tlsParams);
MessageImpl message = prepareMessage(bus, null, SERVICE_ENDPOINT_TRANSPORT);
interceptor.handleMessage(message);
SecurityToken token = (SecurityToken) message.getExchange().get(SecurityConstants.TOKEN);
validateSecurityToken(token);
}
Aggregations