Skip to content

Commit c9a3d21

Browse files
committed
Add Configuration Test
Issue gh-11327
1 parent d27d431 commit c9a3d21

File tree

2 files changed

+41
-0
lines changed

2 files changed

+41
-0
lines changed

config/src/test/java/org/springframework/security/config/http/MiscHttpConfigTests.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -548,6 +548,14 @@ public void configureWhenProtectingLoginPageThenWarningLogged() {
548548
assertThat(baos.toString()).contains("[WARN]");
549549
}
550550

551+
@Test
552+
public void configureWhenProtectingLoginPageAuthorizationManagerThenWarningLogged() {
553+
ByteArrayOutputStream baos = new ByteArrayOutputStream();
554+
redirectLogsTo(baos, DefaultFilterChainValidator.class);
555+
this.spring.configLocations(xml("ProtectedLoginPageAuthorizationManager")).autowire();
556+
assertThat(baos.toString()).contains("[WARN]");
557+
}
558+
551559
@Test
552560
public void configureWhenUsingDisableUrlRewritingThenRedirectIsNotEncodedByResponse()
553561
throws IOException, ServletException {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
~ Copyright 2002-2018 the original author or authors.
4+
~
5+
~ Licensed under the Apache License, Version 2.0 (the "License");
6+
~ you may not use this file except in compliance with the License.
7+
~ You may obtain a copy of the License at
8+
~
9+
~ https://www.apache.org/licenses/LICENSE-2.0
10+
~
11+
~ Unless required by applicable law or agreed to in writing, software
12+
~ distributed under the License is distributed on an "AS IS" BASIS,
13+
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
~ See the License for the specific language governing permissions and
15+
~ limitations under the License.
16+
-->
17+
18+
<b:beans xmlns:b="http://www.springframework.org/schema/beans"
19+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
20+
xmlns="http://www.springframework.org/schema/security"
21+
xsi:schemaLocation="
22+
http://www.springframework.org/schema/security
23+
https://www.springframework.org/schema/security/spring-security.xsd
24+
http://www.springframework.org/schema/beans
25+
https://www.springframework.org/schema/beans/spring-beans.xsd">
26+
27+
<http use-authorization-manager="true">
28+
<form-login login-page="/login"/>
29+
<intercept-url pattern="/login*" access="hasRole('ROLE_A')"/>
30+
</http>
31+
32+
<b:import resource="userservice.xml"/>
33+
</b:beans>

0 commit comments

Comments
 (0)