summaryrefslogtreecommitdiffstats
path: root/src/core/authenticator_request_dialog_controller.h
blob: 98e8dcf901ef1458ac30c817afa18c64c39107c2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
// Copyright (C) 2023 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only

#ifndef AUTHENTICATOR_REQUEST_DIALOG_CONTROLLER_H
#define AUTHENTICATOR_REQUEST_DIALOG_CONTROLLER_H

#include <QtWebEngineCore/private/qtwebenginecoreglobal_p.h>
#include <QtCore/qobject.h>
#include "qwebenginewebauthuxrequest.h"

namespace content {
class WebContents;
class RenderFrameHost;
}
namespace QtWebEngineCore {

class AuthenticatorRequestDialogControllerPrivate;

class Q_WEBENGINECORE_EXPORT AuthenticatorRequestDialogController : public QObject
{
    Q_OBJECT
public:
    ~AuthenticatorRequestDialogController();
    void sendSelectAccountResponse(const QString &account);
    void sendCollectPinResponse(const QString &pin);
    QStringList userNames() const;
    QWebEngineWebAuthPinRequest pinRequest();
    void reject();
    AuthenticatorRequestDialogController(AuthenticatorRequestDialogControllerPrivate *);

    QWebEngineWebAuthUxRequest::WebAuthUxState state() const;
    QString relyingPartyId() const;
    void retryRequest();
    QWebEngineWebAuthUxRequest::RequestFailureReason requestFailureReason() const;

Q_SIGNALS:
    void stateChanged(QWebEngineWebAuthUxRequest::WebAuthUxState state);

private:
    void selectAccount(const QStringList &userList);
    void collectPin(QWebEngineWebAuthPinRequest pinRequest);
    void finishCollectToken();
    void startRequest(bool bIsConditionalRequest);
    void finishRequest();
    void setRelyingPartyId(const std::string &rpId);
    void handleRequestFailure(QWebEngineWebAuthUxRequest::RequestFailureReason reason);

    QScopedPointer<AuthenticatorRequestDialogControllerPrivate> d_ptr;
    friend class AuthenticatorRequestClientDelegateQt;
};
}

#endif // AUTHENTICATOR_REQUEST_DIALOG_CONTROLLER_H