spring-security-messaging uses PathMatcher in two places:

  • [ ] SimpDestinationMessageMatcher should be deprecated and replaced
  • [ ] MessageMatcherDelegatingAuthorizationManager should deprecate and replace its use of PathMatcher
  • [ ] MessageMatcherAuthorizationManagerConfiguration should not retrieve and configuration a PathMatcher

To construct a PathPattern from a given pattern do:

PathPatternParser parser = PathPatternParser.defaultInstance;
String parsed = parser.initFullPathPattern(pattern);
PathPattern pathPattern = parser.parse(parsed);

To compare a PathPattern to a message destination, do:

String destination = SimpMessageHeaderAccessor.getDestination(message.getHeaders());
PathContainer pathContainer = PathContainer.parsePath(destination);
PathMatchInfo match = pathPattern.matchAndExtract(pathContainer);