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