VLJ Iteration II, v. 1.0.0.193

gov.va.med.foundations.security.vistalink
Class VistaLoginModule

java.lang.Object
  |
  +--gov.va.med.foundations.security.vistalink.VistaLoginModule
All Implemented Interfaces:
javax.security.auth.spi.LoginModule

public final class VistaLoginModule
extends java.lang.Object
implements javax.security.auth.spi.LoginModule

A JAAS-compliant LoginModule to log users on to a Vista system. An application never needs to access the VistaLoginModule class directly. Rather, as a JAAS login module, its methods are invoked indirectly by an application through the JAAS login context class (javax.security.auth.login.LoginContext).

The key classes for invoking a login with this login module are:

An example login:
 String jaasCfgName = "RpcSampleServer";
 
 // create the callback handler
 CallbackHandlerSwing cbhSwing = new CallbackHandlerSwing(myFrame);
 
 // create the LoginContext
 loginContext = new LoginContext(jaasCfgName, cbhSwing);
 
 // login to server
 loginContext.login(); 
 
 
An example logout:
 // logout of the server
 loginContext.logout();
 

Version:
1.0.0.193
Author:
Application Modernization - Foundations Team
See Also:
CallbackHandlerSwing, CallbackHandlerUnitTest, VistaKernelPrincipal, VistaKernelPrincipalImpl

Field Summary
static java.lang.String SERVER_ADDRESS_KEY
          map key to store/retrieve server IP address for the VistaLoginModule configuration option map.
static java.lang.String SERVER_PORT_KEY
          map key to store/retrieve server port for the VistaLoginModule configuration option map.
 
Constructor Summary
VistaLoginModule()
           
 
Method Summary
 boolean abort()
          Should never be called by an application directly.
 boolean commit()
          Should never be called by an application directly.
 void initialize(javax.security.auth.Subject subject, javax.security.auth.callback.CallbackHandler callbackHandler, java.util.Map sharedState, java.util.Map options)
          Should never be called by an application directly.
 boolean login()
          Should never be called by an application directly.
 boolean logout()
          Should never be called by an application directly.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SERVER_ADDRESS_KEY

public static final java.lang.String SERVER_ADDRESS_KEY
map key to store/retrieve server IP address for the VistaLoginModule configuration option map. You need these keys to pass login options from a JAAS configuration to the VistaLoginModule. Use the values of these keys as the keys in which to set the server IP address and server port into the configuration options that are passed back to VistaLoginModule.

See Also:
Constant Field Values

SERVER_PORT_KEY

public static final java.lang.String SERVER_PORT_KEY
map key to store/retrieve server port for the VistaLoginModule configuration option map. You need these keys to pass login options from a JAAS configuration to the VistaLoginModule. Use the values of these keys as the keys in which to set the server IP address and server port into the configuration options that are passed back to VistaLoginModule.

See Also:
Constant Field Values
Constructor Detail

VistaLoginModule

public VistaLoginModule()
Method Detail

initialize

public void initialize(javax.security.auth.Subject subject,
                       javax.security.auth.callback.CallbackHandler callbackHandler,
                       java.util.Map sharedState,
                       java.util.Map options)
Should never be called by an application directly. Instead, this method is invoked behind the scenes by the proxy of the JAAS LoginContext.

Part of the JAAS interface for a login module; initializes the login module.

Specified by:
initialize in interface javax.security.auth.spi.LoginModule
Parameters:
subject - the subject to be authenticated.
callbackHandler - a callback handler for communicating with the end user. The VistaLoginModule login module does not make use of this.
sharedState - state shared with other configuration login modules. Not used by the VistaLoginModule login module.
options - This is where the configuration options passed to the LoginContext are then passed to the LoginModule.

login

public boolean login()
              throws VistaLoginModuleException,
                     VistaLoginModuleLoginsDisabledException,
                     VistaLoginModuleNoJobSlotsAvailableException,
                     VistaLoginModuleNoPathToListenerException,
                     VistaLoginModuleTooManyInvalidAttemptsException,
                     VistaLoginModuleUserCancelledException,
                     VistaLoginModuleUserTimedOutException
Should never be called by an application directly. Instead, this method is invoked behind the scenes by the proxy of the JAAS LoginContext.

When an application invokes login() on the LoginContext, the LoginContext calls this method to initiate a login to a VistaLink M server. Once a successful login has occurred, the authenticated connection will be stored in the JAAS subject, in a VistaKernelPrincipal.

Specified by:
login in interface javax.security.auth.spi.LoginModule
Returns:
true if the authentication succeeded, or false if this LoginModule should be ignored.
Throws:
VistaLoginModuleException - a VistaLoginModuleException is thrown if the login for this module fails.
VistaLoginModuleLoginsDisabledException - thrown if logins are disabled
VistaLoginModuleNoJobSlotsAvailableException - thrown if no job slots are available
VistaLoginModuleNoPathToListenerException - thrown if the specified listener can't be reached
VistaLoginModuleTooManyInvalidAttemptsException - thrown if too many bad login attempts are made
VistaLoginModuleUserCancelledException - thrown if user cancels the login
VistaLoginModuleUserTimedOutException - thrown if user times out of the login

commit

public boolean commit()
               throws javax.security.auth.login.LoginException
Should never be called by an application directly. Instead, this method is invoked behind the scenes by the proxy of the JAAS LoginContext.

Part of the JAAS interface for a login module. Since we don't have a two-phase login, this always returns true (and is irrelevant to the success or failure of a login).

Specified by:
commit in interface javax.security.auth.spi.LoginModule
Returns:
this implementation of commit() always returns true.
Throws:
javax.security.auth.login.LoginException - this is never thrown by this implementation of commit().

abort

public boolean abort()
              throws VistaLoginModuleException
Should never be called by an application directly. Instead, this method is invoked behind the scenes by the proxy of the JAAS LoginContext.

Part of the JAAS interface for a login module. This loginmodule's implementation of this method calls M to cleanly shut down the connection to M. If we were to support an environment with multiple login modules, and the login for one of them failed, this method would be called to do any cleanup to back out of a partial login, which in the case of VistaLink, means clean up/tear down the existing connection to M.

Specified by:
abort in interface javax.security.auth.spi.LoginModule
Returns:
true if cleanup/logout on the M side succeeded
Throws:
VistaLoginModuleException - thrown if logging out on the M side fails.

logout

public boolean logout()
               throws VistaLoginModuleException
Should never be called by an application directly. Instead, this method is invoked behind the scenes by the proxy of the JAAS LoginContext.

For applications to call, to logout a user from an open connection/session to a VistaLink M server. Doing this drops the connection, freeing up resources on the M server.

Specified by:
logout in interface javax.security.auth.spi.LoginModule
Returns:
true if the logout was successful
Throws:
VistaLoginModuleException - thrown if the logout fails on the M side.

VLJ Iteration II, v. 1.0.0.193

VistaLink Iteration II, v. 1.0.0.193