Search in sources :

Example 1 with AccountPasswordExpiredException

use of io.gravitee.am.common.exception.authentication.AccountPasswordExpiredException in project gravitee-access-management by gravitee-io.

the class LoginFailureHandler method handle.

@Override
public void handle(RoutingContext routingContext) {
    if (routingContext.failed()) {
        Throwable throwable = routingContext.failure();
        if (throwable instanceof PolicyChainException) {
            PolicyChainException policyChainException = (PolicyChainException) throwable;
            handleException(routingContext, policyChainException.key(), policyChainException.getMessage());
        } else if (throwable instanceof AccountPasswordExpiredException) {
            handleException(routingContext, ((AccountPasswordExpiredException) throwable).getErrorCode(), throwable.getMessage());
        } else if (throwable instanceof AuthenticationException) {
            handleException(routingContext, "invalid_user", "Invalid or unknown user");
        } else {
            // technical exception will be managed by the generic error handler, continue
            routingContext.next();
        }
    }
}
Also used : AccountPasswordExpiredException(io.gravitee.am.common.exception.authentication.AccountPasswordExpiredException) AuthenticationException(io.gravitee.am.common.exception.authentication.AuthenticationException) PolicyChainException(io.gravitee.am.gateway.policy.PolicyChainException)

Aggregations

AccountPasswordExpiredException (io.gravitee.am.common.exception.authentication.AccountPasswordExpiredException)1 AuthenticationException (io.gravitee.am.common.exception.authentication.AuthenticationException)1 PolicyChainException (io.gravitee.am.gateway.policy.PolicyChainException)1