QXmpp Version: 1.10.0
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
14class 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
39class 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
64public Q_SLOTS:
65 void finish();
66 void finishLater();
67
68Q_SIGNALS:
70 void finished();
71
72private:
73 QByteArray m_digest;
74 QString m_password;
76 bool m_isFinished;
77};
78
81
82class QXMPP_EXPORT QXmppPasswordChecker
83{
84public:
85 virtual QXmppPasswordReply *checkPassword(const QXmppPasswordRequest &request);
86 virtual QXmppPasswordReply *getDigest(const QXmppPasswordRequest &request);
87 virtual bool hasGetPassword() const;
88
89protected:
90 virtual QXmppPasswordReply::Error getPassword(const QXmppPasswordRequest &request, QString &password);
91};
92
93#endif
The QXmppPasswordChecker class represents an abstract password checker.
Definition: QXmppPasswordChecker.h:83
The QXmppPasswordReply class represents a password reply.
Definition: QXmppPasswordChecker.h:40
void finished()
This signal is emitted when the reply has finished.
Error
This enum is used to describe authentication errors.
Definition: QXmppPasswordChecker.h:45
The QXmppPasswordRequest class represents a password request.
Definition: QXmppPasswordChecker.h:15
Type
This enum is used to describe request types.
Definition: QXmppPasswordChecker.h:18