protected void handleWarning(final AccountState.Warning warning, final AuthenticationResponse response,
                                 final PasswordPolicyContext configuration, final List<MessageDescriptor> messages) {
        LOGGER.debug("Handling account state warning [{}]", warning);
        if (warning == null) {
            LOGGER.debug("Account state warning not defined");
            return;
        }

        if (warning.getExpiration() != null) {
            val expDate = DateTimeUtils.zonedDateTimeOf(warning.getExpiration());
            val ttl = ZonedDateTime.now(ZoneOffset.UTC).until(expDate, ChronoUnit.DAYS);
            LOGGER.debug("Password expires in [{}] days. Expiration warning threshold is [{}] days.",
                ttl, configuration.getPasswordWarningNumberOfDays());
            if (configuration.isAlwaysDisplayPasswordExpirationWarning() || (ttl >= 0 && ttl < configuration.getPasswordWarningNumberOfDays())) {
                messages.add(new PasswordExpiringWarningMessageDescriptor("Password expires in {0} days.", ttl));
            }
        } else {
            LOGGER.debug("No account expiration warning was provided as part of the account state");
        }

        if (warning.getLoginsRemaining() > 0) {
            messages.add(new DefaultMessageDescriptor(
                "password.expiration.loginsRemaining",
                "You have {0} logins remaining before you MUST change your password.",
                new Serializable[]{warning.getLoginsRemaining()}));

        }
    }
Handle an account state warning produced by ldaptive account state machinery.
<p>
Override this method to provide custom warning message handling.

@param warning       the account state warning messages.
@param response      Ldaptive authentication response.
@param configuration Password policy configuration.
@param messages      Container for messages produced by account state warning handling.
support/cas-server-support-ldap-core/src/main/java/org/apereo/cas/authentication/support/DefaultLdapAccountStateHandler.java