public boolean login() throws LoginException {
  try {
    loadPasswordFile();
  }
 catch (  IOException ioe) {
    LoginException le=new LoginException("Error: unable to load the password file: " + passwordFileDisplayName);
    throw EnvHelp.initCause(le,ioe);
  }
  if (userCredentials == null) {
    throw new LoginException("Error: unable to locate the users' credentials.");
  }
  if (logger.debugOn()) {
    logger.debug("login","Using password file: " + passwordFileDisplayName);
  }
  if (tryFirstPass) {
    try {
      attemptAuthentication(true);
      succeeded=true;
      if (logger.debugOn()) {
        logger.debug("login","Authentication using cached password has succeeded");
      }
      return true;
    }
 catch (    LoginException le) {
      cleanState();
      logger.debug("login","Authentication using cached password has failed");
    }
  }
 else   if (useFirstPass) {
    try {
      attemptAuthentication(true);
      succeeded=true;
      if (logger.debugOn()) {
        logger.debug("login","Authentication using cached password has succeeded");
      }
      return true;
    }
 catch (    LoginException le) {
      cleanState();
      logger.debug("login","Authentication using cached password has failed");
      throw le;
    }
  }
  if (logger.debugOn()) {
    logger.debug("login","Acquiring password");
  }
  try {
    attemptAuthentication(false);
    succeeded=true;
    if (logger.debugOn()) {
      logger.debug("login","Authentication has succeeded");
    }
    return true;
  }
 catch (  LoginException le) {
    cleanState();
    logger.debug("login","Authentication has failed");
    throw le;
  }
}

public boolean login ( ) throws LoginException { try { loadPasswordFile ( ) ; } catch ( IOException ioe ) { LoginException le = new LoginException ( "Error: unable to load the password file: " + passwordFileDisplayName ) ; throw EnvHelp . initCause ( le , ioe ) ; } if ( userCredentials == null ) { throw new LoginException ( "Error: unable to locate the users' credentials." ) ; } if ( logger . debugOn ( ) ) { logger . debug ( "login" , "Using password file: " + passwordFileDisplayName ) ; } if ( tryFirstPass ) { try { attemptAuthentication ( true ) ; succeeded = true ; if ( logger . debugOn ( ) ) { logger . debug ( "login" , "Authentication using cached password has succeeded" ) ; } return true ; } catch ( LoginException le ) { cleanState ( ) ; logger . debug ( "login" , "Authentication using cached password has failed" ) ; } } else if ( useFirstPass ) { try { attemptAuthentication ( true ) ; succeeded = true ; if ( logger . debugOn ( ) ) { logger . debug ( "login" , "Authentication using cached password has succeeded" ) ; } return true ; } catch ( LoginException le ) { cleanState ( ) ; logger . debug ( "login" , "Authentication using cached password has failed" ) ; throw le ; } } if ( logger . debugOn ( ) ) { logger . debug ( "login" , "Acquiring password" ) ; } try { attemptAuthentication ( false ) ; succeeded = true ; if ( logger . debugOn ( ) ) { logger . debug ( "login" , "Authentication has succeeded" ) ; } return true ; } catch ( LoginException le ) { cleanState ( ) ; logger . debug ( "login" , "Authentication has failed" ) ; throw le ; } }
begin user authentication ( authentication phase 1 ) . < p > acquire the user ' s name and password and verify them against the corresponding credentials from the password file .
