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);
}
Aggregations