Package io.quarkus.csrf.reactive.runtime
Class CsrfRequestResponseReactiveFilter
- java.lang.Object
-
- io.quarkus.csrf.reactive.runtime.CsrfRequestResponseReactiveFilter
-
public class CsrfRequestResponseReactiveFilter extends Object
-
-
Field Summary
Fields Modifier and Type Field Description (package private) jakarta.enterprise.inject.Instance<CsrfReactiveConfig>configInstance
-
Constructor Summary
Constructors Constructor Description CsrfRequestResponseReactiveFilter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidfilter(jakarta.ws.rs.container.ContainerRequestContext requestContext, jakarta.ws.rs.container.ContainerResponseContext responseContext, io.vertx.ext.web.RoutingContext routing)If the requirements below are true, sets a cookie by the name "csrf_token" that contains a CSRF token.voidfilter(org.jboss.resteasy.reactive.server.spi.ResteasyReactiveContainerRequestContext requestContext, io.vertx.ext.web.RoutingContext routing)If the request method is safe (GET,HEADorOPTIONS): Sets aRoutingContextkey by the name "csrf_token" that contains a randomly generated Base64 encoded string, unless such a cookie was already sent in the incoming request. If the request method is unsafe, requires the following: The request contains a valid CSRF token cookie set in response to a previous request (see above). A request entity is present. The requestContent-Typeis "application/x-www-form-urlencoded". The request entity contains a form parameter with the name "csrf_token" and value that is equal to the one supplied in the cookie.
-
-
-
Field Detail
-
configInstance
@Inject jakarta.enterprise.inject.Instance<CsrfReactiveConfig> configInstance
-
-
Method Detail
-
filter
public void filter(org.jboss.resteasy.reactive.server.spi.ResteasyReactiveContainerRequestContext requestContext, io.vertx.ext.web.RoutingContext routing)If the request method is safe (GET,HEADorOPTIONS):- Sets a
RoutingContextkey by the name "csrf_token" that contains a randomly generated Base64 encoded string, unless such a cookie was already sent in the incoming request.
- The request contains a valid CSRF token cookie set in response to a previous request (see above).
- A request entity is present.
- The request
Content-Typeis "application/x-www-form-urlencoded". - The request entity contains a form parameter with the name "csrf_token" and value that is equal to the one supplied in the cookie.
- Sets a
-
filter
public void filter(jakarta.ws.rs.container.ContainerRequestContext requestContext, jakarta.ws.rs.container.ContainerResponseContext responseContext, io.vertx.ext.web.RoutingContext routing)If the requirements below are true, sets a cookie by the name "csrf_token" that contains a CSRF token.- The request method is
GET. - The request does not contain a valid CSRF token cookie.
- Throws:
IllegalStateException- if theRoutingContextdoes not have a value for the key "csrf_token" and a cookie needs to be set.
- The request method is
-
-