Class CORSFilter
- java.lang.Object
-
- io.quarkus.vertx.http.runtime.cors.CORSFilter
-
- All Implemented Interfaces:
io.vertx.core.Handler<io.vertx.ext.web.RoutingContext>
public class CORSFilter extends Object implements io.vertx.core.Handler<io.vertx.ext.web.RoutingContext>
-
-
Field Summary
Fields Modifier and Type Field Description (package private) CORSConfig
corsConfig
-
Constructor Summary
Constructors Constructor Description CORSFilter(CORSConfig corsConfig)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
handle(io.vertx.ext.web.RoutingContext event)
static boolean
isConfiguredWithWildcard(Optional<List<String>> optionalList)
static boolean
isOriginAllowedByRegex(List<Pattern> allowOriginsRegex, String origin)
If any regular expression origins are configured, try to match on them.(package private) static boolean
isSameOrigin(io.vertx.core.http.HttpServerRequest request, String origin)
(package private) static boolean
isSameOriginSlowPath(io.vertx.core.http.HttpServerRequest request, String origin)
static List<Pattern>
parseAllowedOriginsRegex(Optional<List<String>> allowedOrigins)
Parse the provided allowed origins for any regexes(package private) static boolean
substringMatch(String str, int pos, String substring, boolean requireFull)
-
-
-
Field Detail
-
corsConfig
final CORSConfig corsConfig
-
-
Constructor Detail
-
CORSFilter
public CORSFilter(CORSConfig corsConfig)
-
-
Method Detail
-
isConfiguredWithWildcard
public static boolean isConfiguredWithWildcard(Optional<List<String>> optionalList)
-
parseAllowedOriginsRegex
public static List<Pattern> parseAllowedOriginsRegex(Optional<List<String>> allowedOrigins)
Parse the provided allowed origins for any regexes- Parameters:
allowedOrigins
-- Returns:
- a list of compiled regular expressions. If none configured, and empty list is returned
-
isOriginAllowedByRegex
public static boolean isOriginAllowedByRegex(List<Pattern> allowOriginsRegex, String origin)
If any regular expression origins are configured, try to match on them. Regular expressions must begin and end with '/'- Parameters:
allowOriginsRegex
- the configured regex origins.origin
- the specified origin- Returns:
- true if any configured regular expressions match the specified origin, false otherwise
-
handle
public void handle(io.vertx.ext.web.RoutingContext event)
- Specified by:
handle
in interfaceio.vertx.core.Handler<io.vertx.ext.web.RoutingContext>
-
isSameOrigin
static boolean isSameOrigin(io.vertx.core.http.HttpServerRequest request, String origin)
-
isSameOriginSlowPath
static boolean isSameOriginSlowPath(io.vertx.core.http.HttpServerRequest request, String origin)
-
-