VistALink v1.6

gov.va.med.vistalink.security
Class CallbackHandlerUnitTest

java.lang.Object
  extended by gov.va.med.vistalink.security.CallbackHandlerUnitTest
All Implemented Interfaces:
javax.security.auth.callback.CallbackHandler

public final class CallbackHandlerUnitTest
extends java.lang.Object

Implements the JAAS CallbackHandler interface. Use with the VistaLoginModule to invoke a silent signon. Intended for use in unit testing environments where logins must be called repetitively without user interaction. Not for use in production environments, where users should be interactively prompted for signon credentials.

  1. Pass access code, verify code and division as parameters when you create an instance of this callback handler.
  2. Pass the instance of the callback handler to the login context when you create the login context.
  3. Then, when VistaLoginModule'slogin method (via the indirection of the LoginContext) invokes this callback handler to collect user input for (access code, verify code, select division), these values are already present and are handed back to the login module without any user interation.
For example:

String cfgName = "RpcSampleServer";
String accessCode = "joe.123";
String verifyCode = "ebony.23";
String division = "";

// create the callbackhandler for JAAS login
CallbackHandlerUnitTest cbhSilentSimple =
new CallbackHandlerUnitTest(accessCode, verifyCode, division);

// create the JAAS LoginContext for login
lc = new LoginContext(cfgName, cbhSilentSimple);

// login to server
lc.login();

See Also:
VistaLoginModule

Constructor Summary
CallbackHandlerUnitTest(java.lang.String accessCode, java.lang.String verifyCode, java.lang.String divisionIen)
          Creates a simple callback handler that handles the callbacks for logon.
CallbackHandlerUnitTest(java.lang.String accessCode, java.lang.String oldVerifyCode, java.lang.String divisionIen, java.lang.String newVerifyCode, java.lang.String newVerifyCodeCheck)
          Creates a simple callback handler that handles the callbacks for logon.
 
Method Summary
 void handle(javax.security.auth.callback.Callback[] arg0)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CallbackHandlerUnitTest

public CallbackHandlerUnitTest(java.lang.String accessCode,
                               java.lang.String verifyCode,
                               java.lang.String divisionIen)
Creates a simple callback handler that handles the callbacks for logon.

Parameters:
accessCode - Access Code to use for logon
verifyCode - Verify Code to use for logon
divisionIen - IEN of division to select for multidivisional logins. If not needed, pass an empty string.

CallbackHandlerUnitTest

public CallbackHandlerUnitTest(java.lang.String accessCode,
                               java.lang.String oldVerifyCode,
                               java.lang.String divisionIen,
                               java.lang.String newVerifyCode,
                               java.lang.String newVerifyCodeCheck)
Creates a simple callback handler that handles the callbacks for logon. Will change verify code as part of login.

Parameters:
accessCode - Access Code to use for logon
oldVerifyCode - Verify Code to use for logon
divisionIen - IEN of division to select for multidivisional logins. If not needed, pass an empty string.
newVerifyCode - new verify code to change
newVerifyCodeCheck - should be the same as newVerifyCode, to be successful. Used as a check.
Method Detail

handle

public void handle(javax.security.auth.callback.Callback[] arg0)
            throws javax.security.auth.callback.UnsupportedCallbackException
Specified by:
handle in interface javax.security.auth.callback.CallbackHandler
Throws:
javax.security.auth.callback.UnsupportedCallbackException

VistALink v1.6

VistALink v1.6