Exemplo n.º 1
0
 /**
  * If the password has expired, but its before the grace period then its a good login If the
  * password has expired and after the grace period, then its an exception. You should also set the
  * days to expiration
  *
  * @param lg
  * @return
  */
 private int passwordExpired(Login lg, Date curDate) {
   if (lg.getGracePeriod() == null) {
     // set an early date
     lg.setGracePeriod(new Date(0));
   }
   if (lg.getPwdExp() != null) {
     if (curDate.after(lg.getPwdExp()) && curDate.after(lg.getGracePeriod())) {
       // check for password expiration, but successful login
       return AuthenticationConstants.RESULT_PASSWORD_EXPIRED;
     }
     if ((curDate.after(lg.getPwdExp()) && curDate.before(lg.getGracePeriod()))) {
       // check for password expiration, but successful login
       return AuthenticationConstants.RESULT_SUCCESS_PASSWORD_EXP;
     }
   }
   return AuthenticationConstants.RESULT_SUCCESS_PASSWORD_EXP;
 }