Title: [129087] trunk/Source
Revision
129087
Author
[email protected]
Date
2012-09-19 19:34:43 -0700 (Wed, 19 Sep 2012)

Log 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 <[email protected]> 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):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (129086 => 129087)


--- trunk/Source/WebCore/ChangeLog	2012-09-20 02:07:27 UTC (rev 129086)
+++ trunk/Source/WebCore/ChangeLog	2012-09-20 02:34:43 UTC (rev 129087)
@@ -1,3 +1,29 @@
+2012-09-19  Sean Wang  <[email protected]>
+
+        [BlackBerry] Basic authentication challenge credentials for stored credentials again after restarting browser
+        https://bugs.webkit.org/show_bug.cgi?id=96362
+
+        Reviewed by Rob Buis.
+
+        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):
+
 2012-09-19  Shinya Kawanaka  <[email protected]>
 
         [Refactoring] ButtonInputType of <input> element should have innerElement to make <input> AuthorShadowDOM-ready

Modified: trunk/Source/WebCore/platform/network/blackberry/CredentialBackingStore.cpp (129086 => 129087)


--- trunk/Source/WebCore/platform/network/blackberry/CredentialBackingStore.cpp	2012-09-20 02:07:27 UTC (rev 129086)
+++ trunk/Source/WebCore/platform/network/blackberry/CredentialBackingStore.cpp	2012-09-20 02:34:43 UTC (rev 129087)
@@ -253,6 +253,32 @@
     return false;
 }
 
+ProtectionSpace CredentialBackingStore::getProtectionSpace(const KURL& url)
+{
+    ASSERT(m_database.isOpen());
+    ASSERT(m_database.tableExists("logins"));
+
+    if (!m_getLoginByURLStatement)
+        return ProtectionSpace();
+
+    m_getLoginByURLStatement->bindText(1, url.string());
+
+    int result = m_getLoginByURLStatement->step();
+    String username = m_getLoginByURLStatement->getColumnText(0);
+    String password = m_usingCertManager ? "" : m_getLoginByURLStatement->getColumnBlobAsString(1);
+    String host = m_getLoginByURLStatement->getColumnText(2);
+    int port = m_getLoginByURLStatement->getColumnInt(3);
+    int serviceType = m_getLoginByURLStatement->getColumnInt(4);
+    String realm = m_getLoginByURLStatement->getColumnText(5);
+    int authenticationScheme = m_getLoginByURLStatement->getColumnInt(6);
+    m_getLoginByURLStatement->reset();
+    HANDLE_SQL_EXEC_FAILURE(result != SQLResultRow, ProtectionSpace(),
+        "Failed to execute select login info from table logins in getLoginByURL - %i", result);
+
+    return ProtectionSpace (host, port, static_cast<ProtectionSpaceServerType>(serviceType),
+                            realm, static_cast<ProtectionSpaceAuthenticationScheme>(authenticationScheme));
+}
+
 Credential CredentialBackingStore::getLogin(const ProtectionSpace& protectionSpace)
 {
     ASSERT(m_database.isOpen());

Modified: trunk/Source/WebCore/platform/network/blackberry/CredentialBackingStore.h (129086 => 129087)


--- trunk/Source/WebCore/platform/network/blackberry/CredentialBackingStore.h	2012-09-20 02:07:27 UTC (rev 129086)
+++ trunk/Source/WebCore/platform/network/blackberry/CredentialBackingStore.h	2012-09-20 02:34:43 UTC (rev 129087)
@@ -44,6 +44,7 @@
     bool addLogin(const KURL&, const ProtectionSpace&, const Credential&);
     bool updateLogin(const KURL&, const ProtectionSpace&, const Credential&);
     bool hasLogin(const KURL&, const ProtectionSpace&);
+    ProtectionSpace getProtectionSpace(const KURL&);
     Credential getLogin(const ProtectionSpace&);
     Credential getLogin(const KURL&);
     bool removeLogin(const KURL&, const ProtectionSpace&);

Modified: trunk/Source/WebCore/platform/network/blackberry/NetworkManager.cpp (129086 => 129087)


--- trunk/Source/WebCore/platform/network/blackberry/NetworkManager.cpp	2012-09-20 02:07:27 UTC (rev 129086)
+++ trunk/Source/WebCore/platform/network/blackberry/NetworkManager.cpp	2012-09-20 02:34:43 UTC (rev 129087)
@@ -20,12 +20,18 @@
 #include "NetworkManager.h"
 
 #include "Chrome.h"
+#if ENABLE(BLACKBERRY_CREDENTIAL_PERSIST)
+#include "CredentialBackingStore.h"
+#endif
 #include "CredentialStorage.h"
 #include "Frame.h"
 #include "FrameLoaderClientBlackBerry.h"
 #include "NetworkJob.h"
 #include "Page.h"
 #include "ReadOnlyLatin1String.h"
+#if ENABLE(BLACKBERRY_CREDENTIAL_PERSIST)
+#include "ResourceHandleClient.h"
+#endif
 #include "ResourceHandleInternal.h"
 #include "ResourceRequest.h"
 #include "SecurityOrigin.h"
@@ -129,6 +135,14 @@
         // For URLs that match the paths of those previously challenged for HTTP Basic authentication,
         // try and reuse the credential preemptively, as allowed by RFC 2617.
         Credential credential = CredentialStorage::get(url);
+#if ENABLE(BLACKBERRY_CREDENTIAL_PERSIST)
+        // FIXME: needs to refactor the credentialBackingStore to get credential and protection space at one time.
+        if (credential.isEmpty() && guardJob->client()->shouldUseCredentialStorage(guardJob.get())) {
+            credential = credentialBackingStore().getLogin(url);
+            if (!credential.isEmpty())
+                CredentialStorage::set(credential, credentialBackingStore().getProtectionSpace(url), url);
+        }
+#endif
         if (!credential.isEmpty())
             platformRequest.setCredentials(credential.user().utf8().data(), credential.password().utf8().data(), BlackBerry::Platform::NetworkRequest::AuthHTTPBasic);
     }

