Class HerodotusPathPatternRequestMatcher

java.lang.Object
cn.herodotus.engine.oauth2.authorization.matcher.HerodotusPathPatternRequestMatcher
All Implemented Interfaces:
HerodotusRequestMatcher, org.springframework.security.web.util.matcher.RequestMatcher

public class HerodotusPathPatternRequestMatcher extends Object implements HerodotusRequestMatcher

Description: 自定义请求路径匹配器

拷贝自 PathPatternRequestMatcher。进行一定的修改以支持在没有 HttpServletRequest 的环境下进行路径的比较和匹配

概扩展的目的,主要是为了实现 SecurityAttributeStorage 代码中,使用 PathPatternRequestMatcher 逻辑进行高效请求路径去重分析。

Author:
: gengwei.zheng
Date:
: 2025/8/23 23:58
  • Method Details

    • withDefaults

      public static HerodotusPathPatternRequestMatcher.Builder withDefaults()
      Use PathPatternParser.defaultInstance to parse path patterns.
      Returns:
      a HerodotusPathPatternRequestMatcher.Builder that treats URIs as relative to the context path, if any
    • withPathPatternParser

      public static HerodotusPathPatternRequestMatcher.Builder withPathPatternParser(org.springframework.web.util.pattern.PathPatternParser parser)
      Use this PathPatternParser to parse path patterns.
      Parameters:
      parser - the PathPatternParser to use
      Returns:
      a HerodotusPathPatternRequestMatcher.Builder that treats URIs as relative to the given servletPath
    • matches

      public boolean matches(jakarta.servlet.http.HttpServletRequest request)
      Specified by:
      matches in interface org.springframework.security.web.util.matcher.RequestMatcher
    • matcher

      public org.springframework.security.web.util.matcher.RequestMatcher.MatchResult matcher(jakarta.servlet.http.HttpServletRequest request)
      Specified by:
      matcher in interface org.springframework.security.web.util.matcher.RequestMatcher
    • matches

      public boolean matches(HerodotusRequest request)
      Description copied from interface: HerodotusRequestMatcher
      判断策略所实施的规则是否与提供的请求相匹配
      Specified by:
      matches in interface HerodotusRequestMatcher
      Parameters:
      request - 自定义请求对象 HerodotusRequest
      Returns:
      true 请求是否匹配,false 不匹配
    • matcher

      public org.springframework.security.web.util.matcher.RequestMatcher.MatchResult matcher(HerodotusRequest request)
      判断策略所实施的规则是否与提供的请求相匹配
      Specified by:
      matcher in interface HerodotusRequestMatcher
      Parameters:
      request - 自定义请求对象 HerodotusRequest
      Returns:
      匹配结果 RequestMatcher.MatchResult
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object