Hello,
I'm using QAccessNetworkManager to download data from a URL.
In order to provide Basic Authentication, I connect signal authenticationRequired() which is called everytime the server challenge the client.
My applications cache username & password (even if the application exits, his password is stored and is reused) and slot for authenticationRequired() just returns the cache of username & password.
void authenticationRequired (QNetworkReply * reply, QAuthenticator *authenticator) {
authenticator->setUser(getCacheUsername());
authenticator->setPassword(getCachePassword());
}
void authenticationRequired (QNetworkReply * reply, QAuthenticator *authenticator) {
authenticator->setUser(getCacheUsername());
authenticator->setPassword(getCachePassword());
}
To copy to clipboard, switch view to plain text mode
Suppose that password is incorrect, then the slot always returns incorrect data and server continue to challenge client again and authenticationRequired() continue to returns incorrect credentials and the server challenge again.... that will happens for ever and application is loop !
I think my problem is quite typical for all application which cache password of user. What is the best practice to solve this problem?
Thank you very much
Hai
Bookmarks