Ejemplo n.º 1
0
void ShibbolethWebView::onNewCookiesForUrl (const QList<QNetworkCookie>& cookieList, const QUrl& url)
{
    if (url.host() == _account->url().host()) {
        QNetworkCookie shibCookie = ShibbolethCredentials::findShibCookie(_account.data(), cookieList);
        if (shibCookie != QNetworkCookie()) {
            Q_EMIT shibbolethCookieReceived(shibCookie);
            accept();
            close();
        }
    }
}
Ejemplo n.º 2
0
void OwncloudShibbolethCredsPage::disposeBrowser()
{
    if (_browser) {
        disconnect(_browser, SIGNAL(otherCookiesReceived(QList<QNetworkCookie>, QUrl)),
                   this, SLOT(slotOtherCookiesReceived(QList<QNetworkCookie>, QUrl)));
        disconnect(_browser, SIGNAL(viewHidden()),
                   this, SLOT(slotViewHidden()));
        disconnect(_browser, SIGNAL(shibbolethCookieReceived(QNetworkCookie)),
                   this, SLOT(slotShibbolethCookieReceived(QNetworkCookie)));
        _browser->hide();
        _browser->deleteLater();
        _browser = 0;
    }
}
Ejemplo n.º 3
0
void OwncloudShibbolethCredsPage::setupBrowser()
{
    if (_browser) {
        return;
    }
    OwncloudWizard *ocWizard = qobject_cast<OwncloudWizard*>(wizard());
    _browser = new ShibbolethWebView(ocWizard->account());
    connect(_browser, SIGNAL(shibbolethCookieReceived(QNetworkCookie)),
            this, SLOT(slotShibbolethCookieReceived(QNetworkCookie)));
    connect(_browser, SIGNAL(viewHidden()),
            this, SLOT(slotViewHidden()));
    connect(_browser, SIGNAL(otherCookiesReceived(QList<QNetworkCookie>, QUrl)),
            this, SLOT(slotOtherCookiesReceived(QList<QNetworkCookie>, QUrl)));

    _browser->show();
    _browser->setFocus();
}
Ejemplo n.º 4
0
void ShibbolethCredentials::fetch(Account *account)
{
    if (_ready) {
        Q_EMIT fetched();
    } else {
        ShibbolethConfigFile cfg;
        if (account) {
            _url = account->url();
        }
        _browser = new ShibbolethWebView(account, cfg.createCookieJar());
        connect(_browser, SIGNAL(shibbolethCookieReceived(QNetworkCookie)),
                this, SLOT(onShibbolethCookieReceived(QNetworkCookie)));
        connect(_browser, SIGNAL(viewHidden()),
                this, SLOT(slotBrowserHidden()));
        _browser->show ();
    }
}
Ejemplo n.º 5
0
void ShibbolethWebView::onNewCookiesForUrl (const QList<QNetworkCookie>& cookieList, const QUrl& url)
{
  QList<QNetworkCookie> otherCookies;
  QNetworkCookie shibCookie;

  Q_FOREACH (const QNetworkCookie& cookie, cookieList) {
    if (cookie.name().startsWith ("_shibsession_")) {
      if (shibCookie.name().isEmpty()) {
        shibCookie = cookie;
      } else {
        qWarning() << "Too many Shibboleth session cookies at once!";
      }
    } else {
      otherCookies << cookie;
    }
  }

  if (!otherCookies.isEmpty()) {
    Q_EMIT otherCookiesReceived(otherCookies, url);
  }
  if (!shibCookie.name().isEmpty()) {
    Q_EMIT shibbolethCookieReceived(shibCookie, _account);
  }
}