/** * Get the username and password. This method does not return any value. Instead, it sets global * name and password variables. * * <p>Also note that this method will set the username and password values in the shared state in * case subsequent LoginModules want to use them via use/tryFirstPass. * * @param getPasswdFromSharedState boolean that tells this method whether to retrieve the password * from the sharedState. * @exception LoginException if the username/password cannot be acquired. */ private void getUsernamePassword(boolean getPasswdFromSharedState) throws LoginException { if (getPasswdFromSharedState) { // use the password saved by the first module in the stack username = (String) sharedState.get(USERNAME_KEY); password = (char[]) sharedState.get(PASSWORD_KEY); return; } // prompt for a username and password if (callbackHandler == null) throw new LoginException( "No CallbackHandler available " + "to acquire authentication information from the user"); Callback[] callbacks = new Callback[2]; callbacks[0] = new NameCallback(rb.getString("username: "******"password: "******"Error: " + uce.getCallback().toString() + " not available to acquire authentication information" + " from the user"); } }