public class CorsUtil extends Object
Constructor and Description |
---|
CorsUtil() |
Modifier and Type | Method and Description |
---|---|
static String |
defaultOrigin(io.undertow.server.HttpServerExchange exchange)
Determine the default origin, to allow for local access.
|
static boolean |
isCoreRequest(io.undertow.util.HeaderMap headers) |
static boolean |
isPreflightedRequest(io.undertow.server.HttpServerExchange exchange) |
static String |
matchOrigin(io.undertow.server.HttpServerExchange exchange,
Collection<String> allowedOrigins)
Match the Origin header with the allowed origins.
|
static String |
sanitizeDefaultPort(String url)
Removes the port from a URL if this port is the default one for the URL's scheme.
|
public static boolean isCoreRequest(io.undertow.util.HeaderMap headers)
public static String matchOrigin(io.undertow.server.HttpServerExchange exchange, Collection<String> allowedOrigins) throws Exception
exchange
- the current HttpExchange.allowedOrigins
- list of sanitized allowed origins.Exception
public static String defaultOrigin(io.undertow.server.HttpServerExchange exchange)
exchange
- the current HttpExchange.public static String sanitizeDefaultPort(String url)
url
- the url to be sanitized.public static boolean isPreflightedRequest(io.undertow.server.HttpServerExchange exchange)
Copyright © 2023 JBoss by Red Hat. All rights reserved.