QXmpp: QXmppPasswordChecker.h Source File

QXmpp Version: 1.14.2

Loading...
Searching...
No Matches
QXmppPasswordChecker.h
1// SPDX-FileCopyrightText: 2011 Jeremy Lainé <jeremy.laine@m4x.org>
2//
3// SPDX-License-Identifier: LGPL-2.1-or-later
4
5#ifndef QXMPPPASSWORDCHECKER_H
6#define QXMPPPASSWORDCHECKER_H
7
8#include "QXmppGlobal.h"
9
10#include <QObject>
11
14 class QXMPP_EXPORT QXmppPasswordRequest
15{
16public:
18 enum Type {
19 CheckPassword = 0
20 };
21
22 QString domain() const;
23 void setDomain(const QString &domain);
24
25 QString password() const;
26 void setPassword(const QString &password);
27
28 QString username() const;
29 void setUsername(const QString &username);
30
31private:
32 QString m_domain;
33 QString m_password;
34 QString m_username;
35};
36
39 class QXMPP_EXPORT QXmppPasswordReply : public QObject
40{
41 Q_OBJECT
42
43public:
45 enum Error {
46 NoError = 0,
47 AuthorizationError,
48 TemporaryError
49 };
50
51 QXmppPasswordReply(QObject *parent = nullptr);
52
53 QByteArray digest() const;
54 void setDigest(const QByteArray &digest);
55
56 QString password() const;
57 void setPassword(const QString &password);
58
59 QXmppPasswordReply::Error error() const;
60 void setError(QXmppPasswordReply::Error error);
61
62 bool isFinished() const;
63
64 Q_SLOT void finish();
65 Q_SLOT void finishLater();
66
68 Q_SIGNAL void finished();
69
70private:
71 QByteArray m_digest;
72 QString m_password;
73 QXmppPasswordReply::Error m_error;
74 bool m_isFinished;
75};
76
79
80 class QXMPP_EXPORT QXmppPasswordChecker
81{
82public:
83 virtual QXmppPasswordReply *checkPassword(const QXmppPasswordRequest &request);
84 virtual QXmppPasswordReply *getDigest(const QXmppPasswordRequest &request);
85 virtual bool hasGetPassword() const;
86
87protected:
88 virtual QXmppPasswordReply::Error getPassword(const QXmppPasswordRequest &request, QString &password);
89};
90
91#endif
QXmppPasswordChecker
The QXmppPasswordChecker class represents an abstract password checker.
Definition QXmppPasswordChecker.h:81
QXmppPasswordChecker::getPassword
virtual QXmppPasswordReply::Error getPassword(const QXmppPasswordRequest &request, QString &password)
Definition QXmppPasswordChecker.cpp:172
QXmppPasswordChecker::checkPassword
virtual QXmppPasswordReply * checkPassword(const QXmppPasswordRequest &request)
Definition QXmppPasswordChecker.cpp:123
QXmppPasswordChecker::hasGetPassword
virtual bool hasGetPassword() const
Returns true if the getPassword() method is implemented.
Definition QXmppPasswordChecker.cpp:180
QXmppPasswordChecker::getDigest
virtual QXmppPasswordReply * getDigest(const QXmppPasswordRequest &request)
Definition QXmppPasswordChecker.cpp:148
QXmppPasswordReply
The QXmppPasswordReply class represents a password reply.
Definition QXmppPasswordChecker.h:40
QXmppPasswordReply::finished
Q_SIGNAL void finished()
This signal is emitted when the reply has finished.
QXmppPasswordReply::QXmppPasswordReply
QXmppPasswordReply(QObject *parent=nullptr)
Constructs a new QXmppPasswordReply.
Definition QXmppPasswordChecker.cpp:51
QXmppPasswordReply::Error
Error
This enum is used to describe authentication errors.
Definition QXmppPasswordChecker.h:45
QXmppPasswordRequest
The QXmppPasswordRequest class represents a password request.
Definition QXmppPasswordChecker.h:15
QXmppPasswordRequest::Type
Type
This enum is used to describe request types.
Definition QXmppPasswordChecker.h:18