Changeset 129087 in webkit


Ignore:
Timestamp:
Sep 19, 2012 7:34:43 PM (12 years ago)
Author:
commit-queue@webkit.org
Message:

[BlackBerry] Basic authentication challenge credentials for stored credentials again after restarting browser
https://bugs.webkit.org/show_bug.cgi?id=96362

Patch by Sean Wang <Xuewen.Wang@torchmobile.com.cn> on 2012-09-19
Reviewed by Rob Buis.

Source/WebCore:

This patch enable reading credentials from the persistent credential storage
when it is not private browsing mode and there is not a credential in the RAM
for the requested resource.

Since we don't load persistent stored credentials into RAM at the starting time,
even we have saved the credentials at the last browsing, after restarting the browser,
it will still challenge for credentials for the requesting resources.

No new tests, it uses the original authentication tests. There is no way to
clear all credentials or restarting browsers to test this feature.

  • platform/network/blackberry/CredentialBackingStore.cpp:

(WebCore::CredentialBackingStore::getProtectionSpace):
(WebCore):

  • platform/network/blackberry/CredentialBackingStore.h:

(CredentialBackingStore):

  • platform/network/blackberry/NetworkManager.cpp:

(WebCore::NetworkManager::startJob):

Source/WebKit/blackberry:

Make the FrameLoaderClient use credential storage according to the macro
BLACKBERRY_CREDENTIAL_PERSIST

  • WebCoreSupport/FrameLoaderClientBlackBerry.cpp:

(WebCore::FrameLoaderClientBlackBerry::shouldUseCredentialStorage):
(WebCore):

  • WebCoreSupport/FrameLoaderClientBlackBerry.h:

(FrameLoaderClientBlackBerry):

