Package com.vaadin.flow.spring.security
Class RequestUtil
java.lang.Object
com.vaadin.flow.spring.security.RequestUtil
Contains utility methods related to request handling.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic org.springframework.security.web.util.matcher.RequestMatcher[]antMatchers(String... patterns) Deprecated, for removal: This API element is subject to removal in a future version.applyUrlMapping(String path) Prepends to the givenpathwith the configured url mapping.Gets the url mapping for the Vaadin servlet.booleanisAllowedHillaView(jakarta.servlet.http.HttpServletRequest request) Deprecated, for removal: This API element is subject to removal in a future version.useisAnonymousHillaRoute(HttpServletRequest)to match requests to Hilla views that do not require authenticationbooleanisAnonymousEndpoint(jakarta.servlet.http.HttpServletRequest request) Checks whether the request targets an endpoint that is public, i.e.booleanisAnonymousHillaRoute(jakarta.servlet.http.HttpServletRequest request) Checks if the request targets a Hilla route that allows anonymous access.booleanisAnonymousRoute(jakarta.servlet.http.HttpServletRequest request) Checks whether the request targets a Flow route that is public, i.e.booleanisCustomWebIcon(jakarta.servlet.http.HttpServletRequest request) Checks whether the request targets a custom PWA icon or Favicon path.booleanisEndpointRequest(jakarta.servlet.http.HttpServletRequest request) Checks whether the request targets an endpoint.booleanisFrameworkInternalRequest(jakarta.servlet.http.HttpServletRequest request) Checks whether the request is an internal request.booleanisSecuredFlowRoute(jakarta.servlet.http.HttpServletRequest request) Checks whether the request targets a Flow route secured with navigation access control.booleanisSecuredHillaRoute(jakarta.servlet.http.HttpServletRequest request) Checks if the request targets a Hilla route that requires authentication.static org.springframework.security.web.util.matcher.RequestMatcher[]routeMatchers(String... patterns) Deprecated, for removal: This API element is subject to removal in a future version.AntPathRequestMatcheris deprecated and marked for removal.
-
Constructor Details
-
RequestUtil
public RequestUtil()
-
-
Method Details
-
isFrameworkInternalRequest
public boolean isFrameworkInternalRequest(jakarta.servlet.http.HttpServletRequest request) Checks whether the request is an internal request.An internal request is one that is needed for all Vaadin applications to function, e.g. UIDL or init requests.
Note that bootstrap requests for any route or static resource requests are not internal, neither are resource requests for the JS bundle.
- Parameters:
request- the servlet request- Returns:
trueif the request is Vaadin internal,falseotherwise
-
isEndpointRequest
public boolean isEndpointRequest(jakarta.servlet.http.HttpServletRequest request) Checks whether the request targets an endpoint.- Parameters:
request- the servlet request- Returns:
trueif the request is targeting an enpoint,falseotherwise
-
isAnonymousEndpoint
public boolean isAnonymousEndpoint(jakarta.servlet.http.HttpServletRequest request) Checks whether the request targets an endpoint that is public, i.e. marked as @AnonymousAllowed.- Parameters:
request- the servlet request- Returns:
trueif the request is targeting an anonymous endpoint,falseotherwise
-
isAllowedHillaView
@Deprecated(since="25.0", forRemoval=true) public boolean isAllowedHillaView(jakarta.servlet.http.HttpServletRequest request) Deprecated, for removal: This API element is subject to removal in a future version.useisAnonymousHillaRoute(HttpServletRequest)to match requests to Hilla views that do not require authenticationChecks if the request targets a Hilla view that is allowed according to its configuration and the current user.- Parameters:
request- the HTTP request to check- Returns:
trueif the request corresponds to an accessible Hilla view,falseotherwise
-
isAnonymousRoute
public boolean isAnonymousRoute(jakarta.servlet.http.HttpServletRequest request) Checks whether the request targets a Flow route that is public, i.e. marked as @AnonymousAllowed.- Parameters:
request- the servlet request- Returns:
trueif the request is targeting an anonymous route,falseotherwise
-
isSecuredFlowRoute
public boolean isSecuredFlowRoute(jakarta.servlet.http.HttpServletRequest request) Checks whether the request targets a Flow route secured with navigation access control.- Parameters:
request- the servlet request- Returns:
trueif the request is targeting a Flow route secured with navigation access control,falseotherwise
-
isAnonymousHillaRoute
public boolean isAnonymousHillaRoute(jakarta.servlet.http.HttpServletRequest request) Checks if the request targets a Hilla route that allows anonymous access.- Parameters:
request- the HTTP request to check- Returns:
trueif the request corresponds to a Hilla route that allows anonymous access,falseotherwise
-
isSecuredHillaRoute
public boolean isSecuredHillaRoute(jakarta.servlet.http.HttpServletRequest request) Checks if the request targets a Hilla route that requires authentication.- Parameters:
request- the HTTP request to check- Returns:
trueif the request corresponds to a Hilla route that requires authentication,falseotherwise
-
isCustomWebIcon
public boolean isCustomWebIcon(jakarta.servlet.http.HttpServletRequest request) Checks whether the request targets a custom PWA icon or Favicon path.- Parameters:
request- the servlet request- Returns:
trueif the request is targeting a custom PWA icon or a custom favicon path,falseotherwise
-
antMatchers
@Deprecated(since="24.8", forRemoval=true) public static org.springframework.security.web.util.matcher.RequestMatcher[] antMatchers(String... patterns) Deprecated, for removal: This API element is subject to removal in a future version.AntPathRequestMatcheris deprecated and marked for removal. This method is deprecated without direct replacement; usePathPatternRequestMatcherinstead.Utility to createRequestMatchers from ant patterns.Since org.springframework.security.web.util.matcher.AntPathRequestMatcher is deprecated and will be removed, callers of this method should be updated to use
PathPatternRequestMatcherinstead.var matcherBuilder = PathPatternRequestMatcher.withDefaults(): var requestMatcher = matcherBuilder.match(path);- Parameters:
patterns- and patterns- Returns:
- an array or
RequestMatcherinstances for the given patterns.
-
routeMatchers
@Deprecated(since="24.8", forRemoval=true) public static org.springframework.security.web.util.matcher.RequestMatcher[] routeMatchers(String... patterns) Deprecated, for removal: This API element is subject to removal in a future version.AntPathRequestMatcheris deprecated and marked for removal. This method is deprecated without direct replacement; usePathPatternRequestMatcherinstead.Utility to createRequestMatchers for a Vaadin routes, using ant patterns and HTTP get method.Since org.springframework.security.web.util.matcher.AntPathRequestMatcher is deprecated and will be removed, callers of this method should be updated to use
PathPatternRequestMatcherinstead.var matcherBuilder = PathPatternRequestMatcher.withDefaults(): var requestMatcher = matcherBuilder.match(HttpMethod.GET, path);- Parameters:
patterns- ANT patterns- Returns:
- an array or
RequestMatcherinstances for the given patterns.
-
getUrlMapping
Gets the url mapping for the Vaadin servlet.- Returns:
- the url mapping
- See Also:
-
applyUrlMapping
Prepends to the givenpathwith the configured url mapping.A null path is treated as empty string; the same applies for url mapping.
- Parameters:
path- the path to prepend the url mapping to- Returns:
- the path with prepended url mapping.
- See Also:
-
AntPathRequestMatcheris deprecated and marked for removal.