Now that fetchFromKeychain is solely called from AccountState::slotInvalidCredentials
and that this one already protects the fetch call using _waitingForNewCredentials,
we can remove that extra check.
_url(),
_ready(false),
_stillValid(false),
- _fetchJobInProgress(false),
_browser(0)
{}
ShibbolethCredentials::ShibbolethCredentials(const QNetworkCookie& cookie)
: _ready(true),
_stillValid(true),
- _fetchJobInProgress(false),
_browser(0),
_shibCookie(cookie)
{
void ShibbolethCredentials::fetchFromKeychain()
{
- if(_fetchJobInProgress) {
- return;
- }
-
if (_user.isEmpty()) {
_user = _account->credentialSetting(QLatin1String(userC)).toString();
}
if (_ready) {
- _fetchJobInProgress = false;
Q_EMIT fetched();
} else {
_url = _account->url();
job->setKey(keychainKey(_account->url().toString(), "shibAssertion"));
connect(job, SIGNAL(finished(QKeychain::Job*)), SLOT(slotReadJobDone(QKeychain::Job*)));
job->start();
- _fetchJobInProgress = true;
}
}
void ShibbolethCredentials::invalidateToken()
{
_ready = false;
- _fetchJobInProgress = true;
CookieJar *jar = static_cast<CookieJar*>(_account->networkAccessManager()->cookieJar());
_stillValid = true;
_ready = true;
- _fetchJobInProgress = false;
Q_EMIT asked();
}
void ShibbolethCredentials::slotBrowserRejected()
{
_ready = false;
- _fetchJobInProgress = false;
Q_EMIT asked();
}
_ready = true;
_stillValid = true;
- _fetchJobInProgress = false;
Q_EMIT fetched();
} else {
_ready = false;
- _fetchJobInProgress = false;
Q_EMIT fetched();
}
}
bool _ready;
bool _stillValid;
- bool _fetchJobInProgress;
QPointer<ShibbolethWebView> _browser;
QNetworkCookie _shibCookie;
QString _user;
} // ns
HttpCredentials::HttpCredentials()
- : _ready(false),
- _fetchJobInProgress(false)
+ : _ready(false)
{
}
_password(password),
_ready(true),
_certificatePath(certificatePath),
- _certificatePasswd(certificatePasswd),
- _fetchJobInProgress(false)
+ _certificatePasswd(certificatePasswd)
{
}
void HttpCredentials::fetchFromKeychain()
{
- // FIXME: Should this check go if we check in AccountState instead?
- if (_fetchJobInProgress) {
- return;
- }
-
// User must be fetched from config file
fetchUser();
_certificatePath = _account->credentialSetting(QLatin1String(certifPathC)).toString();
job->setKey(kck);
connect(job, SIGNAL(finished(QKeychain::Job*)), SLOT(slotReadJobDone(QKeychain::Job*)));
job->start();
- _fetchJobInProgress = true;
}
}
bool HttpCredentials::stillValid(QNetworkReply *reply)
QKeychain::Error error = job->error();
- _fetchJobInProgress = false;
if( !_password.isEmpty() && error == NoError ) {
// All cool, the keychain did not come back with error.
private:
QString _certificatePath;
QString _certificatePasswd;
- bool _fetchJobInProgress; //True if the keychain job is in progress or the input dialog visible
};
} // namespace OCC