5#ifndef AUTHENTICATION_H
6#define AUTHENTICATION_H
8#include <Cutelyst/Plugins/Authentication/authenticationuser.h>
9#include <Cutelyst/cutelyst_global.h>
10#include <Cutelyst/paramsmultimap.h>
11#include <Cutelyst/plugin.h>
16class AuthenticationStore;
17class AuthenticationRealm;
36class AuthenticationPrivate;
55 void addRealm(std::shared_ptr<AuthenticationRealm> realm);
61 void addRealm(std::shared_ptr<AuthenticationStore> store,
62 std::shared_ptr<AuthenticationCredential> credential,
63 const QString &name = QLatin1String(defaultRealm));
68 [[nodiscard]] std::shared_ptr<AuthenticationRealm>
69 realm(
const QString &name = QLatin1String(defaultRealm))
const;
74 [[nodiscard]]
static bool authenticate(
Context *c,
76 const QString &realm = QLatin1String(defaultRealm));
81 [[nodiscard]]
inline static bool
82 authenticate(
Context *c,
const QString &realm = QLatin1String(defaultRealm));
91 const QString &realm = QLatin1String(defaultRealm));
107 [[nodiscard]]
static bool userExists(
Context *c);
113 [[nodiscard]]
static bool userInRealm(
Context *c,
114 const QString &realmName = QLatin1String(defaultRealm));
120 static void logout(
Context *c);
125 AuthenticationPrivate *d_ptr;
The Cutelyst Application.
virtual AuthenticationUser authenticate(Context *c, AuthenticationRealm *realm, const ParamsMultiMap &authinfo)=0
Tries to authenticate the authinfo using the give realm.
std::shared_ptr< AuthenticationRealm > realm(const QString &name=QLatin1String(defaultRealm)) const
Returns an AuthenticationRealm object that was registered with name.
static bool authenticate(Context *c, const ParamsMultiMap &userinfo, const QString &realm=QLatin1String(defaultRealm))
static char * defaultRealm
default realm name
The Cutelyst namespace holds all public Cutelyst API.
QMultiMap< QString, QString > ParamsMultiMap