2022-01-09 15:25:55 +01:00
|
|
|
#ifndef CSRF_TOKEN_H
|
|
|
|
#define CSRF_TOKEN_H
|
|
|
|
|
|
|
|
#include "middleware.h"
|
|
|
|
|
2022-01-09 15:53:40 +01:00
|
|
|
#include "core/containers/vector.h"
|
|
|
|
#include "core/string.h"
|
|
|
|
|
2022-01-09 15:25:55 +01:00
|
|
|
class Request;
|
|
|
|
|
|
|
|
class CSRFTokenMiddleware : public Middleware {
|
|
|
|
RCPP_OBJECT(CSRFTokenMiddleware, Middleware);
|
|
|
|
|
|
|
|
public:
|
|
|
|
//returnring true means handled, false means continue
|
|
|
|
bool on_before_handle_request_main(Request *request);
|
|
|
|
|
2022-01-09 15:53:40 +01:00
|
|
|
bool shold_ignore(Request *request);
|
|
|
|
|
2022-01-09 15:25:55 +01:00
|
|
|
virtual String create_token();
|
|
|
|
|
|
|
|
CSRFTokenMiddleware();
|
|
|
|
~CSRFTokenMiddleware();
|
2022-01-09 15:53:40 +01:00
|
|
|
|
|
|
|
Vector<String> ignored_urls;
|
2022-01-09 15:25:55 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|