Search in sources :

Example 1 with SimpleAuthorizingCallbackHandler

use of org.jgroups.auth.sasl.SimpleAuthorizingCallbackHandler in project JGroups by belaban.

the class SASL_SimpleAuthorizingCallbackTest method createChannel.

private JChannel createChannel(String channelName, String mech, String principal) throws Exception {
    Properties properties = new Properties();
    properties.put("sasl.local.principal", principal);
    properties.put("sasl.credentials.properties", credentialsFile.getAbsolutePath());
    properties.put("sasl.role", "mycluster");
    properties.put("sasl.roles.properties", rolesFile.getAbsolutePath());
    properties.put("sasl.realm", REALM);
    SASL sasl = new SASL();
    sasl.setMech(mech);
    sasl.setClientCallbackHandler(new SimpleAuthorizingCallbackHandler(properties));
    sasl.setServerCallbackHandler(new SimpleAuthorizingCallbackHandler(properties));
    sasl.setTimeout(5000);
    if (System.getProperty("java.vendor").contains("IBM")) {
        sasl.sasl_props.put("com.ibm.security.sasl.digest.realm", REALM);
    } else {
        sasl.sasl_props.put("com.sun.security.sasl.digest.realm", REALM);
    }
    return new JChannel(new Protocol[] { new SHARED_LOOPBACK(), new PING(), new NAKACK2(), new UNICAST3(), new STABLE(), sasl, new GMS() }).name(channelName);
}
Also used : NAKACK2(org.jgroups.protocols.pbcast.NAKACK2) JChannel(org.jgroups.JChannel) SimpleAuthorizingCallbackHandler(org.jgroups.auth.sasl.SimpleAuthorizingCallbackHandler) STABLE(org.jgroups.protocols.pbcast.STABLE) Properties(java.util.Properties) Protocol(org.jgroups.stack.Protocol) GMS(org.jgroups.protocols.pbcast.GMS)

Aggregations

Properties (java.util.Properties)1 JChannel (org.jgroups.JChannel)1 SimpleAuthorizingCallbackHandler (org.jgroups.auth.sasl.SimpleAuthorizingCallbackHandler)1 GMS (org.jgroups.protocols.pbcast.GMS)1 NAKACK2 (org.jgroups.protocols.pbcast.NAKACK2)1 STABLE (org.jgroups.protocols.pbcast.STABLE)1 Protocol (org.jgroups.stack.Protocol)1