6#ifndef CSRFPROTECTION_H
7#define CSRFPROTECTION_H
9#include <Cutelyst/Plugin>
10#include <Cutelyst/Plugins/csrfprotection_export.h>
15class CSRFProtectionPrivate;
233class CUTELYST_PLUGIN_CSRFPROTECTION_EXPORT CSRFProtection
237 Q_DECLARE_PRIVATE(CSRFProtection)
238 Q_DISABLE_COPY(CSRFProtection)
243 explicit CSRFProtection(Application *parent);
251 CSRFProtection(Application *parent,
const QVariantMap &defaultConfig);
264 void setDefaultDetachTo(
const QString &actionNameOrPath);
271 void setFormFieldName(
const QByteArray &fieldName);
280 static QByteArray formFieldName() noexcept;
286 void setErrorMsgStashKey(const QString &keyName);
293 void setIgnoredNamespaces(const QStringList &namespaces);
302 void setUseSessions(
bool useSessions);
320 void setCookieHttpOnly(
bool httpOnly);
327 void setCookieName(const QByteArray &cookieName);
333 void setHeaderName(const QByteArray &headerName);
341 void setGenericErrorMessage(const QString &message);
349 void setGenericErrorContentType(const QByteArray &type);
357 static QByteArray getToken(
Context *c);
370 static QString getTokenFormField(
Context *c);
379 static
bool checkPassed(
Context *c);
385 const std::unique_ptr<CSRFProtectionPrivate> d_ptr;
The Cutelyst application.
~CSRFProtection() override
The Cutelyst namespace holds all public Cutelyst API.