Display general error message when WebFlux oauth2Login() fails
Issue gh-5562 gh-6484
This commit is contained in:
parent
c40a17b4d1
commit
4d9cee116c
|
@ -106,7 +106,7 @@ public class LoginPageGeneratingWebFilter implements WebFilter {
|
||||||
+ " <body>\n"
|
+ " <body>\n"
|
||||||
+ " <div class=\"container\">\n"
|
+ " <div class=\"container\">\n"
|
||||||
+ formLogin(queryParams, csrfTokenHtmlInput)
|
+ formLogin(queryParams, csrfTokenHtmlInput)
|
||||||
+ oauth2LoginLinks(contextPath, this.oauth2AuthenticationUrlToClientName)
|
+ oauth2LoginLinks(queryParams, contextPath, this.oauth2AuthenticationUrlToClientName)
|
||||||
+ " </div>\n"
|
+ " </div>\n"
|
||||||
+ " </body>\n"
|
+ " </body>\n"
|
||||||
+ "</html>";
|
+ "</html>";
|
||||||
|
@ -135,12 +135,14 @@ public class LoginPageGeneratingWebFilter implements WebFilter {
|
||||||
+ " </form>\n";
|
+ " </form>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String oauth2LoginLinks(String contextPath, Map<String, String> oauth2AuthenticationUrlToClientName) {
|
private static String oauth2LoginLinks(MultiValueMap<String, String> queryParams, String contextPath, Map<String, String> oauth2AuthenticationUrlToClientName) {
|
||||||
if (oauth2AuthenticationUrlToClientName.isEmpty()) {
|
if (oauth2AuthenticationUrlToClientName.isEmpty()) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
boolean isError = queryParams.containsKey("error");
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
sb.append("<div class=\"container\"><h2 class=\"form-signin-heading\">Login with OAuth 2.0</h2>");
|
sb.append("<div class=\"container\"><h2 class=\"form-signin-heading\">Login with OAuth 2.0</h2>");
|
||||||
|
sb.append(createError(isError));
|
||||||
sb.append("<table class=\"table table-striped\">\n");
|
sb.append("<table class=\"table table-striped\">\n");
|
||||||
for (Map.Entry<String, String> clientAuthenticationUrlToClientName : oauth2AuthenticationUrlToClientName.entrySet()) {
|
for (Map.Entry<String, String> clientAuthenticationUrlToClientName : oauth2AuthenticationUrlToClientName.entrySet()) {
|
||||||
sb.append(" <tr><td>");
|
sb.append(" <tr><td>");
|
||||||
|
|
Loading…
Reference in New Issue