Package io.vertx.mutiny.ext.web.handler
Class CSRFHandler
java.lang.Object
io.vertx.mutiny.ext.web.handler.CSRFHandler
- All Implemented Interfaces:
MutinyDelegate,io.vertx.core.Handler<RoutingContext>,InputTrustHandler,Consumer<RoutingContext>
public class CSRFHandler
extends Object
implements MutinyDelegate, InputTrustHandler, io.vertx.core.Handler<RoutingContext>, Consumer<RoutingContext>
This handler adds a CSRF token to requests which mutate state. In order change the state a (XSRF-TOKEN) cookie is set
with a unique token, that is expected to be sent back in a (X-XSRF-TOKEN) header.
The behavior is to check the request body header and cookie for validity.
This Handler requires session support, thus should be added somewhere below Session and Body handlers.
NOTE: This class has been automatically generated from the
original non Mutiny-ified interface using Vert.x codegen.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final TypeArg<CSRFHandler>static final Stringstatic final Stringstatic final String -
Constructor Summary
ConstructorsConstructorDescriptionCSRFHandler(io.vertx.ext.web.handler.CSRFHandler delegate) CSRFHandler(Object delegate) -
Method Summary
Modifier and TypeMethodDescriptionvoidaccept(RoutingContext item) static CSRFHandlerbooleanio.vertx.ext.web.handler.CSRFHandlervoidhandle(RoutingContext arg0) inthashCode()static CSRFHandlernewInstance(io.vertx.ext.web.handler.CSRFHandler arg) setCookieHttpOnly(boolean httpOnly) setCookieName(String name) setCookiePath(String path) setCookieSecure(boolean secure) setHeaderName(String name) setNagHttps(boolean nag) setTimeout(long timeout) toString()
-
Field Details
-
__TYPE_ARG
-
DEFAULT_COOKIE_NAME
- See Also:
-
DEFAULT_COOKIE_PATH
- See Also:
-
DEFAULT_HEADER_NAME
- See Also:
-
-
Constructor Details
-
CSRFHandler
public CSRFHandler(io.vertx.ext.web.handler.CSRFHandler delegate) -
CSRFHandler
-
-
Method Details
-
getDelegate
public io.vertx.ext.web.handler.CSRFHandler getDelegate()- Specified by:
getDelegatein interfaceInputTrustHandler- Specified by:
getDelegatein interfaceMutinyDelegate- Returns:
- the delegate used by this Mutiny object of generated type
-
toString
-
equals
-
hashCode
public int hashCode() -
handle
- Specified by:
handlein interfaceio.vertx.core.Handler<RoutingContext>- Specified by:
handlein interfaceInputTrustHandler
-
create
- Parameters:
vertx-secret- server secret to sign the token.- Returns:
-
setOrigin
- Parameters:
origin- the origin for this server e.g.:https://www.foo.com.- Returns:
- fluent
-
setCookieName
- Parameters:
name- a new name for the cookie.- Returns:
- fluent
-
setCookiePath
- Parameters:
path- a new path for the cookie.- Returns:
- fluent
-
setCookieHttpOnly
- Parameters:
httpOnly- a new name for the header.- Returns:
- fluent
-
setCookieSecure
- Parameters:
secure- true to set the secure flag on the cookie- Returns:
- a reference to this, so the API can be used fluently
-
setHeaderName
- Parameters:
name- a new name for the header.- Returns:
- fluent
-
setNagHttps
- Parameters:
nag- true to nag- Returns:
- fluent
-
setTimeout
- Parameters:
timeout- token timeout- Returns:
- fluent
-
accept
- Specified by:
acceptin interfaceConsumer<RoutingContext>- Specified by:
acceptin interfaceInputTrustHandler
-
newInstance
-