Class WebBrowserUserAgentRequestMatcher

java.lang.Object
org.pentaho.platform.web.servlet.matchers.WebBrowserUserAgentRequestMatcher
All Implemented Interfaces:
org.springframework.security.web.util.matcher.RequestMatcher

public class WebBrowserUserAgentRequestMatcher extends Object implements org.springframework.security.web.util.matcher.RequestMatcher
The WebBrowserUserAgentRequestMatcher determines if a request is made by a web browser based on the presence and value of the `User-Agent` HTTP request header.

The matcher does not distinguish whether the request is a user navigation request or not. The only criterion is whether the request is made by a web browser. To test if a request is a user navigation request, the corresponding weak matcher, UserNavigationAcceptRequestMatcher can be used.

This matcher immediately returns `false` if the `sec-fetch-dest` is present in the request, as in that case, the "weaker" logic should not be used. Instead, this matcher should be combined

In Pentaho, this matcher is used to select an appropriate authentication failure response, depending on whether the request is made by a web browser or a tool.

  • Constructor Details

    • WebBrowserUserAgentRequestMatcher

      public WebBrowserUserAgentRequestMatcher()
    • WebBrowserUserAgentRequestMatcher

      public WebBrowserUserAgentRequestMatcher(@NonNull List<String> browserPatterns, @NonNull List<String> nonBrowserPatterns)
  • Method Details

    • isBrowser

      protected boolean isBrowser(String userAgent)
    • matches

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