protected void registerWithCallbackHandler(Principal userPrincipal, String username,
String password)
{
if(this.callbackHandler instanceof TomcatJASPICallbackHandler)
{
TomcatJASPICallbackHandler cbh = (TomcatJASPICallbackHandler) callbackHandler;
PasswordValidationCallback passwordValidationCallback =
new PasswordValidationCallback(null,username,password.toCharArray());
cbh.setPasswordValidationCallback(passwordValidationCallback);
cbh.setCallerPrincipalCallback(new CallerPrincipalCallback(null,userPrincipal));
}
else
throw new RuntimeException(" Unsupported Callback handler "
+ this.callbackHandler.getClass().getCanonicalName());
}