diff --git a/web/src/main/java/org/springframework/security/web/server/ui/LoginPageGeneratingWebFilter.java b/web/src/main/java/org/springframework/security/web/server/ui/LoginPageGeneratingWebFilter.java index 2c760654c2..5daa3f0012 100644 --- a/web/src/main/java/org/springframework/security/web/server/ui/LoginPageGeneratingWebFilter.java +++ b/web/src/main/java/org/springframework/security/web/server/ui/LoginPageGeneratingWebFilter.java @@ -106,7 +106,7 @@ public class LoginPageGeneratingWebFilter implements WebFilter { + " \n" + "
\n" + formLogin(queryParams, csrfTokenHtmlInput) - + oauth2LoginLinks(contextPath, this.oauth2AuthenticationUrlToClientName) + + oauth2LoginLinks(queryParams, contextPath, this.oauth2AuthenticationUrlToClientName) + "
\n" + " \n" + ""; @@ -135,12 +135,14 @@ public class LoginPageGeneratingWebFilter implements WebFilter { + " \n"; } - private static String oauth2LoginLinks(String contextPath, Map oauth2AuthenticationUrlToClientName) { + private static String oauth2LoginLinks(MultiValueMap queryParams, String contextPath, Map oauth2AuthenticationUrlToClientName) { if (oauth2AuthenticationUrlToClientName.isEmpty()) { return ""; } + boolean isError = queryParams.containsKey("error"); StringBuilder sb = new StringBuilder(); sb.append("
"); + sb.append(createError(isError)); sb.append("\n"); for (Map.Entry clientAuthenticationUrlToClientName : oauth2AuthenticationUrlToClientName.entrySet()) { sb.append("
");