Comparar commits
3 Commits
| Autor | SHA1 | Data | |
|---|---|---|---|
| 385f5312de | |||
| c43f35b392 | |||
| c44e66b782 |
@@ -68,11 +68,14 @@ bool AccountManager::restore()
|
||||
|
||||
bool AccountManager::restoreFromLegacySettings()
|
||||
{
|
||||
|
||||
// try to open the correctly themed settings
|
||||
auto settings = Account::settingsWithGroup(Theme::instance()->appName());
|
||||
|
||||
bool migratedCreds = false;
|
||||
|
||||
qDebug() << "LEGACY!" << Theme::instance()->appName() << settings->childKeys();
|
||||
|
||||
// if the settings file could not be opened, the childKeys list is empty
|
||||
// then try to load settings from a very old place
|
||||
if( settings->childKeys().isEmpty() ) {
|
||||
@@ -214,11 +217,15 @@ AccountPtr AccountManager::loadAccountHelper(QSettings& settings)
|
||||
QString authType = settings.value(QLatin1String(authTypeC)).toString();
|
||||
QString overrideUrl = Theme::instance()->overrideServerUrl();
|
||||
QString forceAuth = Theme::instance()->forceConfigAuthType();
|
||||
|
||||
qDebug() << "LOADING ACCOUNT" << authType << overrideUrl << forceAuth << settings.value(QLatin1String(urlC));
|
||||
|
||||
if(!forceAuth.isEmpty() && !overrideUrl.isEmpty() ) {
|
||||
// If forceAuth is set, this might also mean the overrideURL has changed.
|
||||
// See enterprise issues #1126
|
||||
acc->setUrl(overrideUrl);
|
||||
authType = forceAuth;
|
||||
qDebug() << "SHOULD NOT BE THERE !!!!!!";
|
||||
} else {
|
||||
acc->setUrl(settings.value(QLatin1String(urlC)).toUrl());
|
||||
}
|
||||
@@ -233,8 +240,12 @@ AccountPtr AccountManager::loadAccountHelper(QSettings& settings)
|
||||
acc->_settingsMap.insert(key, settings.value(key));
|
||||
}
|
||||
|
||||
qDebug() << acc->_settingsMap << "from" << settings.childKeys();
|
||||
|
||||
acc->setCredentials(CredentialsFactory::create(authType));
|
||||
|
||||
qDebug() << "Loaded Cred" << acc->credentials() << authType;
|
||||
|
||||
// now the cert, it is in the general group
|
||||
settings.beginGroup(QLatin1String("General"));
|
||||
acc->setApprovedCerts(QSslCertificate::fromData(settings.value(caCertsKeyC).toByteArray()));
|
||||
|
||||
@@ -18,6 +18,8 @@
|
||||
#include "creds/dummycredentials.h"
|
||||
#include "creds/shibbolethcredentials.h"
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
namespace OCC
|
||||
{
|
||||
|
||||
@@ -26,6 +28,7 @@ namespace CredentialsFactory
|
||||
|
||||
AbstractCredentials* create(const QString& type)
|
||||
{
|
||||
qDebug() << type;
|
||||
// empty string might happen for old version of configuration
|
||||
if (type == "http" || type == "") {
|
||||
return new HttpCredentialsGui;
|
||||
|
||||
@@ -53,7 +53,10 @@ ShibbolethCredentials::ShibbolethCredentials()
|
||||
_ready(false),
|
||||
_stillValid(false),
|
||||
_browser(0)
|
||||
{}
|
||||
{
|
||||
qDebug() << "HELO ShibbolethCredentials 1";
|
||||
|
||||
}
|
||||
|
||||
ShibbolethCredentials::ShibbolethCredentials(const QNetworkCookie& cookie)
|
||||
: _ready(true),
|
||||
@@ -61,6 +64,7 @@ ShibbolethCredentials::ShibbolethCredentials(const QNetworkCookie& cookie)
|
||||
_browser(0),
|
||||
_shibCookie(cookie)
|
||||
{
|
||||
qDebug() << "HELO ShibbolethCredentials 2" << cookie.toRawForm();
|
||||
}
|
||||
|
||||
void ShibbolethCredentials::setAccount(Account* account)
|
||||
@@ -72,6 +76,8 @@ void ShibbolethCredentials::setAccount(Account* account)
|
||||
_user = _account->credentialSetting(QLatin1String(userC)).toString();
|
||||
}
|
||||
|
||||
qDebug() << _user;
|
||||
|
||||
// When constructed with a cookie (by the wizard), we usually don't know the
|
||||
// user name yet. Request it now from the server.
|
||||
if (_ready && _user.isEmpty()) {
|
||||
@@ -107,13 +113,19 @@ QString ShibbolethCredentials::user() const
|
||||
QNetworkAccessManager* ShibbolethCredentials::getQNAM() const
|
||||
{
|
||||
QNetworkAccessManager* qnam(new AccessManager);
|
||||
connect(qnam, SIGNAL(finished(QNetworkReply*)),
|
||||
bool ok = connect(qnam, SIGNAL(finished(QNetworkReply*)),
|
||||
this, SLOT(slotReplyFinished(QNetworkReply*)));
|
||||
qDebug() << "QNAM creaded and connected" << ok;
|
||||
return qnam;
|
||||
}
|
||||
|
||||
void ShibbolethCredentials::slotReplyFinished(QNetworkReply* r)
|
||||
{
|
||||
qWarning() << r->request().url() << _browser << r->attribute(QNetworkRequest::HttpStatusCodeAttribute)
|
||||
<< r->attribute(QNetworkRequest::RedirectionTargetAttribute) << r->header(QNetworkRequest::LocationHeader);
|
||||
|
||||
|
||||
|
||||
if (!_browser.isNull()) {
|
||||
return;
|
||||
}
|
||||
@@ -163,6 +175,7 @@ bool ShibbolethCredentials::stillValid(QNetworkReply *reply)
|
||||
|
||||
void ShibbolethCredentials::persist()
|
||||
{
|
||||
qDebug() << _shibCookie;
|
||||
storeShibCookie(_shibCookie);
|
||||
if (!_user.isEmpty()) {
|
||||
_account->setCredentialSetting(QLatin1String(userC), _user);
|
||||
@@ -201,6 +214,7 @@ void ShibbolethCredentials::onShibbolethCookieReceived(const QNetworkCookie& shi
|
||||
{
|
||||
storeShibCookie(shibCookie);
|
||||
_shibCookie = shibCookie;
|
||||
qDebug() << _shibCookie;
|
||||
addToCookieJar(shibCookie);
|
||||
|
||||
slotFetchUser();
|
||||
@@ -252,10 +266,13 @@ void ShibbolethCredentials::slotBrowserRejected()
|
||||
|
||||
void ShibbolethCredentials::slotReadJobDone(QKeychain::Job *job)
|
||||
{
|
||||
qDebug() << "FROM KEYCHAIN" << job->error();
|
||||
|
||||
if (job->error() == QKeychain::NoError) {
|
||||
ReadPasswordJob *readJob = static_cast<ReadPasswordJob*>(job);
|
||||
delete readJob->settings();
|
||||
QList<QNetworkCookie> cookies = QNetworkCookie::parseCookies(readJob->textData().toUtf8());
|
||||
qDebug() <<readJob->textData() << cookies.count();
|
||||
if (cookies.count() > 0) {
|
||||
_shibCookie = cookies.first();
|
||||
addToCookieJar(_shibCookie);
|
||||
@@ -274,6 +291,9 @@ void ShibbolethCredentials::slotReadJobDone(QKeychain::Job *job)
|
||||
|
||||
void ShibbolethCredentials::showLoginWindow()
|
||||
{
|
||||
qWarning() << "SHOW LOGIN WINDOW " << _browser;
|
||||
|
||||
|
||||
if (!_browser.isNull()) {
|
||||
ownCloudGui::raiseDialog(_browser);
|
||||
return;
|
||||
|
||||
@@ -839,6 +839,10 @@ void ownCloudGui::slotHelp()
|
||||
|
||||
void ownCloudGui::raiseDialog( QWidget *raiseWidget )
|
||||
{
|
||||
qDebug() << "RAISE " << raiseWidget;
|
||||
if (raiseWidget) qDebug() << raiseWidget->parentWidget() << raiseWidget->isVisible();
|
||||
|
||||
|
||||
if( raiseWidget && raiseWidget->parentWidget() == 0) {
|
||||
// Qt has a bug which causes parent-less dialogs to pop-under.
|
||||
raiseWidget->showNormal();
|
||||
|
||||
@@ -155,6 +155,10 @@ QNetworkReply *AbstractNetworkJob::deleteRequest(const QUrl &url)
|
||||
|
||||
void AbstractNetworkJob::slotFinished()
|
||||
{
|
||||
|
||||
qWarning() << reply()->request().url() << reply()->attribute(QNetworkRequest::HttpStatusCodeAttribute) << _followRedirects << reply()->attribute(QNetworkRequest::RedirectionTargetAttribute) <<
|
||||
reply()->header(QNetworkRequest::LocationHeader);
|
||||
|
||||
_timer.stop();
|
||||
|
||||
if( _reply->error() == QNetworkReply::SslHandshakeFailedError ) {
|
||||
|
||||
@@ -103,6 +103,8 @@ static bool isEqualExceptProtocol(const QUrl &url1, const QUrl &url2)
|
||||
|
||||
bool Account::changed(AccountPtr other, bool ignoreUrlProtocol) const
|
||||
{
|
||||
qDebug() << _credentials << other->credentials();
|
||||
|
||||
if (!other) {
|
||||
return false;
|
||||
}
|
||||
@@ -125,6 +127,8 @@ AbstractCredentials *Account::credentials() const
|
||||
|
||||
void Account::setCredentials(AbstractCredentials *cred)
|
||||
{
|
||||
qDebug() << this << cred;
|
||||
|
||||
// set active credential manager
|
||||
QNetworkCookieJar *jar = 0;
|
||||
if (_am) {
|
||||
|
||||
@@ -185,6 +185,10 @@ void ConnectionValidator::slotAuthFailed(QNetworkReply *reply)
|
||||
{
|
||||
Status stat = Timeout;
|
||||
|
||||
|
||||
qWarning() << reply->error() << _account->credentials()->stillValid(reply) << reply->attribute(QNetworkRequest::HttpStatusCodeAttribute);
|
||||
|
||||
|
||||
if( reply->error() == QNetworkReply::AuthenticationRequiredError ||
|
||||
!_account->credentials()->stillValid(reply)) {
|
||||
qDebug() << reply->error() << reply->errorString();
|
||||
|
||||
Referência em uma Nova Issue
Bloquear um usuário