use of com.zimbra.cs.account.auth.AuthMechanism in project zm-mailbox by Zimbra.
the class LdapProvisioning method authAccount.
private void authAccount(Account acct, String password, boolean checkPasswordPolicy, Map<String, Object> authCtxt) throws ServiceException {
checkAccountStatus(acct, authCtxt);
AuthMechanism authMech = AuthMechanism.newInstance(acct, authCtxt);
verifyPassword(acct, password, authMech, authCtxt);
// false: changing password (we do *not* want to update last login in this case)
if (!checkPasswordPolicy)
return;
if (authMech.checkPasswordAging()) {
// below this point, the only fault that may be thrown is CHANGE_PASSWORD
int maxAge = acct.getIntAttr(Provisioning.A_zimbraPasswordMaxAge, 0);
if (maxAge > 0) {
Date lastChange = acct.getGeneralizedTimeAttr(Provisioning.A_zimbraPasswordModifiedTime, null);
if (lastChange != null) {
long last = lastChange.getTime();
long curr = System.currentTimeMillis();
if ((last + (Constants.MILLIS_PER_DAY * maxAge)) < curr)
throw AccountServiceException.CHANGE_PASSWORD();
}
}
boolean mustChange = acct.getBooleanAttr(Provisioning.A_zimbraPasswordMustChange, false);
if (mustChange)
throw AccountServiceException.CHANGE_PASSWORD();
}
// update/check last logon
updateLastLogon(acct);
}
Aggregations