VistALink v1.5.0.026

gov.va.med.vistalink.security
Class CallbackHandlerSwingCCOW

java.lang.Object
  extended bygov.va.med.vistalink.security.CallbackHandlerBase
      extended bygov.va.med.vistalink.security.CallbackHandlerSwing
          extended bygov.va.med.vistalink.security.CallbackHandlerSwingCCOW
All Implemented Interfaces:
javax.security.auth.callback.CallbackHandler

public class CallbackHandlerSwingCCOW
extends CallbackHandlerSwing

Implements the JAAS CallbackHandler interface. Use with the VistaLoginModule to invoke a Swing-based interactive logon, using the CCOW-enabled features of the VistaLink login module. If user authentication is required (if a valid user context does not exist that can be leveraged for single signon), input values (access code, verify code, division selection, and other "user input") are collected via a set of Swing GUI dialogs by this callback handler.

To login:

  1. Create a CCOW context module and broker. Must be securely bound to the context with a secure application passcode.
  2. Create an instance of CallbackHandlerSwing, passing the Frame window parent, the context module and broker.
  3. Create the JAAS LoginContext instance, passing the instance of the callback handler as one of the parameters.
  4. Invoke the JAAS login context's login method. The callback handler will invoke Swing dialogs to collect user input wherever required for login.
For example:

// use HDS classes to create context broker, module
private IClinicalContextBroker ccowContextBroker;
private ContextModule ccowContextModule;
// create new Context Module with HDS library call
ccowContextModule = new ContextModule(CCOW_APPLICATION_NAME, CCOW_APPLICATION_PASSCODE);
// create context participant (a class that implements HDS IContextObserver,
// IContextParticipant interfaces)
sampleAppContextParticipant = new SampleAppContextParticipant();

try { // connect to CCOW context
if (ccowContextModule != null) {
ccowContextBroker = ccowContextModule.getBroker(this, sampleAppContextParticipant);
}
// create the callback handler
CallbackHandlerSwingCCOW cbhSwing = new CallbackHandlerSwingCCOW(this.topFrame, this.ccowContextModule,
this.ccowContextBroker);
// create the LoginContext
loginContext = new LoginContext(jaasConfigName, cbhSwing);
// login to server
loginContext.login();
// get principal
userPrincipal = VistaKernelPrincipalImpl.getKernelPrincipal(loginContext.getSubject());
// set the app's VistaLink 'connected' status to connected.
if ((ccowContextBroker != null) && (ccowContextBroker.isConnected())) {
storeUserContextState();
}
} catch (Exception e) {
JOptionPane.showMessageDialog(topFrame, e.getMessage(), "Login error", JOptionPane.ERROR_MESSAGE);
statusLabel.setText(STATUS_LABEL_DISCONNECTED_TEXT);
gracefulLogout(-1);
}

Version:
1.5.0.026
Author:
Application Modernization - Foundations Team
See Also:
VistaLoginModule

Field Summary
static java.lang.String VHA_CCOW_LOGON_DOMAIN
          The VistA Domain.
static java.lang.String VHA_CCOW_LOGON_NAME
          The user context location under which the user name is stored.
static java.lang.String VHA_CCOW_LOGON_NAME_GENERIC
          The non-VA-specific generic user context location under which the user name is stored.
static java.lang.String VHA_CCOW_LOGON_TOKEN
          The user context location under which the Kernel token is stored.
static java.lang.String VHA_CCOW_LOGON_VPID
          The user context location under which the VPID is stored.
static java.lang.String[] VHA_CCOW_USER_CONTEXT_KEYS
          Array containing the complete set of VHA user context keys.
 
Constructor Summary
CallbackHandlerSwingCCOW(java.awt.Frame windowParent, gov.va.med.hds.cd.ccow.IContextModule applicationCcowContextModule, gov.va.med.hds.cd.ccow.IClinicalContextBroker applicationCcowContextBroker)
          Creates a callback handler for VistaLink logins, using a SWING interface, and using the CCOW-enabled features of VistaLink to provide a CCOW-enabled login.
 
Method Summary
static boolean hasNonNullUserContext(java.util.Map contextItems)
          returns whether the context contains at least one user context item.
 
Methods inherited from class gov.va.med.vistalink.security.CallbackHandlerSwing
handle
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

VHA_CCOW_LOGON_TOKEN

public static final java.lang.String VHA_CCOW_LOGON_TOKEN
The user context location under which the Kernel token is stored.

See Also:
Constant Field Values

VHA_CCOW_LOGON_NAME

public static final java.lang.String VHA_CCOW_LOGON_NAME
The user context location under which the user name is stored.

See Also:
Constant Field Values

VHA_CCOW_LOGON_NAME_GENERIC

public static final java.lang.String VHA_CCOW_LOGON_NAME_GENERIC
The non-VA-specific generic user context location under which the user name is stored.

See Also:
Constant Field Values

VHA_CCOW_LOGON_VPID

public static final java.lang.String VHA_CCOW_LOGON_VPID
The user context location under which the VPID is stored.

See Also:
Constant Field Values

VHA_CCOW_LOGON_DOMAIN

public static final java.lang.String VHA_CCOW_LOGON_DOMAIN
The VistA Domain.

See Also:
Constant Field Values

VHA_CCOW_USER_CONTEXT_KEYS

public static final java.lang.String[] VHA_CCOW_USER_CONTEXT_KEYS
Array containing the complete set of VHA user context keys. VPID key not yet supported.

Constructor Detail

CallbackHandlerSwingCCOW

public CallbackHandlerSwingCCOW(java.awt.Frame windowParent,
                                gov.va.med.hds.cd.ccow.IContextModule applicationCcowContextModule,
                                gov.va.med.hds.cd.ccow.IClinicalContextBroker applicationCcowContextBroker)
Creates a callback handler for VistaLink logins, using a SWING interface, and using the CCOW-enabled features of VistaLink to provide a CCOW-enabled login.

Parameters:
windowParent - The parent application window, used for centering login dialogs.
applicationCcowContextModule - the application's CCOW context module the login module should use to read the CCOW context
applicationCcowContextBroker - the application's CCOW context broker the login module should use to read the CCOW context
Method Detail

hasNonNullUserContext

public static boolean hasNonNullUserContext(java.util.Map contextItems)
returns whether the context contains at least one user context item.

Parameters:
contextItems - Map of context items representing a context
Returns:
true if the context has at least one non-null user context key/value pair

VistALink v1.5.0.026

VistALink v1.5.0.026