Location:
trunk/Source
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r129086 r129087  
     12012-09-19  Sean Wang  <Xuewen.Wang@torchmobile.com.cn>
     2
     3        [BlackBerry] Basic authentication challenge credentials for stored credentials again after restarting browser
     4        https://bugs.webkit.org/show_bug.cgi?id=96362
     5
     6        Reviewed by Rob Buis.
     7
     8        This patch enable reading credentials from the persistent credential storage
     9        when it is not private browsing mode and there is not a credential in the RAM
     10        for the requested resource.
     11
     12        Since we don't load persistent stored credentials into RAM at the starting time,
     13        even we have saved the credentials at the last browsing, after restarting the browser,
     14        it will still challenge for credentials for the requesting resources.
     15
     16        No new tests, it uses the original authentication tests. There is no way to
     17        clear all credentials or restarting browsers to test this feature.
     18
     19        * platform/network/blackberry/CredentialBackingStore.cpp:
     20        (WebCore::CredentialBackingStore::getProtectionSpace):
     21        (WebCore):
     22        * platform/network/blackberry/CredentialBackingStore.h:
     23        (CredentialBackingStore):
     24        * platform/network/blackberry/NetworkManager.cpp:
     25        (WebCore::NetworkManager::startJob):
     26
    1272012-09-19  Shinya Kawanaka  <shinyak@chromium.org>
    228
  • trunk/Source/WebCore/platform/network/blackberry/CredentialBackingStore.cpp

    r128312 r129087  
    254254}
    255255
     256ProtectionSpace CredentialBackingStore::getProtectionSpace(const KURL& url)
     257{
     258    ASSERT(m_database.isOpen());
     259    ASSERT(m_database.tableExists("logins"));
     260
     261    if (!m_getLoginByURLStatement)
     262        return ProtectionSpace();
     263
     264    m_getLoginByURLStatement->bindText(1, url.string());
     265
     266    int result = m_getLoginByURLStatement->step();
     267    String username = m_getLoginByURLStatement->getColumnText(0);
     268    String password = m_usingCertManager ? "" : m_getLoginByURLStatement->getColumnBlobAsString(1);
     269    String host = m_getLoginByURLStatement->getColumnText(2);
     270    int port = m_getLoginByURLStatement->getColumnInt(3);
     271    int serviceType = m_getLoginByURLStatement->getColumnInt(4);
     272    String realm = m_getLoginByURLStatement->getColumnText(5);
     273    int authenticationScheme = m_getLoginByURLStatement->getColumnInt(6);
     274    m_getLoginByURLStatement->reset();
     275    HANDLE_SQL_EXEC_FAILURE(result != SQLResultRow, ProtectionSpace(),
     276        "Failed to execute select login info from table logins in getLoginByURL - %i", result);
     277
     278    return ProtectionSpace (host, port, static_cast<ProtectionSpaceServerType>(serviceType),
     279                            realm, static_cast<ProtectionSpaceAuthenticationScheme>(authenticationScheme));
     280}
     281
    256282Credential CredentialBackingStore::getLogin(const ProtectionSpace& protectionSpace)
    257283{
  • trunk/Source/WebCore/platform/network/blackberry/CredentialBackingStore.h

    r128312 r129087  
    4545    bool updateLogin(const KURL&, const ProtectionSpace&, const Credential&);
    4646    bool hasLogin(const KURL&, const ProtectionSpace&);
     47    ProtectionSpace getProtectionSpace(const KURL&);
    4748    Credential getLogin(const ProtectionSpace&);
    4849    Credential getLogin(const KURL&);
  • trunk/Source/WebCore/platform/network/blackberry/NetworkManager.cpp

    r128182 r129087  
    2121
    2222#include "Chrome.h"
     23#if ENABLE(BLACKBERRY_CREDENTIAL_PERSIST)
     24#include "CredentialBackingStore.h"
     25#endif
    2326#include "CredentialStorage.h"
    2427#include "Frame.h"
     
    2730#include "Page.h"
    2831#include "ReadOnlyLatin1String.h"
     32#if ENABLE(BLACKBERRY_CREDENTIAL_PERSIST)
     33#include "ResourceHandleClient.h"
     34#endif
    2935#include "ResourceHandleInternal.h"
    3036#include "ResourceRequest.h"
     
    130136        // try and reuse the credential preemptively, as allowed by RFC 2617.
    131137        Credential credential = CredentialStorage::get(url);
     138#if ENABLE(BLACKBERRY_CREDENTIAL_PERSIST)
     139        // FIXME: needs to refactor the credentialBackingStore to get credential and protection space at one time.
     140        if (credential.isEmpty() && guardJob->client()->shouldUseCredentialStorage(guardJob.get())) {
     141            credential = credentialBackingStore().getLogin(url);
     142            if (!credential.isEmpty())
     143                CredentialStorage::set(credential, credentialBackingStore().getProtectionSpace(url), url);
     144        }
     145#endif
    132146        if (!credential.isEmpty())
    133147            platformRequest.setCredentials(credential.user().utf8().data(), credential.password().utf8().data(), BlackBerry::Platform::NetworkRequest::AuthHTTPBasic);
  • trunk/Source/WebKit/blackberry/ChangeLog

    r129044 r129087  
     12012-09-19  Sean Wang  <Xuewen.Wang@torchmobile.com.cn>
     2
     3        [BlackBerry] Basic authentication challenge credentials for stored credentials again after restarting browser
     4        https://bugs.webkit.org/show_bug.cgi?id=96362
     5
     6        Reviewed by Rob Buis.
     7
     8        Make the FrameLoaderClient use credential storage according to the macro
     9        BLACKBERRY_CREDENTIAL_PERSIST
     10
     11        * WebCoreSupport/FrameLoaderClientBlackBerry.cpp:
     12        (WebCore::FrameLoaderClientBlackBerry::shouldUseCredentialStorage):
     13        (WebCore):
     14        * WebCoreSupport/FrameLoaderClientBlackBerry.h:
     15        (FrameLoaderClientBlackBerry):
     16
    1172012-09-19  Mike Fenton  <mifenton@rim.com>
    218
  • trunk/Source/WebKit/blackberry/WebCoreSupport/FrameLoaderClientBlackBerry.cpp

    r129010 r129087  
    5858#include "ProtectionSpace.h"
    5959#include "ScopePointer.h"
     60#if ENABLE(BLACKBERRY_CREDENTIAL_PERSIST)
     61#include "Settings.h"
     62#endif
    6063#include "SharedBuffer.h"
    6164#include "SkData.h"
     
    10131016}
    10141017
     1018bool FrameLoaderClientBlackBerry::shouldUseCredentialStorage(DocumentLoader* loader, long unsigned identifier)
     1019{
     1020#if ENABLE(BLACKBERRY_CREDENTIAL_PERSIST)
     1021    if (m_frame->page()->settings()->privateBrowsingEnabled())
     1022        return false;
     1023    return true;
     1024#else
     1025    return false;
     1026#endif
     1027}
     1028
    10151029void FrameLoaderClientBlackBerry::loadIconExternally(const String& originalPageUrl, const String& finalPageUrl, const String& iconUrl)
    10161030{
  • trunk/Source/WebKit/blackberry/WebCoreSupport/FrameLoaderClientBlackBerry.h

    r128211 r129087  
    5757    virtual void assignIdentifierToInitialRequest(long unsigned int, DocumentLoader*, const ResourceRequest&) { notImplemented(); }
    5858    virtual void dispatchWillSendRequest(DocumentLoader*, long unsigned int, ResourceRequest&, const ResourceResponse&);
    59     virtual bool shouldUseCredentialStorage(DocumentLoader*, long unsigned int) { notImplemented(); return false; }
     59    virtual bool shouldUseCredentialStorage(DocumentLoader*, long unsigned);
    6060    virtual void dispatchDidReceiveAuthenticationChallenge(DocumentLoader*, long unsigned int, const AuthenticationChallenge&) { notImplemented(); }
    6161    virtual void dispatchDidCancelAuthenticationChallenge(DocumentLoader*, long unsigned int, const AuthenticationChallenge&) { notImplemented(); }
Note: See TracChangeset for help on using the changeset viewer.