io.vertx.rxjava.ext.web.handler

## Class CSRFHandler

- java.lang.Object
- - io.vertx.rxjava.ext.web.handler.CSRFHandler

- All Implemented Interfaces:
    Handler<RoutingContext>

      public class CSRFHandler
      extends Object
      implements Handler<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 RX-ified interface using Vert.x codegen.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static TypeArg<CSRFHandler>` | `__TYPE_ARG`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `CSRFHandler(CSRFHandler delegate)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static CSRFHandler` | `create(String secret)` Instantiate a new CSRFHandlerImpl with a secret
    `CSRFHandler` | `getDelegate()`
    `void` | `handle(RoutingContext arg0)` Something has happened, so handle it.
    `static CSRFHandler` | `newInstance(CSRFHandler arg)`
    `CSRFHandler` | `setCookieName(String name)` Set the cookie name.
    `CSRFHandler` | `setCookiePath(String path)` Set the cookie path.
    `CSRFHandler` | `setHeaderName(String name)` Set the header name.
    `CSRFHandler` | `setNagHttps(boolean nag)` Should the handler give warning messages if this handler is used in other than https protocols?
    `CSRFHandler` | `setResponseBody(String responseBody)` Set the body returned by the handler when the XSRF token is missing or invalid.
    `CSRFHandler` | `setTimeout(long timeout)` Set the timeout for tokens generated by the handler, by default it uses the default from the session handler.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### __TYPE_ARG

          public static final TypeArg<CSRFHandler> __TYPE_ARG

  - ### Constructor Detail

    - #### CSRFHandler

          public CSRFHandler(CSRFHandler delegate)

  - ### Method Detail

    - #### getDelegate

          public CSRFHandler getDelegate()

    - #### handle

          public void handle(RoutingContext arg0)

      Description copied from interface: `Handler`
      Something has happened, so handle it.
      Specified by:
        `handle` in interface `Handler<RoutingContext>`
      Parameters:
        `arg0` - the event to handle

    - #### create

          public static CSRFHandler create(String secret)

      Instantiate a new CSRFHandlerImpl with a secret

           CSRFHandler.create("s3cr37")

      Parameters:
        `secret` - server secret to sign the token.
      Returns:

    - #### setCookieName

          public CSRFHandler setCookieName(String name)

      Set the cookie name. By default XSRF-TOKEN is used as it is the expected name by AngularJS however other frameworks might use other names.
      Parameters:
        `name` - a new name for the cookie.
      Returns:
        fluent

    - #### setCookiePath

          public CSRFHandler setCookiePath(String path)

      Set the cookie path. By default / is used.
      Parameters:
        `path` - a new path for the cookie.
      Returns:
        fluent

    - #### setHeaderName

          public CSRFHandler setHeaderName(String name)

      Set the header name. By default X-XSRF-TOKEN is used as it is the expected name by AngularJS however other frameworks might use other names.
      Parameters:
        `name` - a new name for the header.
      Returns:
        fluent

    - #### setNagHttps

          public CSRFHandler setNagHttps(boolean nag)

      Should the handler give warning messages if this handler is used in other than https protocols?
      Parameters:
        `nag` - true to nag
      Returns:
        fluent

    - #### setResponseBody

          public CSRFHandler setResponseBody(String responseBody)

      Set the body returned by the handler when the XSRF token is missing or invalid.
      Parameters:
        `responseBody` - the body of the response. If null, no response body will be returned.
      Returns:
        fluent

    - #### setTimeout

          public CSRFHandler setTimeout(long timeout)

      Set the timeout for tokens generated by the handler, by default it uses the default from the session handler.
      Parameters:
        `timeout` - token timeout
      Returns:
        fluent

    - #### newInstance

          public static CSRFHandler newInstance(CSRFHandler arg)

Copyright © 2017. All rights reserved.