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();
}
}
}
Aggregations