Skip to content

Commit f067a92

Browse files
committed
Fix Error message for unsupported Spring Security XSD versions
Closes gh-17153 Signed-off-by: Deep Dhamala <dhamaladeep2@gmail.com>
1 parent d8043dc commit f067a92

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

config/src/main/java/org/springframework/security/config/SecurityNamespaceHandler.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,7 @@ public SecurityNamespaceHandler() {
9494
public BeanDefinition parse(Element element, ParserContext pc) {
9595
if (!namespaceMatchesVersion(element)) {
9696
pc.getReaderContext()
97-
.fatal("You cannot use a spring-security-2.0.xsd or spring-security-3.0.xsd or "
98-
+ "spring-security-3.1.xsd schema or spring-security-3.2.xsd schema or spring-security-4.0.xsd schema "
99-
+ "with Spring Security 7.0. Please update your schema declarations to the 7.0 schema.",
97+
.fatal("You cannot use any XSD older than spring-security-7.0.xsd. Either change to spring-security.xsd or spring-security-7.0.xsd",
10098
element);
10199
}
102100
String name = pc.getDelegate().getLocalName(element);

config/src/test/java/org/springframework/security/config/SecurityNamespaceHandlerTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ public void pre32SchemaAreNotSupported() {
7777
.isThrownBy(() -> new InMemoryXmlApplicationContext(
7878
"<user-service id='us'><user name='bob' password='bobspassword' authorities='ROLE_A' /></user-service>",
7979
"3.0.3", null))
80-
.withMessageContaining("You cannot use a spring-security-2.0.xsd");
80+
.withMessageContaining("You cannot use any XSD older than spring-security-7.0.xsd. Either change to spring-security.xsd or spring-security-7.0.xsd");
8181
}
8282

8383
// SEC-1868

0 commit comments

Comments
 (0)