@Override public void handle(final AuthenticationResponse response) { final PasswordPolicyControl ppc = (PasswordPolicyControl) response.getControl(PasswordPolicyControl.OID); if (ppc != null) { if (ppc.getError() != null) { response.setAccountState(new PasswordPolicyAccountState(ppc.getError())); } else { Calendar exp = null; if (ppc.getTimeBeforeExpiration() > 0) { exp = Calendar.getInstance(); exp.add(Calendar.SECOND, ppc.getTimeBeforeExpiration()); } if (exp != null || ppc.getGraceAuthNsRemaining() > 0) { response.setAccountState(new PasswordPolicyAccountState(exp, ppc.getGraceAuthNsRemaining())); } } } } }
@Override public void handle(final AuthenticationResponse response) { final PasswordPolicyControl ppc = (PasswordPolicyControl) response.getControl(PasswordPolicyControl.OID); if (ppc != null) { if (ppc.getError() != null) { response.setAccountState(new PasswordPolicyAccountState(ppc.getError())); } else { ZonedDateTime exp = null; if (ppc.getTimeBeforeExpiration() >= 0) { exp = ZonedDateTime.now().plusSeconds(ppc.getTimeBeforeExpiration()); } if (exp != null || ppc.getGraceAuthNsRemaining() >= 0) { response.setAccountState(new PasswordPolicyAccountState(exp, ppc.getGraceAuthNsRemaining())); } } } } }
@Override public void handle(final AuthenticationResponse response) { final PasswordPolicyControl ppc = (PasswordPolicyControl) response.getControl(PasswordPolicyControl.OID); if (ppc != null) { if (ppc.getError() != null) { response.setAccountState(new PasswordPolicyAccountState(ppc.getError())); } else { ZonedDateTime exp = null; if (ppc.getTimeBeforeExpiration() >= 0) { exp = ZonedDateTime.now().plusSeconds(ppc.getTimeBeforeExpiration()); } if (exp != null || ppc.getGraceAuthNsRemaining() >= 0) { response.setAccountState(new PasswordPolicyAccountState(exp, ppc.getGraceAuthNsRemaining())); } } } } }