Search in sources :

Example 1 with ClientCallbackHandler

use of org.jboss.as.test.integration.ws.wsse.trust.shared.ClientCallbackHandler in project wildfly by wildfly.

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.as.test.integration.ws.wsse.trust.shared.ClientCallbackHandler)

Example 2 with ClientCallbackHandler

use of org.jboss.as.test.integration.ws.wsse.trust.shared.ClientCallbackHandler in project wildfly by wildfly.

the class WSTrustTestUtils method setupWsseAndSTSClientActAs.

/**
     * Request a security token that allows it to act as if it were somebody else.
     *
     * @param proxy
     * @param bus
     */
public static void setupWsseAndSTSClientActAs(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");
    UsernameTokenCallbackHandler ch = new UsernameTokenCallbackHandler();
    String str = ch.getUsernameTokenString("alice", "clarinet");
    ctx.put(SecurityConstants.STS_TOKEN_ACT_AS, str);
    STSClient stsClient = new STSClient(bus);
    Map<String, Object> props = stsClient.getProperties();
    props.put(SecurityConstants.USERNAME, "bob");
    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.as.test.integration.ws.wsse.trust.shared.ClientCallbackHandler) UsernameTokenCallbackHandler(org.jboss.as.test.integration.ws.wsse.trust.shared.UsernameTokenCallbackHandler)

Example 3 with ClientCallbackHandler

use of org.jboss.as.test.integration.ws.wsse.trust.shared.ClientCallbackHandler in project wildfly by wildfly.

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.as.test.integration.ws.wsse.trust.shared.ClientCallbackHandler)

Example 4 with ClientCallbackHandler

use of org.jboss.as.test.integration.ws.wsse.trust.shared.ClientCallbackHandler in project wildfly by wildfly.

the class WSTrustTestUtils method setupWsse.

public static void setupWsse(ServiceIface proxy, Bus bus) {
    Map<String, Object> ctx = ((BindingProvider) proxy).getRequestContext();
    setServiceContextAttributes(ctx);
    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");
}
Also used : ClientCallbackHandler(org.jboss.as.test.integration.ws.wsse.trust.shared.ClientCallbackHandler) BindingProvider(javax.xml.ws.BindingProvider)

Example 5 with ClientCallbackHandler

use of org.jboss.as.test.integration.ws.wsse.trust.shared.ClientCallbackHandler in project wildfly by wildfly.

the class WSTrustTestUtils method setupWsseAndSTSClientNoSignatureUsername.

/**
     * Uses the SIGNATURE_PROPERTIES keystore's  "alias name" as the SIGNATURE_USERNAME when
     * USERNAME and SIGNATURE_USERNAME is not provided.
     *
     * @param proxy
     * @param bus
     * @param stsWsdlLocation
     * @param stsService
     * @param stsPort
     * @see org.apache.cxf.ws.security.SecurityConstants#SIGNATURE_PROPERTIES
     */
public static void setupWsseAndSTSClientNoSignatureUsername(ServiceIface proxy, Bus bus, String stsWsdlLocation, QName stsService, QName stsPort) {
    Map<String, Object> ctx = ((BindingProvider) proxy).getRequestContext();
    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.ENCRYPT_USERNAME, "myservicekey");
    ctx.put(SecurityConstants.STS_CLIENT, createSTSClient(bus, stsWsdlLocation, stsService, stsPort));
}
Also used : ClientCallbackHandler(org.jboss.as.test.integration.ws.wsse.trust.shared.ClientCallbackHandler) BindingProvider(javax.xml.ws.BindingProvider)

Aggregations

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