本文整理匯總了Java中javax.security.auth.callback.CallbackHandler.getClass方法的典型用法代碼示例。如果您正苦於以下問題:Java CallbackHandler.getClass方法的具體用法?Java CallbackHandler.getClass怎麽用?Java CallbackHandler.getClass使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javax.security.auth.callback.CallbackHandler
的用法示例。
在下文中一共展示了CallbackHandler.getClass方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: createSaslServer
import javax.security.auth.callback.CallbackHandler; //導入方法依賴的package包/類
@Override
public SaslServer createSaslServer(String mechanism, String protocol, String serverName, Map<String, ?> props,
CallbackHandler cbh) throws SaslException {
if (!(cbh instanceof PlainSaslCallbackHandler)) {
throw new SaslException(
"CallbackHandler must be of type of PlainSaslCallbackHandler, but received : " + cbh
.getClass());
}
return (PlainSaslServer.PLAIN_MECHANISM.equals(mechanism)) ?
new PlainSaslServer((PlainSaslCallbackHandler) cbh) :
null;
}
示例2: createSaslServer
import javax.security.auth.callback.CallbackHandler; //導入方法依賴的package包/類
@Override
public SaslServer createSaslServer(String mechanism, String protocol, String serverName, Map<String, ?> props, CallbackHandler cbh)
throws SaslException {
if (!PLAIN_MECHANISM.equals(mechanism))
throw new SaslException(String.format("Mechanism \'%s\' is not supported. Only PLAIN is supported.", mechanism));
if (!(cbh instanceof SaslServerCallbackHandler))
throw new SaslException("CallbackHandler must be of type SaslServerCallbackHandler, but it is: " + cbh.getClass());
return new PlainSaslServer(((SaslServerCallbackHandler) cbh).jaasContext());
}