|
cwist
Modern C web framework with libttak runtime
|
Double-submit CSRF protection. More...
#include <cwist/sys/app/csrf.h>#include <cwist/net/http/cookie.h>#include <cwist/core/mem/alloc.h>#include <errno.h>#include <fcntl.h>#include <string.h>#include <unistd.h>
Go to the source code of this file.
Macros | |
| #define | _POSIX_C_SOURCE 200809L |
| #define | CWIST_CSRF_COOKIE_NAME "csrf_token" |
| #define | CWIST_CSRF_TOKEN_BYTES 32 |
| #define | CWIST_CSRF_TOKEN_CHARS (CWIST_CSRF_TOKEN_BYTES * 2) |
Functions | |
| cwist_middleware_func | cwist_mw_csrf (cwist_app *app) |
| Create the CSRF protection middleware. | |
| const char * | cwist_csrf_token (cwist_http_request *req) |
| Get the CSRF token associated with a request. | |
Double-submit CSRF protection.
Definition in file csrf.c.
| #define CWIST_CSRF_TOKEN_CHARS (CWIST_CSRF_TOKEN_BYTES * 2) |
| const char * cwist_csrf_token | ( | cwist_http_request * | req | ) |
Get the CSRF token associated with a request.
Get the CSRF token for the current request.
| req | Request to query. |
req is NULL or no token has been set. The returned pointer is owned by the request. Definition at line 240 of file csrf.c.
References cap, and cwist_http_request::csrf_token.
| cwist_middleware_func cwist_mw_csrf | ( | cwist_app * | app | ) |