VistALink v1.5.0.026

gov.va.med.vistalink.security
Class VistaLoginModule

java.lang.Object
  extended bygov.va.med.vistalink.security.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.5.0.026
Author:
Application Modernization - Foundations Team
See Also:
CallbackHandlerSwing, CallbackHandlerUnitTest, VistaKernelPrincipal, VistaKernelPrincipalImpl

Field Summary
static java.lang.String SERVER_ADDRESS_KEY
          JAAS configuration key to store/retrieve server IP address.
static java.lang.String SERVER_ADDRESS_KEY_V1
          JAAS configuration key to store/retrieve server IP address, in v1.0.
static java.lang.String SERVER_PORT_KEY
          JAAS configuration key to store/retrieve server port.
static java.lang.String SERVER_PORT_KEY_V1
          JAAS configuration key to store/retrieve server port, in v1.0.
static java.lang.String SERVER_SPI_KEY
          JAAS configuration key to store/retrieve the mode for providing back-end Kernel login services.
 
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
JAAS configuration key to store/retrieve server IP address. Use this key to pass in the value of this login option, from a JAAS configuration to the VistaLoginModule.

See Also:
Constant Field Values

SERVER_ADDRESS_KEY_V1

public static final java.lang.String SERVER_ADDRESS_KEY_V1
JAAS configuration key to store/retrieve server IP address, in v1.0. For backwards compatibility.

See Also:
Constant Field Values

SERVER_PORT_KEY

public static final java.lang.String SERVER_PORT_KEY
JAAS configuration key to store/retrieve server port. Use this key to pass in the value of this login option, from a JAAS configuration to the VistaLoginModule.

See Also:
Constant Field Values

SERVER_PORT_KEY_V1

public static final java.lang.String SERVER_PORT_KEY_V1
JAAS configuration key to store/retrieve server port, in v1.0. For backwards compatiblity.

See Also:
Constant Field Values

SERVER_SPI_KEY

public static final java.lang.String SERVER_SPI_KEY
JAAS configuration key to store/retrieve the mode for providing back-end Kernel login services. Valid values for the JAAS configuration: Use this key to pass in the value of this login option, from a JAAS configuration to the VistaLoginModule.

See Also:
Constant Field Values
Constructor Detail

VistaLoginModule

public VistaLoginModule()
 
NOT FOR PUBLIC USE
This constructor, method or field is not for public use.
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.
 
NOT FOR PUBLIC USE
This constructor, method or field is not for public use.

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
 
NOT FOR PUBLIC USE
This constructor, method or field is not for public use.

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().
 
NOT FOR PUBLIC USE
This constructor, method or field is not for public use.

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.
 
NOT FOR PUBLIC USE
This constructor, method or field is not for public use.

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.
 
NOT FOR PUBLIC USE
This constructor, method or field is not for public use.

VistALink v1.5.0.026

VistALink v1.5.0.026