File tree Expand file tree Collapse file tree
demo/integration-tests/webapp-vaadin-it/src/test/java/software/xdev/sse/demo/vaadin/cases/urlmapping
web-sidecar-common/src/main/java/software/xdev/sse/web/sidecar/httpsecurity Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11package software .xdev .sse .demo .vaadin .cases .urlmapping ;
22
3+ import static org .junit .jupiter .api .Assertions .assertEquals ;
4+ import static org .junit .jupiter .api .Assertions .assertNull ;
5+ import static org .junit .jupiter .api .Assertions .assertTrue ;
6+
37import java .io .IOException ;
48import java .net .URI ;
59import java .util .Collection ;
10+ import java .util .List ;
611
712import org .apache .hc .client5 .http .classic .methods .HttpUriRequestBase ;
813import org .apache .hc .client5 .http .impl .classic .CloseableHttpClient ;
@@ -53,5 +58,16 @@ void check() throws IOException
5358 }
5459 }
5560
56- protected abstract Collection <Executable > checkResponse (final ClassicHttpResponse response );
61+ // As of Spring Boot 7.x the underlying problem is fixed out-of-the-box and both responses should now be identical
62+ protected Collection <Executable > checkResponse (final ClassicHttpResponse response )
63+ {
64+ return List .of (
65+ () -> assertEquals (302 , response .getCode ()),
66+ () -> assertNull (response .getHeader ("Set-Cookie" )),
67+ () -> assertTrue (response .getHeader ("Location" )
68+ .getValue ()
69+ .endsWith ("/oauth2/authorization/local" )),
70+ () -> assertEquals ("1" , response .getHeader ("X-Force-Reload" ).getValue ())
71+ );
72+ }
5773}
Original file line number Diff line number Diff line change 11package software .xdev .sse .demo .vaadin .cases .urlmapping ;
22
3- import static org .junit .jupiter .api .Assertions .assertEquals ;
4- import static org .junit .jupiter .api .Assertions .assertNull ;
5-
6- import java .util .Collection ;
7- import java .util .List ;
8-
9- import org .apache .hc .core5 .http .ClassicHttpResponse ;
10- import org .junit .jupiter .api .function .Executable ;
11-
123import software .xdev .sse .demo .tci .webapp .containers .VaadinWebAppContainer ;
134
145
@@ -20,14 +11,4 @@ protected void customizeWebAppContainer(final VaadinWebAppContainer c)
2011 super .customizeWebAppContainer (c );
2112 c .withEnv ("SSE_SIDECAR_HTTP-SECURITY-MATCHER_DEFAULT_CREATOR_ENABLED" , "false" );
2213 }
23-
24- @ Override
25- protected Collection <Executable > checkResponse (final ClassicHttpResponse response )
26- {
27- return List .of (
28- () -> assertEquals (401 , response .getCode ()),
29- () -> assertNull (response .getHeader ("Set-Cookie" )),
30- () -> assertEquals ("Basic realm=\" Realm\" " , response .getHeader ("WWW-Authenticate" ).getValue ())
31- );
32- }
3314}
Original file line number Diff line number Diff line change 11package software .xdev .sse .demo .vaadin .cases .urlmapping ;
22
3- import static org .junit .jupiter .api .Assertions .assertEquals ;
4- import static org .junit .jupiter .api .Assertions .assertNull ;
5- import static org .junit .jupiter .api .Assertions .assertTrue ;
6-
7- import java .util .Collection ;
8- import java .util .List ;
9-
10- import org .apache .hc .core5 .http .ClassicHttpResponse ;
11- import org .junit .jupiter .api .function .Executable ;
12-
13-
143class UrlMappingPatchedTest extends BaseUrlMappingTest
154{
16- @ Override
17- protected Collection <Executable > checkResponse (final ClassicHttpResponse response )
18- {
19- return List .of (
20- () -> assertEquals (302 , response .getCode ()),
21- () -> assertNull (response .getHeader ("Set-Cookie" )),
22- () -> assertTrue (response .getHeader ("Location" )
23- .getValue ()
24- .endsWith ("/oauth2/authorization/local" )),
25- () -> assertEquals ("1" , response .getHeader ("X-Force-Reload" ).getValue ())
26- );
27- }
285}
Original file line number Diff line number Diff line change 1414 * limitations under the License.
1515 */
1616/**
17+ * <h4>Spring 7.x Update</h4>
18+ * With Spring 7 the underlying root issue has been fixed - Spring now always uses a PathPatternRequestMatcher.
19+ * <p>
20+ * However, it's still possible for frameworks or applications to use a custom implementation in
21+ * {@link org.springframework.security.config.annotation.web.builders.HttpSecurity#securityMatcher(java.lang.String...)}
22+ * so for now this implementation will stay available.
23+ * </p>
24+ *
25+ * <h4>Original behavior - Spring 6.x</h4>
1726 * Controls how
1827 * {@link org.springframework.security.config.annotation.web.builders.HttpSecurity
1928 * #securityMatcher(org.springframework.security.web.util.matcher.RequestMatcher)} is applied for sidecars.
2736 * <p>
2837 * <i>This package is only designed to be used in Sidecars and not in the main application!</i>
2938 * </p>
39+ *
3040 * @see <a href="https://github.com/xdev-software/spring-security-extras/issues/221">#221</a>
3141 */
3242package software .xdev .sse .web .sidecar .httpsecurity ;
You can’t perform that action at this time.
0 commit comments