Search in sources :

Example 6 with ClientCallbackHandler

use of org.jboss.test.ws.jaxws.samples.wsse.policy.trust.shared.ClientCallbackHandler in project jbossws-cxf by jbossws.

the class WSTrustTestUtils method setupWsseAndSTSClientOnBehalfOf.

/**
 * Request a security token that allows it to act on the behalf of somebody else.
 *
 * @param proxy
 * @param bus
 */
public static void setupWsseAndSTSClientOnBehalfOf(BindingProvider proxy, Bus bus) {
    Map<String, Object> ctx = proxy.getRequestContext();
    ctx.put(SecurityConstants.CALLBACK_HANDLER, new ClientCallbackHandler());
    ctx.put(SecurityConstants.ENCRYPT_PROPERTIES, Thread.currentThread().getContextClassLoader().getResource("META-INF/clientKeystore.properties"));
    ctx.put(SecurityConstants.ENCRYPT_USERNAME, "myactaskey");
    ctx.put(SecurityConstants.SIGNATURE_PROPERTIES, Thread.currentThread().getContextClassLoader().getResource("META-INF/clientKeystore.properties"));
    ctx.put(SecurityConstants.SIGNATURE_USERNAME, "myclientkey");
    ctx.put(SecurityConstants.USERNAME, "alice");
    ctx.put(SecurityConstants.PASSWORD, "clarinet");
    STSClient stsClient = new STSClient(bus);
    stsClient.setOnBehalfOf(new UsernameTokenCallbackHandler());
    Map<String, Object> props = stsClient.getProperties();
    props.put(SecurityConstants.CALLBACK_HANDLER, new ClientCallbackHandler());
    props.put(SecurityConstants.ENCRYPT_PROPERTIES, Thread.currentThread().getContextClassLoader().getResource("META-INF/clientKeystore.properties"));
    props.put(SecurityConstants.ENCRYPT_USERNAME, "mystskey");
    props.put(SecurityConstants.STS_TOKEN_USERNAME, "myclientkey");
    props.put(SecurityConstants.STS_TOKEN_PROPERTIES, Thread.currentThread().getContextClassLoader().getResource("META-INF/clientKeystore.properties"));
    props.put(SecurityConstants.STS_TOKEN_USE_CERT_FOR_KEYINFO, "true");
    ctx.put(SecurityConstants.STS_CLIENT, stsClient);
}
Also used : STSClient(org.apache.cxf.ws.security.trust.STSClient) ClientCallbackHandler(org.jboss.test.ws.jaxws.samples.wsse.policy.trust.shared.ClientCallbackHandler) UsernameTokenCallbackHandler(org.jboss.test.ws.jaxws.samples.wsse.policy.trust.shared.UsernameTokenCallbackHandler)

Example 7 with ClientCallbackHandler

use of org.jboss.test.ws.jaxws.samples.wsse.policy.trust.shared.ClientCallbackHandler in project jbossws-cxf by jbossws.

the class WSTrustTestUtils method setupWsseAndSTSClientHolderOfKey.

public static void setupWsseAndSTSClientHolderOfKey(BindingProvider proxy, Bus bus) {
    Map<String, Object> ctx = proxy.getRequestContext();
    STSClient stsClient = new STSClient(bus);
    ctx.put(SecurityConstants.CALLBACK_HANDLER, new ClientCallbackHandler());
    ctx.put(SecurityConstants.SIGNATURE_PROPERTIES, Thread.currentThread().getContextClassLoader().getResource("META-INF/clientKeystore.properties"));
    ctx.put(SecurityConstants.ENCRYPT_PROPERTIES, Thread.currentThread().getContextClassLoader().getResource("META-INF/clientKeystore.properties"));
    ctx.put(SecurityConstants.SIGNATURE_USERNAME, "myclientkey");
    ctx.put(SecurityConstants.ENCRYPT_USERNAME, "myservicekey");
    ctx.put(appendIssuedTokenSuffix(SecurityConstants.USERNAME), "alice");
    ctx.put(appendIssuedTokenSuffix(SecurityConstants.CALLBACK_HANDLER), new ClientCallbackHandler());
    ctx.put(appendIssuedTokenSuffix(SecurityConstants.ENCRYPT_PROPERTIES), Thread.currentThread().getContextClassLoader().getResource("META-INF/clientKeystore.properties"));
    ctx.put(appendIssuedTokenSuffix(SecurityConstants.ENCRYPT_USERNAME), "mystskey");
    ctx.put(appendIssuedTokenSuffix(SecurityConstants.STS_TOKEN_USERNAME), "myclientkey");
    ctx.put(appendIssuedTokenSuffix(SecurityConstants.STS_TOKEN_PROPERTIES), Thread.currentThread().getContextClassLoader().getResource("META-INF/clientKeystore.properties"));
    ctx.put(appendIssuedTokenSuffix(SecurityConstants.STS_TOKEN_USE_CERT_FOR_KEYINFO), "true");
    ctx.put(SecurityConstants.STS_CLIENT, stsClient);
}
Also used : STSClient(org.apache.cxf.ws.security.trust.STSClient) ClientCallbackHandler(org.jboss.test.ws.jaxws.samples.wsse.policy.trust.shared.ClientCallbackHandler)

Example 8 with ClientCallbackHandler

use of org.jboss.test.ws.jaxws.samples.wsse.policy.trust.shared.ClientCallbackHandler in project jbossws-cxf by jbossws.

the class WSTrustTestUtils method setServiceContextAttributes.

private static void setServiceContextAttributes(Map<String, Object> ctx) {
    ctx.put(SecurityConstants.CALLBACK_HANDLER, new ClientCallbackHandler());
    ctx.put(SecurityConstants.SIGNATURE_PROPERTIES, Thread.currentThread().getContextClassLoader().getResource("META-INF/clientKeystore.properties"));
    ctx.put(SecurityConstants.ENCRYPT_PROPERTIES, Thread.currentThread().getContextClassLoader().getResource("META-INF/clientKeystore.properties"));
    ctx.put(SecurityConstants.SIGNATURE_USERNAME, "myclientkey");
    ctx.put(SecurityConstants.ENCRYPT_USERNAME, "myservicekey");
}
Also used : ClientCallbackHandler(org.jboss.test.ws.jaxws.samples.wsse.policy.trust.shared.ClientCallbackHandler)

Aggregations

ClientCallbackHandler (org.jboss.test.ws.jaxws.samples.wsse.policy.trust.shared.ClientCallbackHandler)8 STSClient (org.apache.cxf.ws.security.trust.STSClient)5 BindingProvider (javax.xml.ws.BindingProvider)2 UsernameTokenCallbackHandler (org.jboss.test.ws.jaxws.samples.wsse.policy.trust.shared.UsernameTokenCallbackHandler)2