Modified: trunk/Source/WebKit/blackberry/ChangeLog (129086 => 129087)


--- trunk/Source/WebKit/blackberry/ChangeLog	2012-09-20 02:07:27 UTC (rev 129086)
+++ trunk/Source/WebKit/blackberry/ChangeLog	2012-09-20 02:34:43 UTC (rev 129087)
@@ -1,3 +1,19 @@
+2012-09-19  Sean Wang  <[email protected]>
+
+        [BlackBerry] Basic authentication challenge credentials for stored credentials again after restarting browser
+        https://bugs.webkit.org/show_bug.cgi?id=96362
+
+        Reviewed by Rob Buis.
+
+        Make the FrameLoaderClient use credential storage according to the macro
+        BLACKBERRY_CREDENTIAL_PERSIST
+
+        * WebCoreSupport/FrameLoaderClientBlackBerry.cpp:
+        (WebCore::FrameLoaderClientBlackBerry::shouldUseCredentialStorage):
+        (WebCore):
+        * WebCoreSupport/FrameLoaderClientBlackBerry.h:
+        (FrameLoaderClientBlackBerry):
+
 2012-09-19  Mike Fenton  <[email protected]>
 
         [BlackBerry] After zooming into an input field, zoom out when focus is lost.

Modified: trunk/Source/WebKit/blackberry/WebCoreSupport/FrameLoaderClientBlackBerry.cpp (129086 => 129087)


--- trunk/Source/WebKit/blackberry/WebCoreSupport/FrameLoaderClientBlackBerry.cpp	2012-09-20 02:07:27 UTC (rev 129086)
+++ trunk/Source/WebKit/blackberry/WebCoreSupport/FrameLoaderClientBlackBerry.cpp	2012-09-20 02:34:43 UTC (rev 129087)
@@ -57,6 +57,9 @@
 #include "ProgressTracker.h"
 #include "ProtectionSpace.h"
 #include "ScopePointer.h"
+#if ENABLE(BLACKBERRY_CREDENTIAL_PERSIST)
+#include "Settings.h"
+#endif
 #include "SharedBuffer.h"
 #include "SkData.h"
 #include "SkImageEncoder.h"
@@ -1012,6 +1015,17 @@
     }
 }
 
+bool FrameLoaderClientBlackBerry::shouldUseCredentialStorage(DocumentLoader* loader, long unsigned identifier)
+{
+#if ENABLE(BLACKBERRY_CREDENTIAL_PERSIST)
+    if (m_frame->page()->settings()->privateBrowsingEnabled())
+        return false;
+    return true;
+#else
+    return false;
+#endif
+}
+
 void FrameLoaderClientBlackBerry::loadIconExternally(const String& originalPageUrl, const String& finalPageUrl, const String& iconUrl)
 {
     m_webPagePrivate->m_client->setIconForUrl(originalPageUrl.utf8().data(), finalPageUrl.utf8().data(), iconUrl.utf8().data());

Modified: trunk/Source/WebKit/blackberry/WebCoreSupport/FrameLoaderClientBlackBerry.h (129086 => 129087)


--- trunk/Source/WebKit/blackberry/WebCoreSupport/FrameLoaderClientBlackBerry.h	2012-09-20 02:07:27 UTC (rev 129086)
+++ trunk/Source/WebKit/blackberry/WebCoreSupport/FrameLoaderClientBlackBerry.h	2012-09-20 02:34:43 UTC (rev 129087)
@@ -56,7 +56,7 @@
     virtual void detachedFromParent3() { notImplemented(); }
     virtual void assignIdentifierToInitialRequest(long unsigned int, DocumentLoader*, const ResourceRequest&) { notImplemented(); }
     virtual void dispatchWillSendRequest(DocumentLoader*, long unsigned int, ResourceRequest&, const ResourceResponse&);
-    virtual bool shouldUseCredentialStorage(DocumentLoader*, long unsigned int) { notImplemented(); return false; }
+    virtual bool shouldUseCredentialStorage(DocumentLoader*, long unsigned);
     virtual void dispatchDidReceiveAuthenticationChallenge(DocumentLoader*, long unsigned int, const AuthenticationChallenge&) { notImplemented(); }
     virtual void dispatchDidCancelAuthenticationChallenge(DocumentLoader*, long unsigned int, const AuthenticationChallenge&) { notImplemented(); }
     virtual void dispatchDidReceiveResponse(DocumentLoader*, long unsigned int, const ResourceResponse&);
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to