Interface CorsAuthorizer
- All Known Implementing Classes:
AllOriginsCorsAuthorizer
,NoOriginsCorsAuthorizer
,WhitelistedOriginsCorsAuthorizer
public interface CorsAuthorizer
Contract for types that authorize CORS requests.
See https://www.soklet.com/docs/cors#authorizing-cors-requests for detailed documentation.
- Author:
- Mark Allen
-
Method Summary
Modifier and TypeMethodDescriptionAuthorizes a non-preflight CORS request.authorizePreflight
(Request request, CorsPreflight corsPreflight, Map<HttpMethod, ResourceMethod> availableResourceMethodsByHttpMethod) Authorizes a CORS preflight request.
-
Method Details
-
authorize
Authorizes a non-preflight CORS request.- Parameters:
request
- the request to authorizecors
- the CORS data provided in the request- Returns:
- a
CorsResponse
if authorized, orOptional.empty()
if not authorized
-
authorizePreflight
@Nonnull Optional<CorsPreflightResponse> authorizePreflight(@Nonnull Request request, @Nonnull CorsPreflight corsPreflight, @Nonnull Map<HttpMethod, ResourceMethod> availableResourceMethodsByHttpMethod) Authorizes a CORS preflight request.- Parameters:
request
- the preflight request to authorizecorsPreflight
- the CORS preflight data provided in the requestavailableResourceMethodsByHttpMethod
- Resource Methods that are available to serve requests according to parameters specified by the preflight data- Returns:
- a
CorsPreflightResponse
if authorized, orOptional.empty()
if not authorized
-