Class PathPatternMessageMatcher.Builder

java.lang.Object
org.springframework.security.messaging.util.matcher.PathPatternMessageMatcher.Builder
Enclosing class:
PathPatternMessageMatcher

public static class PathPatternMessageMatcher.Builder extends Object
A builder for specifying various elements of a message for the purpose of creating a PathPatternMessageMatcher.
Since:
6.5
  • Method Details

    • matcher

      public PathPatternMessageMatcher matcher(String pattern)
      Match messages having this destination pattern.

      Path patterns always start with a slash and may contain placeholders. They can also be followed by /** to signify all URIs under a given path.

      The following are valid patterns and their meaning

      • /path - match exactly and only `/path`
      • /path/** - match `/path` and any of its descendants
      • /path/{value}/** - match `/path/subdirectory` and any of its descendants, capturing the value of the subdirectory in MessageAuthorizationContext.getVariables()

      A more comprehensive list can be found at PathPattern.

      A dot-based message pattern is also supported when configuring a PathPatternParser using PathPatternMessageMatcher.withPathPatternParser(PathPatternParser)

      Parameters:
      pattern - the destination pattern to match
      Returns:
      the PathPatternMessageMatcher.Builder for more configuration
    • matcher

      public PathPatternMessageMatcher matcher(@Nullable org.springframework.messaging.simp.SimpMessageType type, String pattern)
      Match messages having this type and destination pattern.

      When the message type is null, then the matcher does not consider the message type

      Path patterns always start with a slash and may contain placeholders. They can also be followed by /** to signify all URIs under a given path.

      The following are valid patterns and their meaning

      • /path - match exactly and only `/path`
      • /path/** - match `/path` and any of its descendants
      • /path/{value}/** - match `/path/subdirectory` and any of its descendants, capturing the value of the subdirectory in MessageAuthorizationContext.getVariables()

      A more comprehensive list can be found at PathPattern.

      A dot-based message pattern is also supported when configuring a PathPatternParser using PathPatternMessageMatcher.withPathPatternParser(PathPatternParser)

      Parameters:
      type - the message type to match
      pattern - the destination pattern to match
      Returns:
      the PathPatternMessageMatcher.Builder for more configuration