|
38 | 38 | ======
|
39 | 39 |
|
40 | 40 | This will tell the Spring Security DSL to use `PathPatternMessageMatcher` for all message matchers that it constructs.
|
| 41 | + |
| 42 | +Use of `PathMatcher` is no longer supported in 7. |
| 43 | +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: |
| 44 | + |
| 45 | +[tabs] |
| 46 | +====== |
| 47 | +Java:: |
| 48 | ++ |
| 49 | +[source,java,role="primary"] |
| 50 | +---- |
| 51 | +@Bean |
| 52 | +PathPatternMessageMatcherBuilderFactoryBean messageMatcherBuilder() { |
| 53 | + PathPatternParser pathPatternParser = new PathPatternParser(); |
| 54 | + pathPatternParser.setCaseSensitive(false); |
| 55 | + // use . as path separator |
| 56 | + pathPatternParser.setPathOptions(PathContainer.Options.MESSAGE_ROUTE); |
| 57 | + return new PathPatternMessageMatcherBuilderFactoryBean(pathPatternParser); |
| 58 | +} |
| 59 | +---- |
| 60 | +
|
| 61 | +Kotlin:: |
| 62 | ++ |
| 63 | +[source,kotlin,role="secondary"] |
| 64 | +---- |
| 65 | +@Bean |
| 66 | +fun messageMatcherBuilder(): PathPatternMessageMatcherBuilderFactoryBean { |
| 67 | + val pathPatternParser = PathPatternParser() |
| 68 | + pathPatternParser.setCaseSensitive(false) |
| 69 | + // use . as path separator |
| 70 | + pathPatternParser.setPathOptions(PathContainer.Options.MESSAGE_ROUTE) |
| 71 | + return PathPatternMessageMatcherBuilderFactoryBean(pathPatternParser) |
| 72 | +} |
| 73 | +---- |
| 74 | +
|
| 75 | +Xml:: |
| 76 | ++ |
| 77 | +[source,xml,role="secondary"] |
| 78 | +---- |
| 79 | +<b:bean class="org.springframework.web.util.pattern.PathPatternParser"> |
| 80 | + <b:property name="caseSensitive" value="false"/> |
| 81 | + <!-- use . as path separator --> |
| 82 | + <b:property name="pathOptions" value="#{T(org.springframework.http.server.PathContainer.Options).MESSAGE_ROUTE"/> |
| 83 | +</b:bean> |
| 84 | +<b:bean class="org.springframework.security.config.web.messaging.PathPatternMessageMatcherBuilderFactoryBean"/> |
| 85 | +---- |
| 86 | +====== |
0 commit comments