6#ifndef CSRFPROTECTION_H
7#define CSRFPROTECTION_H
9#include <Cutelyst/Plugin>
10#include <Cutelyst/cutelyst_global.h>
15class CSRFProtectionPrivate;
247class CUTELYST_PLUGIN_CSRFPROTECTION_EXPORT CSRFProtection :
public Plugin
250 Q_DECLARE_PRIVATE(CSRFProtection)
255 CSRFProtection(Application *parent);
260 virtual ~CSRFProtection()
override;
268 void setDefaultDetachTo(
const QString &actionNameOrPath);
274 void setFormFieldName(
const QString &fieldName);
280 void setErrorMsgStashKey(
const QString &keyName);
287 void setIgnoredNamespaces(
const QStringList &namespaces);
296 void setUseSessions(
bool useSessions);
314 void setCookieHttpOnly(
bool httpOnly);
321 void setCookieName(
const QString &cookieName);
327 void setHeaderName(
const QString &headerName);
335 void setGenericErrorMessage(
const QString &message);
342 void setGenericErrorContentTyp(
const QString &type);
347 static QByteArray getToken(Context *c);
360 static QString getTokenFormField(Context *c);
369 static bool checkPassed(Context *c);
372 CSRFProtectionPrivate *d_ptr;
374 virtual bool setup(Application *app)
override;
The Cutelyst namespace holds all public Cutelyst API.