gov.va.med.foundations.security.vistalink
Class CallbackHandlerUnitTest
java.lang.Object
|
+--gov.va.med.foundations.security.vistalink.CallbackHandlerUnitTest
- All Implemented Interfaces:
- javax.security.auth.callback.CallbackHandler
- public final class CallbackHandlerUnitTest
- extends java.lang.Object
- implements javax.security.auth.callback.CallbackHandler
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.
- Pass access code, verify code and division as parameters when you create an instance of this callback
handler.
- Pass the instance of the callback handler to the login context when you create the login context.
- Then, when
VistaLoginModule
's login
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();
- Version:
- 1.0.0.193
- Author:
- Application Modernization - Foundations Team
- 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 (w/av code) and post-sign-in text only. |
Method Summary |
void |
handle(javax.security.auth.callback.Callback[] callbacks)
The LoginModule calls this method to process callbacks |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
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 (w/av code) and post-sign-in text only. It does not handle
callbacks for error, select division, or change verify code..
- Parameters:
accessCode
- Access Code to use for logonverifyCode
- Verify Code to use for logondivisionIen
- IEN of division to select for multidivisional logins. If not needed, pass ah empty string.
handle
public void handle(javax.security.auth.callback.Callback[] callbacks)
throws javax.security.auth.callback.UnsupportedCallbackException
- The LoginModule calls this method to process callbacks
- Specified by:
handle
in interface javax.security.auth.callback.CallbackHandler
javax.security.auth.callback.UnsupportedCallbackException
- See Also:
CallbackHandler.handle(Callback[])
VistaLink Iteration II, v. 1.0.0.193