cutelyst 3.9.1
A C++ Web Framework built on top of Qt, using the simple approach of Catalyst (Perl) framework.
csrfprotection.h
1/*
2 * SPDX-FileCopyrightText: (C) 2017-2022 Matthias Fehring <mf@huessenbergnetz.de>
3 * SPDX-License-Identifier: BSD-3-Clause
4 */
5
6#ifndef CSRFPROTECTION_H
7#define CSRFPROTECTION_H
8
9#include <Cutelyst/Plugin>
10#include <Cutelyst/cutelyst_global.h>
11
12namespace Cutelyst {
13
14class Context;
15class CSRFProtectionPrivate;
16
247class CUTELYST_PLUGIN_CSRFPROTECTION_EXPORT CSRFProtection : public Plugin
248{
250 Q_DECLARE_PRIVATE(CSRFProtection)
251public:
256
260 virtual ~CSRFProtection() override;
261
268 void setDefaultDetachTo(const QString &actionNameOrPath);
269
274 void setFormFieldName(const QString &fieldName);
275
280 void setErrorMsgStashKey(const QString &keyName);
281
287 void setIgnoredNamespaces(const QStringList &namespaces);
288
296 void setUseSessions(bool useSessions);
297
314 void setCookieHttpOnly(bool httpOnly);
315
321 void setCookieName(const QString &cookieName);
322
327 void setHeaderName(const QString &headerName);
328
335 void setGenericErrorMessage(const QString &message);
336
342 void setGenericErrorContentTyp(const QString &type);
343
347 static QByteArray getToken(Context *c);
348
361
369 static bool checkPassed(Context *c);
370
371protected:
372 CSRFProtectionPrivate *d_ptr;
373
374 virtual bool setup(Application *app) override;
375};
376
377} // namespace Cutelyst
378
379#endif // CSRFPROTECTION_H
The Cutelyst Application.
Definition application.h:43
static bool checkPassed(Context *c)
void setUseSessions(bool useSessions)
void setIgnoredNamespaces(const QStringList &namespaces)
void setFormFieldName(const QString &fieldName)
void setDefaultDetachTo(const QString &actionNameOrPath)
void setErrorMsgStashKey(const QString &keyName)
void setCookieHttpOnly(bool httpOnly)
void setCookieName(const QString &cookieName)
void setGenericErrorContentTyp(const QString &type)
static QByteArray getToken(Context *c)
void setGenericErrorMessage(const QString &message)
virtual bool setup(Application *app) override
static QString getTokenFormField(Context *c)
CSRFProtection(Application *parent)
void setHeaderName(const QString &headerName)
The Cutelyst Context.
Definition context.h:39
Plugin(Application *parent)
Definition plugin.cpp:12
The Cutelyst namespace holds all public Cutelyst API.
Definition Mainpage.dox:8
Q_OBJECTQ_OBJECT
QObject * parent() const const