From 00ea64d1d4c47fdc796f3401280ab66612d6ca3b Mon Sep 17 00:00:00 2001 From: Thomas Darimont Date: Fri, 13 Nov 2020 22:27:32 +0100 Subject: [PATCH] KEYCLOAK-16143 Honor AuthenticationProcessor.forwardedErrorMessage when rendering registration form --- .../keycloak/authentication/FormAuthenticationFlow.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/services/src/main/java/org/keycloak/authentication/FormAuthenticationFlow.java b/services/src/main/java/org/keycloak/authentication/FormAuthenticationFlow.java index b54d481fcd..5c7c167a67 100755 --- a/services/src/main/java/org/keycloak/authentication/FormAuthenticationFlow.java +++ b/services/src/main/java/org/keycloak/authentication/FormAuthenticationFlow.java @@ -36,6 +36,7 @@ import javax.ws.rs.core.MultivaluedMap; import javax.ws.rs.core.Response; import javax.ws.rs.core.UriInfo; import java.net.URI; +import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.LinkedList; @@ -276,7 +277,11 @@ public class FormAuthenticationFlow implements AuthenticationFlow { @Override public Response processFlow() { - return renderForm(null, null); + + // KEYCLOAK-16143: Propagate forwarded error messages if present + List errors = processor.forwardedErrorMessage != null ? Collections.singletonList(processor.forwardedErrorMessage) : null; + + return renderForm(null, errors); } public Response renderForm(MultivaluedMap formData, List errors) {