issrg.security
Class GUICallbackHandler

java.lang.Object
  extended by issrg.security.GUICallbackHandler
All Implemented Interfaces:
javax.security.auth.callback.CallbackHandler

public class GUICallbackHandler
extends java.lang.Object
implements javax.security.auth.callback.CallbackHandler

This is a CallbackHandler that can display a dialog per each invocation of handle method. Therefore, it is possible to display a single dialog to collect all the necessary information in one go, or multiple dialogs can be displayed.

See JAAS documentation on details of the role of CallbackHandler in authentication process.

You will notice that PERMIS core does not use JAAS at all (no need to authenticate users - they are already authenticated). It is PERMIS utilities and tools that use the Callbacks to get the password to the PKCS#12 files or Java keystores. Note that they do not use the Callbacks in the purely JAAS way, since ultimately the access to the private keys is needed, and not just authentication of users is required; but the use of JAAS classes helps to build tools that do not depend on the type of interface available. This specifically caters for GUI-less environments, e.g. application servers.


Constructor Summary
GUICallbackHandler()
           
 
Method Summary
 void handle(javax.security.auth.callback.Callback[] callbacks)
          This is the implementation of the JAAS method to display a number of controls to collect user input, which is used in authentication.
 void setParentFrame(java.awt.Frame pf)
          This method sets the frame to which the dialogs will be modal.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GUICallbackHandler

public GUICallbackHandler()
Method Detail

setParentFrame

public void setParentFrame(java.awt.Frame pf)
This method sets the frame to which the dialogs will be modal.

Parameters:
pf - - the parent Frame; all dialogs will be modal to this Frame; if null is specified, then the dialog will be modal to the main window of the application

handle

public void handle(javax.security.auth.callback.Callback[] callbacks)
            throws javax.security.auth.callback.UnsupportedCallbackException
This is the implementation of the JAAS method to display a number of controls to collect user input, which is used in authentication. This method constructs a dialog box with a number of controls, determined by the types of Callbacks, and two control buttons: one to confirm the selections made by the user, one to cancel the dialog (all input is ignored). The dialog box is modal to the Frame set to be parent Frame of this GUICallbackHandler.

Because GUICallbackHandler caters for the specific purpose, it supports only some of the standard Callbacks, and all of the Callbacks defined by PERMIS. The following Callbacks are supported:

Note that each Callback may appear multiple times. For example, it is possible to prompt for multiple shares of the password to be input in the same dialog.

Specified by:
handle in interface javax.security.auth.callback.CallbackHandler
Parameters:
callbacks - - the array of Callbacks, each representing a control for user input, as specified in JAAS framework
Throws:
javax.security.auth.callback.UnsupportedCallbackException - if at least one of the Callbacks is not supported and cannot be displayed
See Also:
setParentFrame(java.awt.Frame)