* @throws WSSecurityException
*/
public void retrieveServiceTicket(
CallbackHandler callbackHandler
) throws WSSecurityException {
KerberosContextAndServiceNameCallback contextAndServiceNameCallback = new KerberosContextAndServiceNameCallback();
try {
callbackHandler.handle(new Callback[]{contextAndServiceNameCallback});
} catch (IOException e) {
throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, e);
} catch (UnsupportedCallbackException e) {
throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, e);
}
String jaasLoginModuleName = contextAndServiceNameCallback.getContextName();
if (jaasLoginModuleName == null) {
throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, "kerberosCallbackContextNameNotSupplied");
}
String serviceName = contextAndServiceNameCallback.getServiceName();
if (serviceName == null) {
throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, "kerberosCallbackServiceNameNotSupplied");
}
retrieveServiceTicket(jaasLoginModuleName, callbackHandler, serviceName);