/** * Check for the presence of account state errors. * * @return true if account state errors exist */ public boolean hasAccountStateError() { final AccountState state = authenticationResponse.getAccountState(); return state != null ? state.getError() != null : false; }
/** * Check for the presence of account state warnings. * * @return true if account state warnings exist */ public boolean hasAccountStateWarning() { final AccountState state = authenticationResponse.getAccountState(); return state != null ? state.getWarning() != null : false; }
@Override public List<MessageDescriptor> handle(final AuthenticationResponse response, final LdapPasswordPolicyConfiguration configuration) throws LoginException { final AccountState state = response.getAccountState(); if (state == null) { logger.debug("Account state not defined. Returning empty list of messages."); return Collections.emptyList(); } final List<MessageDescriptor> messages = new ArrayList<>(); handleError(state.getError(), response, configuration, messages); handleWarning(state.getWarning(), response, configuration, messages); return messages; }
@Override public void handle(final AuthenticationResponse response) { final PasswordExpiringControl expiringControl = (PasswordExpiringControl) response.getControl( PasswordExpiringControl.OID); if (expiringControl != null) { if (expiringControl.getTimeBeforeExpiration() > 0) { final Calendar exp = Calendar.getInstance(); exp.add(Calendar.SECOND, expiringControl.getTimeBeforeExpiration()); response.setAccountState(new PasswordExpirationAccountState(exp)); } else { logger.warn("Received password expiring control with non-positive value: %s", expiringControl); } } if (response.getAccountState() == null) { final PasswordExpiredControl expiredControl = (PasswordExpiredControl) response.getControl( PasswordExpiredControl.OID); if (expiredControl != null) { response.setAccountState( new PasswordExpirationAccountState(PasswordExpirationAccountState.Error.PASSWORD_EXPIRED)); } } } }
@Override public void handle(final AuthenticationResponse response) { final PasswordExpiringControl expiringControl = (PasswordExpiringControl) response.getControl( PasswordExpiringControl.OID); if (expiringControl != null) { if (expiringControl.getTimeBeforeExpiration() > 0) { final ZonedDateTime exp = ZonedDateTime.now().plusSeconds(expiringControl.getTimeBeforeExpiration()); response.setAccountState(new PasswordExpirationAccountState(exp)); } else { logger.warn("Received password expiring control with non-positive value: %s", expiringControl); } } if (response.getAccountState() == null) { final PasswordExpiredControl expiredControl = (PasswordExpiredControl) response.getControl( PasswordExpiredControl.OID); if (expiredControl != null) { response.setAccountState( new PasswordExpirationAccountState(PasswordExpirationAccountState.Error.PASSWORD_EXPIRED)); } } } }
@Override public void handle(final AuthenticationResponse response) { final PasswordExpiringControl expiringControl = (PasswordExpiringControl) response.getControl( PasswordExpiringControl.OID); if (expiringControl != null) { if (expiringControl.getTimeBeforeExpiration() > 0) { final ZonedDateTime exp = ZonedDateTime.now().plusSeconds(expiringControl.getTimeBeforeExpiration()); response.setAccountState(new PasswordExpirationAccountState(exp)); } else { logger.warn("Received password expiring control with non-positive value: %s", expiringControl); } } if (response.getAccountState() == null) { final PasswordExpiredControl expiredControl = (PasswordExpiredControl) response.getControl( PasswordExpiredControl.OID); if (expiredControl != null) { response.setAccountState( new PasswordExpirationAccountState(PasswordExpirationAccountState.Error.PASSWORD_EXPIRED)); } } } }
authenticationContext.getSubcontext(LDAPResponseContext.class, true) .setAuthenticationResponse(response); if (response.getAccountState() != null) { final AccountState.Error error = response.getAccountState().getError(); handleWarning( profileRequestContext, AuthnEventIds.INVALID_CREDENTIALS); recordFailure(profileRequestContext, true); } else if (response.getAccountState() != null) { final AccountState state = response.getAccountState(); handleError(profileRequestContext, authenticationContext, String.format("%s:%s:%s", state.getError(), response.getResultCode(), response.getMessage()),