mirror of
https://github.com/spring-projects/spring-security.git
synced 2025-07-12 13:23:29 +00:00
Add Migration Steps for PathMatcher Usage
Issue gh-17509
This commit is contained in:
parent
4b15b2b94e
commit
7960d2803d
@ -38,3 +38,49 @@ Xml::
|
|||||||
======
|
======
|
||||||
|
|
||||||
This will tell the Spring Security DSL to use `PathPatternMessageMatcher` for all message matchers that it constructs.
|
This will tell the Spring Security DSL to use `PathPatternMessageMatcher` for all message matchers that it constructs.
|
||||||
|
|
||||||
|
Use of `PathMatcher` is no longer supported in 7.
|
||||||
|
If you are using `PathMatcher` to change the path separator or to change case sensitivity for message matching, you can configure the `PathPatternParser` to do this instead like so:
|
||||||
|
|
||||||
|
[tabs]
|
||||||
|
======
|
||||||
|
Java::
|
||||||
|
+
|
||||||
|
[source,java,role="primary"]
|
||||||
|
----
|
||||||
|
@Bean
|
||||||
|
PathPatternMessageMatcherBuilderFactoryBean messageMatcherBuilder() {
|
||||||
|
PathPatternParser pathPatternParser = new PathPatternParser();
|
||||||
|
pathPatternParser.setCaseSensitive(false);
|
||||||
|
// use . as path separator
|
||||||
|
pathPatternParser.setPathOptions(PathContainer.Options.MESSAGE_ROUTE);
|
||||||
|
return new PathPatternMessageMatcherBuilderFactoryBean(pathPatternParser);
|
||||||
|
}
|
||||||
|
----
|
||||||
|
|
||||||
|
Kotlin::
|
||||||
|
+
|
||||||
|
[source,kotlin,role="secondary"]
|
||||||
|
----
|
||||||
|
@Bean
|
||||||
|
fun messageMatcherBuilder(): PathPatternMessageMatcherBuilderFactoryBean {
|
||||||
|
val pathPatternParser = PathPatternParser()
|
||||||
|
pathPatternParser.setCaseSensitive(false)
|
||||||
|
// use . as path separator
|
||||||
|
pathPatternParser.setPathOptions(PathContainer.Options.MESSAGE_ROUTE)
|
||||||
|
return PathPatternMessageMatcherBuilderFactoryBean(pathPatternParser)
|
||||||
|
}
|
||||||
|
----
|
||||||
|
|
||||||
|
Xml::
|
||||||
|
+
|
||||||
|
[source,xml,role="secondary"]
|
||||||
|
----
|
||||||
|
<b:bean class="org.springframework.web.util.pattern.PathPatternParser">
|
||||||
|
<b:property name="caseSensitive" value="false"/>
|
||||||
|
<!-- use . as path separator -->
|
||||||
|
<b:property name="pathOptions" value="#{T(org.springframework.http.server.PathContainer.Options).MESSAGE_ROUTE"/>
|
||||||
|
</b:bean>
|
||||||
|
<b:bean class="org.springframework.security.config.web.messaging.PathPatternMessageMatcherBuilderFactoryBean"/>
|
||||||
|
----
|
||||||
|
======
|
||||||
|
Loading…
x
Reference in New Issue
Block a user