public SaslServer createSaslServer(String mechanism, String localFQDN, Principal externalPrincipal) throws SaslException
{
CallbackHandler callbackHandler = _callbackHandlerMap.get(mechanism);
if(callbackHandler == null)
{
throw new SaslException("Unsupported mechanism: " + mechanism);
}
if(CRAMMD5Initialiser.MECHANISM.equals(mechanism))
{
//simply delegate to the built in CRAM-MD5 SaslServer
return Sasl.createSaslServer(mechanism, "AMQP", localFQDN, null, callbackHandler);
}
else if(PlainSaslServer.MECHANISM.equals(mechanism))
{
return new PlainSaslServer(callbackHandler);
}
else if(AmqPlainSaslServer.MECHANISM.equals(mechanism))
{
return new AmqPlainSaslServer(callbackHandler);
}
throw new SaslException("Unsupported mechanism: " + mechanism);
}