In MVC architecture, this is the controller for the corresponding AuthenticationView. More...
Header: | #include <AuthenticationController> |
Inherits: | QObject |
Properties
|
|
Public Functions
AuthenticationController(QObject *parent = nullptr) | |
virtual | ~AuthenticationController() override |
void | addClientCertificate(const QUrl &clientCertificate, const QString &password = QString{}) |
void | cancel() |
void | cancelWithError(const QString &title, const QString &html) |
QStringList | clientCertificateInfos() const |
void | continueWithClientCertificate(int clientCertificateIndex) |
void | continueWithOAuthAuthorizationCode(const QString &oAuthAuthorizationCode) |
void | continueWithSslHandshake(bool trust, bool remember) |
void | continueWithUsernamePassword(const QString &username, const QString &password) |
QString | currentAuthenticatingHost() const |
int | currentChallengeFailureCount() const |
int | currentChallengeType() const |
QUrl | currentChallengeUrl() const |
bool | deleteChallengeOnProcessed() const |
void | setDeleteChallengeOnProcessed(bool deleteFlag) |
Signals
void | clientCertificateInfosChanged() |
void | clientCertificatePasswordRequired(QUrl certificate) |
void | currentChallengeChanged() |
Detailed Description
This controller is a thin wrapper around the AuthenticationManager. As AuthenticationManager challenges are queued, the controller holds onto a "current" challenge, which is the challenge the user is presented with, which will be discarded once the user chooses an action to perform on the challenge.
Property Documentation
[read-only]
clientCertificateInfos : const QStringList
List of strings representing the certificates held by the AuthenticationManager.
Access functions:
QStringList | clientCertificateInfos() const |
Notifier signal:
[read-only]
currentAuthenticatingHost : const QString
Authenticating host of current challenge.
Access functions:
QString | currentAuthenticatingHost() const |
Notifier signal:
void | currentChallengeChanged() |
[read-only]
currentChallengeFailureCount : const int
Failure count of current challenge.
Access functions:
int | currentChallengeFailureCount() const |
Notifier signal:
void | currentChallengeChanged() |
[read-only]
currentChallengeType : const int
Type of current challenge.
Access functions:
int | currentChallengeType() const |
Notifier signal:
void | currentChallengeChanged() |
[read-only]
currentChallengeUrl : const QUrl
This property holds the Url of the current challenge.
Access functions:
QUrl | currentChallengeUrl() const |
Notifier signal:
void | currentChallengeChanged() |
Member Function Documentation
[explicit invokable]
AuthenticationController::AuthenticationController (QObject *parent = nullptr)
Constructor
- parent Owning QObject.
Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.
[override virtual]
AuthenticationController::~AuthenticationController ()
Destructor.
[invokable]
void AuthenticationController::addClientCertificate (const QUrl &clientCertificate , const QString &password = QString{})
Adds a certificate and password to the AuthenticationManager.
- clientCertificate Url of certificate to add.
- password Optional password to open certificate.
Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.
See also clientCertificateInfos.
[invokable]
void AuthenticationController::cancel()
Calls cancel
on the current challenge.
Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.
[invokable]
void AuthenticationController::cancelWithError (const QString &title, const QString &html)
Calls cancelWithError
on the current challenge, with the title and the html content from the web view.
Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.
QStringList AuthenticationController::clientCertificateInfos () const
Returns the list of ClientCertificateInfo strings currently held by the AuthenticationManager.
Note: Getter function for property clientCertificateInfos.
See also addClientCertificate.
[signal]
void AuthenticationController::clientCertificateInfosChanged ()
Emitted when the clientCertificateInfos updates.
Note: Notifier signal for property clientCertificateInfos.
See also clientCertificateInfos.
[signal]
void AuthenticationController::clientCertificatePasswordRequired (QUrl certificate)
Emitted when a certificate that was added to the AuthenticationManager requires a password.
See also addClientCertificate.
[invokable]
void AuthenticationController::continueWithClientCertificate (int clientCertificateIndex )
Calls continueWithClientCertificate
on the current challenge.
- clientCertificateIndex The index is the index of the certificate as seen in clientCertificateInfos.
Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.
[invokable]
void AuthenticationController::continueWithOAuthAuthorizationCode (const QString &oAuthAuthorizationCode )
Calls continueWithOAuthAuthorizationCode
on the current challenge.
- oAuthAuthorizationCode Authorization code.
Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.
[invokable]
void AuthenticationController::continueWithSslHandshake (bool trust, bool remember)
Calls continueWithSslHandshake
on the current challenge.
- trust When true, trusts the misconfigured resource.
- remember Remember the user's preferences this session.
Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.
[invokable]
void AuthenticationController::continueWithUsernamePassword (const QString &username, const QString &password)
Calls continueWithUsernamePassword
on the current challenge.
- username Username string.
- password Password string.
Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.
QString AuthenticationController::currentAuthenticatingHost () const
Returns the authorization hostname of the current AuthenticationChallenge.
Note: Getter function for property currentAuthenticatingHost.
[signal]
void AuthenticationController::currentChallengeChanged ()
Emitted when the reference to the current challenge changes.
Note: Notifier signal for property currentAuthenticatingHost. Notifier signal for property currentChallengeFailureCount. Notifier signal for property currentChallengeType. Notifier signal for property currentChallengeUrl.
int AuthenticationController::currentChallengeFailureCount () const
Returns the failure count of the current AuthenticationChallenge.
Note: Getter function for property currentChallengeFailureCount.
int AuthenticationController::currentChallengeType () const
Returns the type of the current challenge as an int.
Challenge type | Constant |
---|---|
Unknown | 0 |
UsernamePassword | 1 |
OAuth | 2 |
ClientCertificate | 3 |
SslHandshake | 4 |
Note: Getter function for property currentChallengeType.
QUrl AuthenticationController::currentChallengeUrl () const
Returns the authorization url of the current AuthenticationChallenge.
Note: Getter function for property currentChallengeUrl.
bool AuthenticationController::deleteChallengeOnProcessed () const
After a challenge has been processed, the AuthenticationController clears the reference to the currently held challenge. When the returned value is true
then the challenge is also deleted when the reference is cleared.
In most cases it is desired to for the controller to clean up challenges that have been processed, but this options may be turned off in cases where there may be additional references to the AuthenticationChallenge emitted by the AuthenticationManager in the codebase.
Defaults to true
.
See also setDeleteChallengeOnProcessed.
void AuthenticationController::setDeleteChallengeOnProcessed (bool deleteFlag )
Sets the deleteChallengeOnProcessed flag.
- deleteFlag When
true
, the current challenge is deleted after it has been processed. Otherwise the challenge is not deleted after processing.
See also deleteChallengeOnProcessed.