QXmpp Version: 1.4.0
Loading...
Searching...
No Matches
QXmppPasswordChecker.h
1/*
2 * Copyright (C) 2008-2021 The QXmpp developers
3 *
4 * Author:
5 * Jeremy Lainé
6 *
7 * Source:
8 * https://github.com/qxmpp-project/qxmpp
9 *
10 * This file is a part of QXmpp library.
11 *
12 * This library is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU Lesser General Public
14 * License as published by the Free Software Foundation; either
15 * version 2.1 of the License, or (at your option) any later version.
16 *
17 * This library is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * Lesser General Public License for more details.
21 *
22 */
23
24#ifndef QXMPPPASSWORDCHECKER_H
25#define QXMPPPASSWORDCHECKER_H
26
27#include "QXmppGlobal.h"
28
29#include <QObject>
30
33class QXMPP_EXPORT QXmppPasswordRequest
34{
35public:
37 enum Type {
38 CheckPassword = 0
39 };
40
41 QString domain() const;
42 void setDomain(const QString &domain);
43
44 QString password() const;
45 void setPassword(const QString &password);
46
47 QString username() const;
48 void setUsername(const QString &username);
49
50private:
51 QString m_domain;
52 QString m_password;
53 QString m_username;
54};
55
58class QXMPP_EXPORT QXmppPasswordReply : public QObject
59{
60 Q_OBJECT
61
62public:
64 enum Error {
65 NoError = 0,
66 AuthorizationError,
67 TemporaryError
68 };
69
70 QXmppPasswordReply(QObject *parent = nullptr);
71
72 QByteArray digest() const;
73 void setDigest(const QByteArray &digest);
74
75 QString password() const;
76 void setPassword(const QString &password);
77
78 QXmppPasswordReply::Error error() const;
79 void setError(QXmppPasswordReply::Error error);
80
81 bool isFinished() const;
82
83public Q_SLOTS:
84 void finish();
85 void finishLater();
86
87Q_SIGNALS:
89 void finished();
90
91private:
92 QByteArray m_digest;
93 QString m_password;
95 bool m_isFinished;
96};
97
100
101class QXMPP_EXPORT QXmppPasswordChecker
102{
103public:
104 virtual QXmppPasswordReply *checkPassword(const QXmppPasswordRequest &request);
105 virtual QXmppPasswordReply *getDigest(const QXmppPasswordRequest &request);
106 virtual bool hasGetPassword() const;
107
108protected:
109 virtual QXmppPasswordReply::Error getPassword(const QXmppPasswordRequest &request, QString &password);
110};
111
112#endif
The QXmppPasswordChecker class represents an abstract password checker.
Definition: QXmppPasswordChecker.h:102
The QXmppPasswordReply class represents a password reply.
Definition: QXmppPasswordChecker.h:59
void finished()
This signal is emitted when the reply has finished.
Error
This enum is used to describe authentication errors.
Definition: QXmppPasswordChecker.h:64
The QXmppPasswordRequest class represents a password request.
Definition: QXmppPasswordChecker.h:34
Type
This enum is used to describe request types.
Definition: QXmppPasswordChecker.h:37