public static void doRandomSleepOnFailedLoginAttempt(AuthenticationInfo authenticationInfo){
  try {
    if (authenticationInfo == null) {
      authenticationInfo=SecurityHelper.loadAuthenticationInformation();
    }
    int min=authenticationInfo.getMinWaitOnFailedLogin();
    int max=authenticationInfo.getMaxWaitOnFailedLogin();
    int increment=authenticationInfo.getIncrementStepWaitOnFailedLogin();
    int randomNum=SecurityHelper.getRandomInt(min,max,increment);
    logger.info(MessageFormat.format("Invalid credentials. Sleeping (ms): {0,number,#}",randomNum));
    if (randomNum > 0)     Thread.sleep(randomNum);
  }
 catch (  InterruptedException e) {
    logger.error(MessageFormat.format("Could not sleep !: {0}",e));
  }
catch (  ConfigurationException e) {
    logger.error(MessageFormat.format("Could not get security information. Will use default values: {0}",e));
  }
}

public static void doRandomSleepOnFailedLoginAttempt ( AuthenticationInfo authenticationInfo ) { try { if ( authenticationInfo == null ) { authenticationInfo = SecurityHelper . loadAuthenticationInformation ( ) ; } int min = authenticationInfo . getMinWaitOnFailedLogin ( ) ; int max = authenticationInfo . getMaxWaitOnFailedLogin ( ) ; int increment = authenticationInfo . getIncrementStepWaitOnFailedLogin ( ) ; int randomNum = SecurityHelper . getRandomInt ( min , max , increment ) ; logger . info ( MessageFormat . format ( "Invalid credentials. Sleeping (ms): {0,number,#}" , randomNum ) ) ; if ( randomNum > 0 ) Thread . sleep ( randomNum ) ; } catch ( InterruptedException e ) { logger . error ( MessageFormat . format ( "Could not sleep !: {0}" , e ) ) ; } catch ( ConfigurationException e ) { logger . error ( MessageFormat . format ( "Could not get security information. Will use default values: {0}" , e ) ) ; } }
does a random sleep on a failed login attempt . sleep duration depends on parameters defined in security . properties
