Package io.quarkus.csrf.reactive.runtime
Class CsrfHandler
- java.lang.Object
-
- io.quarkus.csrf.reactive.runtime.CsrfHandler
-
- All Implemented Interfaces:
org.jboss.resteasy.reactive.server.spi.GenericRuntimeConfigurableServerRestHandler<CsrfReactiveConfig>,org.jboss.resteasy.reactive.server.spi.ServerRestHandler,org.jboss.resteasy.reactive.spi.RestHandler<org.jboss.resteasy.reactive.server.core.ResteasyReactiveRequestContext>
public class CsrfHandler extends Object implements org.jboss.resteasy.reactive.server.spi.GenericRuntimeConfigurableServerRestHandler<CsrfReactiveConfig>
-
-
Constructor Summary
Constructors Constructor Description CsrfHandler()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidconfigure(CsrfReactiveConfig configuration)Class<CsrfReactiveConfig>getConfigurationClass()voidhandle(org.jboss.resteasy.reactive.server.core.ResteasyReactiveRequestContext reactiveRequestContext)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.
-
-
-
Method Detail
-
handle
public void handle(org.jboss.resteasy.reactive.server.core.ResteasyReactiveRequestContext reactiveRequestContext)
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.
- Specified by:
handlein interfaceorg.jboss.resteasy.reactive.spi.RestHandler<org.jboss.resteasy.reactive.server.core.ResteasyReactiveRequestContext>- Specified by:
handlein interfaceorg.jboss.resteasy.reactive.server.spi.ServerRestHandler
- Sets a
-
configure
public void configure(CsrfReactiveConfig configuration)
- Specified by:
configurein interfaceorg.jboss.resteasy.reactive.server.spi.GenericRuntimeConfigurableServerRestHandler<CsrfReactiveConfig>
-
getConfigurationClass
public Class<CsrfReactiveConfig> getConfigurationClass()
- Specified by:
getConfigurationClassin interfaceorg.jboss.resteasy.reactive.server.spi.GenericRuntimeConfigurableServerRestHandler<CsrfReactiveConfig>
-
-