Package org.keycloak.services.cors
Interface Cors
- All Superinterfaces:
Provider
- All Known Implementing Classes:
DefaultCors
- Author:
- Stian Thorgersen
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionvoidadd()Add the CORS headers to the currentHttpResponse.default jakarta.ws.rs.core.Responseadd(jakarta.ws.rs.core.Response.ResponseBuilder builder) Add the CORS headers to the current serverHttpResponseand returns aResponsebased on the givenbuilder.allowedMethods(String... allowedMethods) auth()static Corsbuilder()builder(jakarta.ws.rs.core.Response.ResponseBuilder builder) checkAllowedOrigins(List<String> allowedOrigins) checkAllowedOrigins(KeycloakSession session, ClientModel client) Sets the allowed origins from the client's configured web origins and checks the incoming Origin header against them.checkAllowedOrigins(AccessToken token) exposedHeaders(String... exposedHeaders)
-
Field Details
-
DEFAULT_MAX_AGE
static final long DEFAULT_MAX_AGE -
DEFAULT_ALLOW_METHODS
- See Also:
-
DEFAULT_ALLOW_HEADERS
-
ORIGIN_HEADER
- See Also:
-
AUTHORIZATION_HEADER
- See Also:
-
ACCESS_CONTROL_ALLOW_ORIGIN
- See Also:
-
ACCESS_CONTROL_ALLOW_METHODS
- See Also:
-
ACCESS_CONTROL_ALLOW_HEADERS
- See Also:
-
ACCESS_CONTROL_EXPOSE_HEADERS
- See Also:
-
ACCESS_CONTROL_ALLOW_CREDENTIALS
- See Also:
-
ACCESS_CONTROL_MAX_AGE
- See Also:
-
ACCESS_CONTROL_ALLOW_ORIGIN_WILDCARD
- See Also:
-
-
Method Details
-
builder
-
builder
-
preflight
Cors preflight() -
auth
Cors auth() -
allowAllOrigins
Cors allowAllOrigins() -
checkAllowedOrigins
Sets the allowed origins from the client's configured web origins and checks the incoming Origin header against them. ThrowsForbiddenException(HTTP 403) on a mismatch so the request stops before any side effects. Preflight and same-origin requests pass through without a check. -
checkAllowedOrigins
-
checkAllowedOrigins
-
allowedMethods
-
exposedHeaders
-
add
void add()Add the CORS headers to the currentHttpResponse. -
add
default jakarta.ws.rs.core.Response add(jakarta.ws.rs.core.Response.ResponseBuilder builder) Add the CORS headers to the current server
HttpResponseand returns aResponsebased on the givenbuilder.This is a convenient method to make it easier to return a
Responsefrom methods while at the same time adding the corresponding CORS headers to the underlying server response.- Parameters:
builder- the response builder- Returns:
- the response built from the response builder
-