Exemplo n.º 1
0
 @Transactional(readOnly = true)
 public User getUserByPrincipal(
     String securityDomain, String principal, String managedSysId, boolean dependants) {
   // get the login
   LoginId loginId = new LoginId(securityDomain, principal, managedSysId);
   Login login = loginDao.findById(loginId);
   if (login == null) {
     return null;
   }
   return getUserWithDependent(login.getUserId(), dependants);
 }
 private Login getPrimaryLogin(List<Login> principalList) {
   if (principalList == null) {
     return null;
   }
   for (Login lg : principalList) {
     if (lg.getId().getManagedSysId().equalsIgnoreCase("0")) {
       return lg;
     }
   }
   return null;
 }
Exemplo n.º 3
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;
 }