Skip to content

Commit 6935045

Browse files
committed
Merge branch '5.8.x' into 6.0.x
Closes gh-12909
2 parents b22dd9a + abd51f7 commit 6935045

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

web/src/test/java/org/springframework/security/web/authentication/DefaultLoginPageGeneratingFilterTests.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2016 the original author or authors.
2+
* Copyright 2002-2023 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -132,12 +132,14 @@ public void handlesNonIso8859CharsInErrorMessage() throws Exception {
132132
DefaultLoginPageGeneratingFilter filter = new DefaultLoginPageGeneratingFilter(
133133
new UsernamePasswordAuthenticationFilter());
134134
MockHttpServletRequest request = new MockHttpServletRequest("GET", "/login");
135-
request.addParameter("login_error", "true");
135+
MockHttpServletResponse response = new MockHttpServletResponse();
136+
request.setQueryString("error");
136137
MessageSourceAccessor messages = SpringSecurityMessageSource.getAccessor();
137138
String message = messages.getMessage("AbstractUserDetailsAuthenticationProvider.badCredentials",
138139
"Bad credentials", Locale.KOREA);
139140
request.getSession().setAttribute(WebAttributes.AUTHENTICATION_EXCEPTION, new BadCredentialsException(message));
140-
filter.doFilter(request, new MockHttpServletResponse(), this.chain);
141+
filter.doFilter(request, response, this.chain);
142+
assertThat(response.getContentAsString()).contains(message);
141143
}
142144

143145
// gh-5394

0 commit comments

Comments
 (0)