[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-10851-g50815da

beidson at apple.com beidson at apple.com
Wed Dec 22 17:58:24 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 18c0c1ad3ce066ef3a46cf2a9a9e23c46a1f6abe
Author: beidson at apple.com <beidson at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Dec 3 19:41:49 2010 +0000

    Groundwork for <rdar://problem/7660733> and https://bugs.webkit.org/show_bug.cgi?id=50191
    WebKit2 Authentication Support
    
    Reviewed by Anders Carlsson.
    
    WebCore:
    
    * WebCore.exp.in:
    
    Expose the AuthenticationClient for WK2 platforms (Windows already does this):
    * platform/network/mac/AuthenticationChallenge.h:
    * platform/network/mac/AuthenticationMac.mm:
    (-[WebCoreAuthenticationClientAsChallengeSender client]):
    (WebCore::AuthenticationChallenge::authenticationClient):
    
    * platform/network/qt/AuthenticationChallenge.h:
    (WebCore::AuthenticationChallenge::authenticationClient):
    
    WebKit2:
    
    With this patch in place, authentication challenges are sent up from WebCore and shipped over the IPC layer.
    Client apps can implement the related client methods to attempt to continue without credentials or cancel a
    challenge.
    
    There's not yet API to inspect a challenge or create a credential to use in reply - that will come later.
    
    Build-system changes:
    * DerivedSources.make:
    * DerivedSources.pro:
    * WebKit2.pro:
    * WebKit2.xcodeproj/project.pbxproj:
    * win/WebKit2.vcproj:
    * win/WebKit2Common.vsprops:
    
    Messages and casts for IPC and APIs:
    * Platform/CoreIPC/MessageID.h:
    * Shared/API/c/WKBase.h:
    * Shared/APIObject.h:
    * Shared/WebCoreArgumentCoders.h:
    * UIProcess/API/C/WKAPICast.h:
    * WebProcess/WebProcess.cpp:
    (WebKit::WebProcess::didReceiveMessage):
    
    Stub out the AuthenticationChallenge class family:
    * UIProcess/API/C/WKAuthenticationChallenge.cpp: Added.
    (WKAuthenticationChallengeGetTypeID):
    * UIProcess/API/C/WKAuthenticationChallenge.h: Added.
    * UIProcess/API/C/WKCredential.cpp: Added.
    (WKCredentialGetTypeID):
    * UIProcess/API/C/WKCredential.h: Added.
    * UIProcess/API/C/WKProtectionSpace.cpp: Added.
    (WKProtectionSpaceGetTypeID):
    * UIProcess/API/C/WKProtectionSpace.h: Added.
    
    Add an Authentication listener for the client app to respond to:
    * UIProcess/API/C/WKAuthenticationDecisionListener.cpp: Added.
    (WKAuthenticationDecisionListenerGetTypeID):
    (WKAuthenticationDecisionListenerUseCredential):
    (WKAuthenticationDecisionListenerCancel):
    * UIProcess/API/C/WKAuthenticationDecisionListener.h: Added.
    
    Add Authentication related methods to the page loader client:
    * UIProcess/API/C/WKPage.h:
    
    Add empty implementations of the new API objects:
    * UIProcess/Authentication: Added.
    * UIProcess/Authentication/AuthenticationChallengeProxy.cpp: Added.
    (WebKit::AuthenticationChallengeProxy::AuthenticationChallengeProxy):
    (WebKit::AuthenticationChallengeProxy::~AuthenticationChallengeProxy):
    (WebKit::AuthenticationChallengeProxy::useCredential):
    (WebKit::AuthenticationChallengeProxy::cancel):
    * UIProcess/Authentication/AuthenticationChallengeProxy.h: Added.
    (WebKit::AuthenticationChallengeProxy::create):
    (WebKit::AuthenticationChallengeProxy::listener):
    (WebKit::AuthenticationChallengeProxy::type):
    
    * UIProcess/Authentication/WebCredential.cpp: Added.
    (WebKit::WebCredential::core):
    * UIProcess/Authentication/WebCredential.h: Added.
    (WebKit::WebCredential::create):
    (WebKit::WebCredential::type):
    * UIProcess/Authentication/WebProtectionSpace.cpp: Added.
    (WebKit::WebProtectionSpace::WebProtectionSpace):
    * UIProcess/Authentication/WebProtectionSpace.h: Added.
    (WebKit::WebProtectionSpace::create):
    (WebKit::WebProtectionSpace::type):
    
    Add implementation of the Authentication decision listener:
    * UIProcess/Authentication/AuthenticationDecisionListener.cpp: Added.
    (WebKit::AuthenticationDecisionListener::AuthenticationDecisionListener):
    (WebKit::AuthenticationDecisionListener::useCredential):
    (WebKit::AuthenticationDecisionListener::cancel):
    (WebKit::AuthenticationDecisionListener::detachChallenge):
    * UIProcess/Authentication/AuthenticationDecisionListener.h: Added.
    (WebKit::AuthenticationDecisionListener::create):
    (WebKit::AuthenticationDecisionListener::type):
    
    WebPage and PageLoaderClient glue:
    * UIProcess/WebLoaderClient.cpp:
    (WebKit::WebLoaderClient::canAuthenticateAgainstProtectionSpaceInFrame):
    (WebKit::WebLoaderClient::didReceiveAuthenticationChallengeInFrame):
    * UIProcess/WebLoaderClient.h:
    * UIProcess/WebPageProxy.cpp:
    (WebKit::WebPageProxy::canAuthenticateAgainstProtectionSpaceInFrame):
    (WebKit::WebPageProxy::didReceiveAuthenticationChallenge):
    * UIProcess/WebPageProxy.h:
    * UIProcess/WebPageProxy.messages.in:
    
    Add a manager to map the actual platform authentication challenges to a challenge ID,
    as at least some platforms require the object identity to persist:
    * WebProcess/Authentication: Added.
    * WebProcess/Authentication/AuthenticationManager.cpp: Added.
    (WebKit::generateAuthenticationChallengeID):
    (WebKit::AuthenticationManager::shared):
    (WebKit::AuthenticationManager::AuthenticationManager):
    (WebKit::AuthenticationManager::didReceiveMessage):
    (WebKit::AuthenticationManager::didReceiveAuthenticationChallenge):
    (WebKit::AuthenticationManager::useCredentialForChallenge):
    (WebKit::AuthenticationManager::continueWithoutCredentialForChallenge):
    (WebKit::AuthenticationManager::cancelChallenge):
    * WebProcess/Authentication/AuthenticationManager.h: Added.
    * WebProcess/Authentication/AuthenticationManager.messages.in: Added.
    
    Hand off Authentication challenges to the manager to be sent over IPC:
    * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
    (WebKit::WebFrameLoaderClient::dispatchDidReceiveAuthenticationChallenge):
    (WebKit::WebFrameLoaderClient::canAuthenticateAgainstProtectionSpace):
    
    * UIProcess/API/qt/qwkpage.cpp:
    
    WebKitTools:
    
    Keep these builds working:
    * MiniBrowser/mac/BrowserWindowController.m:
    (-[BrowserWindowController awakeFromNib]):
    
    * WebKitTestRunner/TestController.cpp:
    (WTR::TestController::initialize):
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@73281 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index f10c313..cfe6bc6 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,21 @@
+2010-12-03  Brady Eidson  <beidson at apple.com>
+
+        Reviewed by Anders Carlsson.
+
+        Groundwork for <rdar://problem/7660733> and https://bugs.webkit.org/show_bug.cgi?id=50191
+        WebKit2 Authentication Support
+
+        * WebCore.exp.in:
+
+        Expose the AuthenticationClient for WK2 platforms (Windows already does this):
+        * platform/network/mac/AuthenticationChallenge.h:
+        * platform/network/mac/AuthenticationMac.mm:
+        (-[WebCoreAuthenticationClientAsChallengeSender client]):
+        (WebCore::AuthenticationChallenge::authenticationClient):
+
+        * platform/network/qt/AuthenticationChallenge.h:
+        (WebCore::AuthenticationChallenge::authenticationClient):
+
 2010-12-03  Ryosuke Niwa  <rniwa at webkit.org>
 
         Reviewed by Darin Adler.
diff --git a/WebCore/WebCore.exp.in b/WebCore/WebCore.exp.in
index b28b4d6..a12d364 100644
--- a/WebCore/WebCore.exp.in
+++ b/WebCore/WebCore.exp.in
@@ -137,6 +137,7 @@ __ZN3JSC8Bindings8Instance16newRuntimeObjectEPNS_9ExecStateE
 __ZN3WTF10StringImplcvP8NSStringEv
 __ZN3WTF6StringC1EP8NSString
 __ZN3WTF6StringC1EPK10__CFString
+__ZN7WebCore10CredentialC1Ev
 __ZN7WebCore10JSDocument6s_infoE
 __ZN7WebCore10MouseEventC1ERKN3WTF12AtomicStringEbbNS1_10PassRefPtrINS_9DOMWindowEEEiiiiibbbbtNS5_INS_11EventTargetEEENS5_INS_9ClipboardEEEb
 __ZN7WebCore10ScrollView20setCanHaveScrollbarsEb
@@ -368,6 +369,7 @@ __ZN7WebCore15GraphicsContext9translateEff
 __ZN7WebCore15GraphicsContextC1EP9CGContext
 __ZN7WebCore15GraphicsContextD1Ev
 __ZN7WebCore15JSDOMWindowBase18commonJSGlobalDataEv
+__ZN7WebCore15ProtectionSpaceC1Ev
 __ZN7WebCore15ScrollAlignment17alignCenterAlwaysE
 __ZN7WebCore15ScrollAlignment19alignToEdgeIfNeededE
 __ZN7WebCore15StringTruncator13rightTruncateERKN3WTF6StringEfRKNS_4FontEb
@@ -534,6 +536,7 @@ __ZN7WebCore26UserTypingGestureIndicator28focusedElementAtGestureStartEv
 __ZN7WebCore26contextMenuItemTagFontMenuEv
 __ZN7WebCore26contextMenuItemTagOpenLinkEv
 __ZN7WebCore26usesTestModeFocusRingColorEv
+__ZN7WebCore27AuthenticationChallengeBaseC2Ev
 __ZN7WebCore27CSSComputedStyleDeclarationC1EN3WTF10PassRefPtrINS_4NodeEEEbRKNS1_6StringE
 __ZN7WebCore27DeviceOrientationClientMock14setOrientationEN3WTF10PassRefPtrINS_17DeviceOrientationEEE
 __ZN7WebCore27DeviceOrientationClientMockC1Ev
@@ -1047,9 +1050,11 @@ __ZNK7WebCore20ResourceResponseBase8mimeTypeEv
 __ZNK7WebCore21BackForwardController12forwardCountEv
 __ZNK7WebCore21BackForwardController9backCountEv
 __ZNK7WebCore21UserContentURLPattern7matchesERKNS_4KURLE
+__ZNK7WebCore23AuthenticationChallenge20authenticationClientEv
 __ZNK7WebCore23FrameLoaderStateMachine15firstLayoutDoneEv
 __ZNK7WebCore23FrameLoaderStateMachine23committingFirstRealLoadEv
 __ZNK7WebCore26NetscapePlugInStreamLoader6isDoneEv
+__ZNK7WebCore27AuthenticationChallengeBase6isNullEv
 __ZNK7WebCore4Font10floatWidthERKNS_7TextRunEPN3WTF7HashSetIPKNS_14SimpleFontDataENS4_7PtrHashIS8_EENS4_10HashTraitsIS8_EEEEPNS_13GlyphOverflowE
 __ZNK7WebCore4Font8drawTextEPNS_15GraphicsContextERKNS_7TextRunERKNS_10FloatPointEii
 __ZNK7WebCore4KURL11createCFURLEv
diff --git a/WebCore/platform/network/mac/AuthenticationChallenge.h b/WebCore/platform/network/mac/AuthenticationChallenge.h
index d74a92c..8f60933 100644
--- a/WebCore/platform/network/mac/AuthenticationChallenge.h
+++ b/WebCore/platform/network/mac/AuthenticationChallenge.h
@@ -49,6 +49,7 @@ public:
     NSURLAuthenticationChallenge *nsURLAuthenticationChallenge() const { return m_nsChallenge.get(); }
 
     void setAuthenticationClient(AuthenticationClient*); // Changes sender to one that invokes client methods.
+    AuthenticationClient* authenticationClient() const;
 
 private:
     friend class AuthenticationChallengeBase;
diff --git a/WebCore/platform/network/mac/AuthenticationMac.mm b/WebCore/platform/network/mac/AuthenticationMac.mm
index 1c05917..cdf643f 100644
--- a/WebCore/platform/network/mac/AuthenticationMac.mm
+++ b/WebCore/platform/network/mac/AuthenticationMac.mm
@@ -41,6 +41,7 @@ using namespace WebCore;
     AuthenticationClient* m_client;
 }
 - (id)initWithAuthenticationClient:(AuthenticationClient*)client;
+- (AuthenticationClient*)client;
 - (void)detachClient;
 @end
 
@@ -55,6 +56,11 @@ using namespace WebCore;
     return self;
 }
 
+- (AuthenticationClient*)client
+{
+    return m_client;
+}
+
 - (void)detachClient
 {
     m_client = 0;
@@ -123,6 +129,14 @@ void AuthenticationChallenge::setAuthenticationClient(AuthenticationClient* clie
     }
 }
 
+AuthenticationClient* AuthenticationChallenge::authenticationClient() const
+{
+    if ([m_sender.get() isMemberOfClass:[WebCoreAuthenticationClientAsChallengeSender class]])
+        return [static_cast<WebCoreAuthenticationClientAsChallengeSender*>(m_sender.get()) client];
+    
+    return 0;
+}
+
 bool AuthenticationChallenge::platformCompare(const AuthenticationChallenge& a, const AuthenticationChallenge& b)
 {
     if (a.sender() != b.sender())
diff --git a/WebCore/platform/network/qt/AuthenticationChallenge.h b/WebCore/platform/network/qt/AuthenticationChallenge.h
index 753ac6f..ebbc0cd 100644
--- a/WebCore/platform/network/qt/AuthenticationChallenge.h
+++ b/WebCore/platform/network/qt/AuthenticationChallenge.h
@@ -29,6 +29,8 @@
 
 namespace WebCore {
 
+class AuthenticationClient;
+
 class AuthenticationChallenge : public AuthenticationChallengeBase {
 public:
     AuthenticationChallenge()
@@ -39,6 +41,9 @@ public:
         : AuthenticationChallengeBase(protectionSpace, proposedCredential, previousFailureCount, response, error)
     {
     }
+
+    AuthenticationClient* authenticationClient() const { return 0; } // FIXME: Implement!
+
 };
 
 }
diff --git a/WebKit2/ChangeLog b/WebKit2/ChangeLog
index fd57fdf..c086e2d 100644
--- a/WebKit2/ChangeLog
+++ b/WebKit2/ChangeLog
@@ -1,3 +1,120 @@
+2010-12-03  Brady Eidson  <beidson at apple.com>
+
+        Reviewed by Anders Carlsson.
+
+        Groundwork for <rdar://problem/7660733> and https://bugs.webkit.org/show_bug.cgi?id=50191
+        WebKit2 Authentication Support
+
+        With this patch in place, authentication challenges are sent up from WebCore and shipped over the IPC layer.
+        Client apps can implement the related client methods to attempt to continue without credentials or cancel a
+        challenge.
+
+        There's not yet API to inspect a challenge or create a credential to use in reply - that will come later.
+
+        Build-system changes:
+        * DerivedSources.make:
+        * DerivedSources.pro:
+        * WebKit2.pro:
+        * WebKit2.xcodeproj/project.pbxproj:
+        * win/WebKit2.vcproj:
+        * win/WebKit2Common.vsprops:
+
+        Messages and casts for IPC and APIs:
+        * Platform/CoreIPC/MessageID.h:
+        * Shared/API/c/WKBase.h:
+        * Shared/APIObject.h:
+        * Shared/WebCoreArgumentCoders.h:
+        * UIProcess/API/C/WKAPICast.h:
+        * WebProcess/WebProcess.cpp:
+        (WebKit::WebProcess::didReceiveMessage):
+
+        Stub out the AuthenticationChallenge class family:
+        * UIProcess/API/C/WKAuthenticationChallenge.cpp: Added.
+        (WKAuthenticationChallengeGetTypeID):
+        * UIProcess/API/C/WKAuthenticationChallenge.h: Added.
+        * UIProcess/API/C/WKCredential.cpp: Added.
+        (WKCredentialGetTypeID):
+        * UIProcess/API/C/WKCredential.h: Added.
+        * UIProcess/API/C/WKProtectionSpace.cpp: Added.
+        (WKProtectionSpaceGetTypeID):
+        * UIProcess/API/C/WKProtectionSpace.h: Added.
+
+        Add an Authentication listener for the client app to respond to:
+        * UIProcess/API/C/WKAuthenticationDecisionListener.cpp: Added.
+        (WKAuthenticationDecisionListenerGetTypeID):
+        (WKAuthenticationDecisionListenerUseCredential):
+        (WKAuthenticationDecisionListenerCancel):
+        * UIProcess/API/C/WKAuthenticationDecisionListener.h: Added.
+
+        Add Authentication related methods to the page loader client:
+        * UIProcess/API/C/WKPage.h:
+
+        Add empty implementations of the new API objects:
+        * UIProcess/Authentication: Added.
+        * UIProcess/Authentication/AuthenticationChallengeProxy.cpp: Added.
+        (WebKit::AuthenticationChallengeProxy::AuthenticationChallengeProxy):
+        (WebKit::AuthenticationChallengeProxy::~AuthenticationChallengeProxy):
+        (WebKit::AuthenticationChallengeProxy::useCredential):
+        (WebKit::AuthenticationChallengeProxy::cancel):
+        * UIProcess/Authentication/AuthenticationChallengeProxy.h: Added.
+        (WebKit::AuthenticationChallengeProxy::create):
+        (WebKit::AuthenticationChallengeProxy::listener):
+        (WebKit::AuthenticationChallengeProxy::type):
+
+        * UIProcess/Authentication/WebCredential.cpp: Added.
+        (WebKit::WebCredential::core):
+        * UIProcess/Authentication/WebCredential.h: Added.
+        (WebKit::WebCredential::create):
+        (WebKit::WebCredential::type):
+        * UIProcess/Authentication/WebProtectionSpace.cpp: Added.
+        (WebKit::WebProtectionSpace::WebProtectionSpace):
+        * UIProcess/Authentication/WebProtectionSpace.h: Added.
+        (WebKit::WebProtectionSpace::create):
+        (WebKit::WebProtectionSpace::type):
+
+        Add implementation of the Authentication decision listener:
+        * UIProcess/Authentication/AuthenticationDecisionListener.cpp: Added.
+        (WebKit::AuthenticationDecisionListener::AuthenticationDecisionListener):
+        (WebKit::AuthenticationDecisionListener::useCredential):
+        (WebKit::AuthenticationDecisionListener::cancel):
+        (WebKit::AuthenticationDecisionListener::detachChallenge):
+        * UIProcess/Authentication/AuthenticationDecisionListener.h: Added.
+        (WebKit::AuthenticationDecisionListener::create):
+        (WebKit::AuthenticationDecisionListener::type):
+
+        WebPage and PageLoaderClient glue:
+        * UIProcess/WebLoaderClient.cpp:
+        (WebKit::WebLoaderClient::canAuthenticateAgainstProtectionSpaceInFrame):
+        (WebKit::WebLoaderClient::didReceiveAuthenticationChallengeInFrame):
+        * UIProcess/WebLoaderClient.h:
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::canAuthenticateAgainstProtectionSpaceInFrame):
+        (WebKit::WebPageProxy::didReceiveAuthenticationChallenge):
+        * UIProcess/WebPageProxy.h:
+        * UIProcess/WebPageProxy.messages.in:
+
+        Add a manager to map the actual platform authentication challenges to a challenge ID,
+        as at least some platforms require the object identity to persist:
+        * WebProcess/Authentication: Added.
+        * WebProcess/Authentication/AuthenticationManager.cpp: Added.
+        (WebKit::generateAuthenticationChallengeID):
+        (WebKit::AuthenticationManager::shared):
+        (WebKit::AuthenticationManager::AuthenticationManager):
+        (WebKit::AuthenticationManager::didReceiveMessage):
+        (WebKit::AuthenticationManager::didReceiveAuthenticationChallenge):
+        (WebKit::AuthenticationManager::useCredentialForChallenge):
+        (WebKit::AuthenticationManager::continueWithoutCredentialForChallenge):
+        (WebKit::AuthenticationManager::cancelChallenge):
+        * WebProcess/Authentication/AuthenticationManager.h: Added.
+        * WebProcess/Authentication/AuthenticationManager.messages.in: Added.
+
+        Hand off Authentication challenges to the manager to be sent over IPC:
+        * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
+        (WebKit::WebFrameLoaderClient::dispatchDidReceiveAuthenticationChallenge):
+        (WebKit::WebFrameLoaderClient::canAuthenticateAgainstProtectionSpace):
+
+        * UIProcess/API/qt/qwkpage.cpp:
+
 2010-12-03  Anders Carlsson  <andersca at apple.com>
 
         Reviewed by Dan Bernstein.
diff --git a/WebKit2/DerivedSources.make b/WebKit2/DerivedSources.make
index dafeae9..ba78b63 100644
--- a/WebKit2/DerivedSources.make
+++ b/WebKit2/DerivedSources.make
@@ -23,6 +23,7 @@
 VPATH = \
     $(WebKit2)/PluginProcess \
     $(WebKit2)/Shared/Plugins \
+    $(WebKit2)/WebProcess/Authentication \
     $(WebKit2)/WebProcess/Plugins \
     $(WebKit2)/WebProcess/WebPage \
     $(WebKit2)/WebProcess \
@@ -32,6 +33,7 @@ VPATH = \
 #
 
 MESSAGE_RECEIVERS = \
+    AuthenticationManager \
     DownloadProxy \
     NPObjectMessageReceiver \
     PluginControllerProxy \
diff --git a/WebKit2/DerivedSources.pro b/WebKit2/DerivedSources.pro
index 618d790..2a11aa3 100644
--- a/WebKit2/DerivedSources.pro
+++ b/WebKit2/DerivedSources.pro
@@ -85,6 +85,7 @@ defineReplace(message_receiver_generator_output) {
 
 VPATH = \
     PluginProcess \
+    WebProcess/Authentication \
     WebProcess/Plugins \
     WebProcess/WebPage \
     WebProcess \
@@ -93,6 +94,7 @@ VPATH = \
     UIProcess/Plugins
 
 MESSAGE_RECEIVERS = \
+    AuthenticationManager.messages.in \
     DownloadProxy.messages.in \
     PluginControllerProxy.messages.in \
     PluginProcess.messages.in \
diff --git a/WebKit2/Platform/CoreIPC/MessageID.h b/WebKit2/Platform/CoreIPC/MessageID.h
index 4b027fe..2724b0f 100644
--- a/WebKit2/Platform/CoreIPC/MessageID.h
+++ b/WebKit2/Platform/CoreIPC/MessageID.h
@@ -35,6 +35,7 @@ enum MessageClass {
     MessageClassCoreIPC,
 
     // Messages sent by the UI process to the web process.
+    MessageClassAuthenticationManager,
     MessageClassDrawingArea,
     MessageClassInjectedBundle,
     MessageClassWebInspector,
diff --git a/WebKit2/Shared/API/c/WKBase.h b/WebKit2/Shared/API/c/WKBase.h
index 186c839..9a44d8f 100644
--- a/WebKit2/Shared/API/c/WKBase.h
+++ b/WebKit2/Shared/API/c/WKBase.h
@@ -60,9 +60,12 @@ typedef const struct OpaqueWKUserContentURLPattern* WKUserContentURLPatternRef;
 
 /* WebKit2 main API types */
 
+typedef const struct OpaqueWKAuthenticationChallenge* WKAuthenticationChallengeRef;
+typedef const struct OpaqueWKAuthenticationDecisionListener* WKAuthenticationDecisionListenerRef;
 typedef const struct OpaqueWKBackForwardList* WKBackForwardListRef;
 typedef const struct OpaqueWKBackForwardListItem* WKBackForwardListItemRef;
 typedef const struct OpaqueWKContext* WKContextRef;
+typedef const struct OpaqueWKCredential* WKCredentialRef;
 typedef const struct OpaqueWKDownload* WKDownloadRef;
 typedef const struct OpaqueWKFormSubmissionListener* WKFormSubmissionListenerRef;
 typedef const struct OpaqueWKFrame* WKFrameRef;
@@ -73,6 +76,7 @@ typedef const struct OpaqueWKPage* WKPageRef;
 typedef const struct OpaqueWKPageGroup* WKPageGroupRef;
 typedef const struct OpaqueWKPageNamespace* WKPageNamespaceRef;
 typedef const struct OpaqueWKPreferences* WKPreferencesRef;
+typedef const struct OpaqueWKProtectionSpace* WKProtectionSpaceRef;
 
 /* WebKit2 Bundle types */
 
diff --git a/WebKit2/Shared/APIObject.h b/WebKit2/Shared/APIObject.h
index 158979c..07fe654 100644
--- a/WebKit2/Shared/APIObject.h
+++ b/WebKit2/Shared/APIObject.h
@@ -36,11 +36,15 @@ public:
         // Base types
         TypeNull = 0,
         TypeArray,
+        TypeAuthenticationChallenge,
+        TypeAuthenticationDecisionListener,
         TypeCertificateInfo,
         TypeContextMenuItem,
+        TypeCredential,
         TypeData,
         TypeDictionary,
         TypeError,
+        TypeProtectionSpace,
         TypeSecurityOrigin,
         TypeSerializedScriptValue,
         TypeString,
diff --git a/WebKit2/Shared/WebCoreArgumentCoders.h b/WebKit2/Shared/WebCoreArgumentCoders.h
index 088820d..bdbe834 100644
--- a/WebKit2/Shared/WebCoreArgumentCoders.h
+++ b/WebKit2/Shared/WebCoreArgumentCoders.h
@@ -30,11 +30,14 @@
 #include "ArgumentDecoder.h"
 #include "ArgumentEncoder.h"
 #include "Arguments.h"
+#include <WebCore/AuthenticationChallenge.h>
+#include <WebCore/Credential.h>
 #include <WebCore/Cursor.h>
 #include <WebCore/FloatRect.h>
 #include <WebCore/IntRect.h>
 #include <WebCore/KeyboardEvent.h>
 #include <WebCore/PluginData.h>
+#include <WebCore/ProtectionSpace.h>
 #include <WebCore/ResourceError.h>
 #include <WebCore/ResourceRequest.h>
 #include <WebCore/ViewportArguments.h>
@@ -109,6 +112,45 @@ template<> struct ArgumentCoder<WebCore::HTTPHeaderMap> {
     }
 };
 
+template<> struct ArgumentCoder<WebCore::AuthenticationChallenge> {
+    static void encode(ArgumentEncoder* encoder, const WebCore::AuthenticationChallenge& challenge)
+    {
+        // FIXME: Implement
+    }
+
+    static bool decode(ArgumentDecoder* decoder, WebCore::AuthenticationChallenge& credential)
+    {
+        // FIXME: Implement
+        return true;
+    }
+};
+
+template<> struct ArgumentCoder<WebCore::ProtectionSpace> {
+    static void encode(ArgumentEncoder* encoder, const WebCore::ProtectionSpace& challenge)
+    {
+        // FIXME: Implement
+    }
+
+    static bool decode(ArgumentDecoder* decoder, WebCore::ProtectionSpace& credential)
+    {
+        // FIXME: Implement
+        return true;
+    }
+};
+
+template<> struct ArgumentCoder<WebCore::Credential> {
+    static void encode(ArgumentEncoder* encoder, const WebCore::Credential& credential)
+    {
+        // FIXME: Implement
+    }
+
+    static bool decode(ArgumentDecoder* decoder, WebCore::Credential& credential)
+    {
+        // FIXME: Implement
+        return true;
+    }
+};
+
 #if USE(LAZY_NATIVE_CURSOR)
 template<> struct ArgumentCoder<WebCore::Cursor> {
     static void encode(ArgumentEncoder* encoder, const WebCore::Cursor& cursor)
diff --git a/WebKit2/UIProcess/API/C/WKAPICast.h b/WebKit2/UIProcess/API/C/WKAPICast.h
index 6feeb29..b4c12b6 100644
--- a/WebKit2/UIProcess/API/C/WKAPICast.h
+++ b/WebKit2/UIProcess/API/C/WKAPICast.h
@@ -36,10 +36,13 @@
 
 namespace WebKit {
 
+class AuthenticationChallengeProxy;
+class AuthenticationDecisionListener;
 class DownloadProxy;
 class WebBackForwardList;
 class WebBackForwardListItem;
 class WebContext;
+class WebCredential;
 class WebFormSubmissionListenerProxy;
 class WebFramePolicyListenerProxy;
 class WebFrameProxy;
@@ -49,10 +52,14 @@ class WebPageGroup;
 class WebPageNamespace;
 class WebPageProxy;
 class WebPreferences;
+class WebProtectionSpace;
 
+WK_ADD_API_MAPPING(WKAuthenticationChallengeRef, AuthenticationChallengeProxy)
+WK_ADD_API_MAPPING(WKAuthenticationDecisionListenerRef, AuthenticationDecisionListener)
 WK_ADD_API_MAPPING(WKBackForwardListItemRef, WebBackForwardListItem)
 WK_ADD_API_MAPPING(WKBackForwardListRef, WebBackForwardList)
 WK_ADD_API_MAPPING(WKContextRef, WebContext)
+WK_ADD_API_MAPPING(WKCredentialRef, WebCredential)
 WK_ADD_API_MAPPING(WKDownloadRef, DownloadProxy)
 WK_ADD_API_MAPPING(WKFormSubmissionListenerRef, WebFormSubmissionListenerProxy)
 WK_ADD_API_MAPPING(WKFramePolicyListenerRef, WebFramePolicyListenerProxy)
@@ -65,6 +72,7 @@ WK_ADD_API_MAPPING(WKPageGroupRef, WebPageGroup)
 WK_ADD_API_MAPPING(WKPageNamespaceRef, WebPageNamespace)
 WK_ADD_API_MAPPING(WKPageRef, WebPageProxy)
 WK_ADD_API_MAPPING(WKPreferencesRef, WebPreferences)
+WK_ADD_API_MAPPING(WKProtectionSpaceRef, WebProtectionSpace)
 
 /* Enum conversions */
 
diff --git a/WebKit2/UIProcess/API/C/WKAuthenticationChallenge.cpp b/WebKit2/UIProcess/API/C/WKAuthenticationChallenge.cpp
new file mode 100644
index 0000000..0ca7acd
--- /dev/null
+++ b/WebKit2/UIProcess/API/C/WKAuthenticationChallenge.cpp
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "WKAuthenticationChallenge.h"
+
+#include "AuthenticationChallengeProxy.h"
+#include "WKAPICast.h"
+
+using namespace WebKit;
+
+WKTypeID WKAuthenticationChallengeGetTypeID()
+{
+    return toAPI(AuthenticationChallengeProxy::APIType);
+}
diff --git a/WebKit2/UIProcess/API/C/WKAuthenticationChallenge.h b/WebKit2/UIProcess/API/C/WKAuthenticationChallenge.h
new file mode 100644
index 0000000..49b951f
--- /dev/null
+++ b/WebKit2/UIProcess/API/C/WKAuthenticationChallenge.h
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+ 
+#ifndef WKAuthenticationChallenge_h
+#define WKAuthenticationChallenge_h
+
+#include <WebKit2/WKBase.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+WK_EXPORT WKTypeID WKAuthenticationChallengeGetTypeID();
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // WKAuthenticationChallenge_h
diff --git a/WebKit2/UIProcess/API/C/WKAuthenticationDecisionListener.cpp b/WebKit2/UIProcess/API/C/WKAuthenticationDecisionListener.cpp
new file mode 100644
index 0000000..959f5c2
--- /dev/null
+++ b/WebKit2/UIProcess/API/C/WKAuthenticationDecisionListener.cpp
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "WKAuthenticationDecisionListener.h"
+
+#include "AuthenticationDecisionListener.h"
+#include "WKAPICast.h"
+
+using namespace WebKit;
+
+WKTypeID WKAuthenticationDecisionListenerGetTypeID()
+{
+    return toAPI(AuthenticationDecisionListener::APIType);
+}
+
+void WKAuthenticationDecisionListenerUseCredential(WKAuthenticationDecisionListenerRef authenticationListener, WKCredentialRef credential)
+{
+    toImpl(authenticationListener)->useCredential(toImpl(credential));
+}
+
+void WKAuthenticationDecisionListenerCancel(WKAuthenticationDecisionListenerRef authenticationListener)
+{
+    toImpl(authenticationListener)->cancel();
+}
diff --git a/WebKit2/UIProcess/API/C/WKAuthenticationDecisionListener.h b/WebKit2/UIProcess/API/C/WKAuthenticationDecisionListener.h
new file mode 100644
index 0000000..f072461
--- /dev/null
+++ b/WebKit2/UIProcess/API/C/WKAuthenticationDecisionListener.h
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WKAuthenticationDecisionListener_h
+#define WKAuthenticationDecisionListener_h
+
+#include <WebKit2/WKBase.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+WK_EXPORT WKTypeID WKAuthenticationDecisionListenerGetTypeID();
+
+WK_EXPORT void WKAuthenticationDecisionListenerUseCredential(WKAuthenticationDecisionListenerRef authenticationListener, WKCredentialRef credential);
+WK_EXPORT void WKAuthenticationDecisionListenerCancel(WKAuthenticationDecisionListenerRef authenticationListener);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* WKFramePolicyListener_h */
diff --git a/WebKit2/UIProcess/API/C/WKCredential.cpp b/WebKit2/UIProcess/API/C/WKCredential.cpp
new file mode 100644
index 0000000..9afe284
--- /dev/null
+++ b/WebKit2/UIProcess/API/C/WKCredential.cpp
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "WKCredential.h"
+
+#include "WebCredential.h"
+#include "WKAPICast.h"
+
+using namespace WebKit;
+
+WKTypeID WKCredentialGetTypeID()
+{
+    return toAPI(WebCredential::APIType);
+}
diff --git a/WebKit2/UIProcess/API/C/WKCredential.h b/WebKit2/UIProcess/API/C/WKCredential.h
new file mode 100644
index 0000000..3b64349
--- /dev/null
+++ b/WebKit2/UIProcess/API/C/WKCredential.h
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WKCredential_h
+#define WKCredential_h
+
+#include <WebKit2/WKBase.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+WK_EXPORT WKTypeID WKCredentialGetTypeID();
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // WKCredential_h
diff --git a/WebKit2/UIProcess/API/C/WKPage.h b/WebKit2/UIProcess/API/C/WKPage.h
index b0013a4..4dadbd9 100644
--- a/WebKit2/UIProcess/API/C/WKPage.h
+++ b/WebKit2/UIProcess/API/C/WKPage.h
@@ -64,6 +64,8 @@ typedef void (*WKPageDidFirstVisuallyNonEmptyLayoutForFrameCallback)(WKPageRef p
 typedef void (*WKPageDidRemoveFrameFromHierarchyCallback)(WKPageRef page, WKFrameRef frame, WKTypeRef userData, const void *clientInfo);
 typedef void (*WKPageDidDisplayInsecureContentForFrameCallback)(WKPageRef page, WKFrameRef frame, WKTypeRef userData, const void *clientInfo);
 typedef void (*WKPageDidRunInsecureContentForFrameCallback)(WKPageRef page, WKFrameRef frame, WKTypeRef userData, const void *clientInfo);
+typedef bool (*WKPageCanAuthenticateAgainstProtectionSpaceInFrameCallback)(WKPageRef page, WKFrameRef frame, WKProtectionSpaceRef protectionSpace, const void *clientInfo);
+typedef void (*WKPageDidReceiveAuthenticationChallengeInFrameCallback)(WKPageRef page, WKFrameRef frame, WKAuthenticationChallengeRef authenticationChallenge, WKAuthenticationDecisionListenerRef listener, const void *clientInfo);
 
 // Progress Client
 typedef void (*WKPageDidStartProgressCallback)(WKPageRef page, const void *clientInfo);
@@ -94,6 +96,8 @@ struct WKPageLoaderClient {
     WKPageDidRemoveFrameFromHierarchyCallback                           didRemoveFrameFromHierarchy;
     WKPageDidDisplayInsecureContentForFrameCallback                     didDisplayInsecureContentForFrame;
     WKPageDidRunInsecureContentForFrameCallback                         didRunInsecureContentForFrame;
+    WKPageCanAuthenticateAgainstProtectionSpaceInFrameCallback          canAuthenticateAgainstProtectionSpaceInFrame;
+    WKPageDidReceiveAuthenticationChallengeInFrameCallback              didReceiveAuthenticationChallengeInFrame;
 
     // FIXME: Move to progress client.
     WKPageDidStartProgressCallback                                      didStartProgress;
diff --git a/WebKit2/UIProcess/API/C/WKProtectionSpace.cpp b/WebKit2/UIProcess/API/C/WKProtectionSpace.cpp
new file mode 100644
index 0000000..2ce1fc3
--- /dev/null
+++ b/WebKit2/UIProcess/API/C/WKProtectionSpace.cpp
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "WKProtectionSpace.h"
+
+#include "WebProtectionSpace.h"
+#include "WKAPICast.h"
+
+using namespace WebKit;
+
+WKTypeID WKProtectionSpaceGetTypeID()
+{
+    return toAPI(WebProtectionSpace::APIType);
+}
diff --git a/WebKit2/UIProcess/API/C/WKProtectionSpace.h b/WebKit2/UIProcess/API/C/WKProtectionSpace.h
new file mode 100644
index 0000000..4f919cf
--- /dev/null
+++ b/WebKit2/UIProcess/API/C/WKProtectionSpace.h
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WKProtectionSpace_h
+#define WKProtectionSpace_h
+
+#include <WebKit2/WKBase.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+WK_EXPORT WKTypeID WKProtectionSpaceGetTypeID();
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // WKProtectionSpace_h
diff --git a/WebKit2/UIProcess/API/qt/qwkpage.cpp b/WebKit2/UIProcess/API/qt/qwkpage.cpp
index d8f292d..e3a03b5 100644
--- a/WebKit2/UIProcess/API/qt/qwkpage.cpp
+++ b/WebKit2/UIProcess/API/qt/qwkpage.cpp
@@ -323,6 +323,8 @@ QWKPage::QWKPage(WKPageNamespaceRef namespaceRef)
         qt_wk_didRemoveFrameFromHierarchy,
         0, /* didDisplayInsecureContentForFrame */
         0, /* didRunInsecureContentForFrame */
+        0, /* canAuthenticateAgainstProtectionSpaceInFrame */
+        0, /* didReceiveAuthenticationChallengeInFrame */
         qt_wk_didStartProgress,
         qt_wk_didChangeProgress,
         qt_wk_didFinishProgress,
diff --git a/WebKit2/UIProcess/Authentication/AuthenticationChallengeProxy.cpp b/WebKit2/UIProcess/Authentication/AuthenticationChallengeProxy.cpp
new file mode 100644
index 0000000..519faa4
--- /dev/null
+++ b/WebKit2/UIProcess/Authentication/AuthenticationChallengeProxy.cpp
@@ -0,0 +1,80 @@
+/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "AuthenticationChallengeProxy.h"
+
+#include "AuthenticationDecisionListener.h"
+#include "AuthenticationManagerMessages.h"
+#include "WebCoreArgumentCoders.h"
+#include "WebCredential.h"
+#include "WebPageProxy.h"
+#include "WebProcessProxy.h"
+
+namespace WebKit {
+
+AuthenticationChallengeProxy::AuthenticationChallengeProxy(const WebCore::AuthenticationChallenge& authenticationChallenge, uint64_t challengeID, WebPageProxy* page)
+    : m_coreAuthenticationChallenge(authenticationChallenge)
+    , m_challengeID(challengeID)
+    , m_page(page)
+{
+    ASSERT(m_challengeID);
+    m_listener = AuthenticationDecisionListener::create(this);
+}
+
+AuthenticationChallengeProxy::~AuthenticationChallengeProxy()
+{
+    // If an outstanding AuthenticationChallengeProxy is being destroyed even though it hasn't been responded to yet,
+    // we cancel it here so the WebProcess isn't waiting for an answer forever.
+    if (m_challengeID)
+        m_page->process()->send(Messages::AuthenticationManager::CancelChallenge(m_challengeID), m_page->pageID());
+
+    if (m_listener)
+        m_listener->detachChallenge();
+}
+
+void AuthenticationChallengeProxy::useCredential(WebCredential* credential)
+{
+    if (!m_challengeID)
+        return;
+
+    if (!credential)
+        m_page->process()->send(Messages::AuthenticationManager::ContinueWithoutCredentialForChallenge(m_challengeID), m_page->pageID());
+    else 
+        m_page->process()->send(Messages::AuthenticationManager::UseCredentialForChallenge(m_challengeID, credential->core()), m_page->pageID());
+
+    m_challengeID = 0;
+}
+
+void AuthenticationChallengeProxy::cancel()
+{
+    if (!m_challengeID)
+        return;
+
+    m_page->process()->send(Messages::AuthenticationManager::CancelChallenge(m_challengeID), m_page->pageID());
+
+    m_challengeID = 0;
+}
+
+} // namespace WebKit
diff --git a/WebKit2/UIProcess/Authentication/AuthenticationChallengeProxy.h b/WebKit2/UIProcess/Authentication/AuthenticationChallengeProxy.h
new file mode 100644
index 0000000..f8f8ee4
--- /dev/null
+++ b/WebKit2/UIProcess/Authentication/AuthenticationChallengeProxy.h
@@ -0,0 +1,74 @@
+/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef AuthenticationChallengeProxy_h
+#define AuthenticationChallengeProxy_h
+
+#include "APIObject.h"
+#include <WebCore/AuthenticationChallenge.h>
+#include <wtf/PassRefPtr.h>
+
+namespace CoreIPC {
+    class ArgumentDecoder;
+    class Connection;
+    class MessageID;
+}
+
+namespace WebKit {
+
+class AuthenticationDecisionListener;
+class WebCredential;
+class WebPageProxy;
+
+class AuthenticationChallengeProxy : public APIObject {
+public:
+    static const Type APIType = TypeAuthenticationChallenge;
+
+    static PassRefPtr<AuthenticationChallengeProxy> create(const WebCore::AuthenticationChallenge& authenticationChallenge, uint64_t challengeID, WebPageProxy* page)
+    {
+        return adoptRef(new AuthenticationChallengeProxy(authenticationChallenge, challengeID, page));
+    }
+    
+    ~AuthenticationChallengeProxy();
+    
+    void useCredential(WebCredential*);
+    void cancel();
+
+    AuthenticationDecisionListener* listener() const { return m_listener.get(); }
+
+private:
+    AuthenticationChallengeProxy(const WebCore::AuthenticationChallenge&, uint64_t challengeID, WebPageProxy* page);
+
+    virtual Type type() const { return APIType; }
+    
+    WebCore::AuthenticationChallenge m_coreAuthenticationChallenge;
+    uint64_t m_challengeID;
+    RefPtr<WebPageProxy> m_page;
+    RefPtr<AuthenticationDecisionListener> m_listener;
+};
+
+} // namespace WebKit
+
+#endif // WebAuthenticationChallengeProxy_h
diff --git a/WebKit2/UIProcess/Authentication/AuthenticationDecisionListener.cpp b/WebKit2/UIProcess/Authentication/AuthenticationDecisionListener.cpp
new file mode 100644
index 0000000..ddcc6c6
--- /dev/null
+++ b/WebKit2/UIProcess/Authentication/AuthenticationDecisionListener.cpp
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+ 
+#include "AuthenticationDecisionListener.h"
+
+#include "AuthenticationChallengeProxy.h"
+#include "AuthenticationManagerMessages.h"
+#include "WebCredential.h"
+#include "WebPageProxy.h"
+#include "WebProcessProxy.h"
+
+namespace WebKit {
+
+AuthenticationDecisionListener::AuthenticationDecisionListener(AuthenticationChallengeProxy* authenticationChallenge)
+    : m_challengeProxy(authenticationChallenge)
+{
+}
+
+void AuthenticationDecisionListener::useCredential(WebCredential* credential)
+{
+    if (m_challengeProxy)
+        m_challengeProxy->useCredential(credential);
+}
+
+void AuthenticationDecisionListener::cancel()
+{
+    if (m_challengeProxy)
+        m_challengeProxy->cancel();
+}
+
+void AuthenticationDecisionListener::detachChallenge()
+{
+    m_challengeProxy = 0;
+}
+    
+} // namespace WebKit
diff --git a/WebKit2/UIProcess/Authentication/AuthenticationDecisionListener.h b/WebKit2/UIProcess/Authentication/AuthenticationDecisionListener.h
new file mode 100644
index 0000000..00af849
--- /dev/null
+++ b/WebKit2/UIProcess/Authentication/AuthenticationDecisionListener.h
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef AuthenticationDecisionListener_h
+#define AuthenticationDecisionListener_h
+
+#include "APIObject.h"
+
+#include <wtf/RefPtr.h>
+
+namespace WebKit {
+
+class AuthenticationChallengeProxy;
+class WebCredential;
+
+class AuthenticationDecisionListener : public APIObject {
+public:
+    static const Type APIType = TypeAuthenticationDecisionListener;
+
+    static PassRefPtr<AuthenticationDecisionListener> create(AuthenticationChallengeProxy* authenticationChallenge)
+    {
+        return adoptRef(new AuthenticationDecisionListener(authenticationChallenge));
+    }
+    
+    void useCredential(WebCredential*);
+    void cancel();
+    
+    void detachChallenge();
+
+private:
+    AuthenticationDecisionListener(AuthenticationChallengeProxy* authenticationChallenge);
+
+    virtual Type type() const { return APIType; }
+    
+    AuthenticationChallengeProxy* m_challengeProxy;
+};
+
+} // namespace WebKit
+
+#endif // WebAuthenticationDecisionListener_h
diff --git a/WebKit2/UIProcess/Authentication/WebCredential.cpp b/WebKit2/UIProcess/Authentication/WebCredential.cpp
new file mode 100644
index 0000000..48bf7af
--- /dev/null
+++ b/WebKit2/UIProcess/Authentication/WebCredential.cpp
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "WebCredential.h"
+
+namespace WebKit {
+
+const WebCore::Credential& WebCredential::core()
+{
+    return m_coreCredential;
+}
+
+} // namespace WebKit
diff --git a/WebKit2/UIProcess/Authentication/WebCredential.h b/WebKit2/UIProcess/Authentication/WebCredential.h
new file mode 100644
index 0000000..c157548
--- /dev/null
+++ b/WebKit2/UIProcess/Authentication/WebCredential.h
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WebCredential_h
+#define WebCredential_h
+
+#include "APIObject.h"
+#include <WebCore/Credential.h>
+#include <wtf/PassRefPtr.h>
+
+
+namespace WebKit {
+
+class WebCredential : public APIObject {
+public:
+    static const Type APIType = TypeCredential;
+
+    static PassRefPtr<WebCredential> create()
+    {
+        return adoptRef(new WebCredential());
+    }
+    
+    const WebCore::Credential& core();
+
+private:
+    WebCredential();
+
+    virtual Type type() const { return APIType; }
+
+    WebCore::Credential m_coreCredential;
+};
+
+} // namespace WebKit
+
+#endif // WebCredential_h
diff --git a/WebKit2/UIProcess/Authentication/WebProtectionSpace.cpp b/WebKit2/UIProcess/Authentication/WebProtectionSpace.cpp
new file mode 100644
index 0000000..282543a
--- /dev/null
+++ b/WebKit2/UIProcess/Authentication/WebProtectionSpace.cpp
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "WebProtectionSpace.h"
+
+namespace WebKit {
+
+WebProtectionSpace::WebProtectionSpace(const WebCore::ProtectionSpace& coreProtectionSpace)
+    : m_coreProtectionSpace(coreProtectionSpace)
+{
+
+}
+
+} // namespace WebKit
diff --git a/WebKit2/UIProcess/Authentication/WebProtectionSpace.h b/WebKit2/UIProcess/Authentication/WebProtectionSpace.h
new file mode 100644
index 0000000..2337ce1
--- /dev/null
+++ b/WebKit2/UIProcess/Authentication/WebProtectionSpace.h
@@ -0,0 +1,54 @@
+/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WebProtectionSpace_h
+#define WebProtectionSpace_h
+
+#include "APIObject.h"
+#include <WebCore/ProtectionSpace.h>
+#include <wtf/PassRefPtr.h>
+
+namespace WebKit {
+
+class WebProtectionSpace : public APIObject {
+public:
+    static const Type APIType = TypeProtectionSpace;
+
+    static PassRefPtr<WebProtectionSpace> create(const WebCore::ProtectionSpace& protectionSpace)
+    {
+        return adoptRef(new WebProtectionSpace(protectionSpace));
+    }
+
+private:
+    WebProtectionSpace(const WebCore::ProtectionSpace&);
+
+    virtual Type type() const { return APIType; }
+    
+    WebCore::ProtectionSpace m_coreProtectionSpace;
+};
+
+} // namespace WebKit
+
+#endif // WebProtectionSpace_h
diff --git a/WebKit2/UIProcess/WebLoaderClient.cpp b/WebKit2/UIProcess/WebLoaderClient.cpp
index 9c7e6dd..d7bdafa 100644
--- a/WebKit2/UIProcess/WebLoaderClient.cpp
+++ b/WebKit2/UIProcess/WebLoaderClient.cpp
@@ -136,6 +136,22 @@ void WebLoaderClient::didRunInsecureContentForFrame(WebPageProxy* page, WebFrame
     m_client.didRunInsecureContentForFrame(toAPI(page), toAPI(frame), toAPI(userData), m_client.clientInfo);
 }
 
+bool WebLoaderClient::canAuthenticateAgainstProtectionSpaceInFrame(WebPageProxy* page, WebFrameProxy* frame, WebProtectionSpace* protectionSpace)
+{
+    if (!m_client.canAuthenticateAgainstProtectionSpaceInFrame)
+        return false;
+
+    return m_client.canAuthenticateAgainstProtectionSpaceInFrame(toAPI(page), toAPI(frame), toAPI(protectionSpace), m_client.clientInfo);
+}
+
+void WebLoaderClient::didReceiveAuthenticationChallengeInFrame(WebPageProxy* page, WebFrameProxy* frame, AuthenticationChallengeProxy* authenticationChallenge, AuthenticationDecisionListener* listener)
+{
+    if (!m_client.didReceiveAuthenticationChallengeInFrame)
+        return;
+
+    m_client.didReceiveAuthenticationChallengeInFrame(toAPI(page), toAPI(frame), toAPI(authenticationChallenge), toAPI(listener), m_client.clientInfo);
+}
+
 void WebLoaderClient::didStartProgress(WebPageProxy* page)
 {
     if (!m_client.didStartProgress)
diff --git a/WebKit2/UIProcess/WebLoaderClient.h b/WebKit2/UIProcess/WebLoaderClient.h
index 99e3811..5be6834 100644
--- a/WebKit2/UIProcess/WebLoaderClient.h
+++ b/WebKit2/UIProcess/WebLoaderClient.h
@@ -37,8 +37,11 @@ class ResourceError;
 namespace WebKit {
 
 class APIObject;
-class WebPageProxy;
+class AuthenticationChallengeProxy;
+class AuthenticationDecisionListener;
 class WebFrameProxy;
+class WebPageProxy;
+class WebProtectionSpace;
 
 class WebLoaderClient : public APIClient<WKPageLoaderClient> {
 public:
@@ -55,6 +58,9 @@ public:
     void didRemoveFrameFromHierarchy(WebPageProxy*, WebFrameProxy*, APIObject*);
     void didDisplayInsecureContentForFrame(WebPageProxy*, WebFrameProxy*, APIObject*);
     void didRunInsecureContentForFrame(WebPageProxy*, WebFrameProxy*, APIObject*);
+    
+    bool canAuthenticateAgainstProtectionSpaceInFrame(WebPageProxy*, WebFrameProxy*, WebProtectionSpace*);
+    void didReceiveAuthenticationChallengeInFrame(WebPageProxy*, WebFrameProxy*, AuthenticationChallengeProxy*, AuthenticationDecisionListener*);
 
     void didStartProgress(WebPageProxy*);
     void didChangeProgress(WebPageProxy*);
diff --git a/WebKit2/UIProcess/WebPageProxy.cpp b/WebKit2/UIProcess/WebPageProxy.cpp
index 7132f2b..da6c957 100644
--- a/WebKit2/UIProcess/WebPageProxy.cpp
+++ b/WebKit2/UIProcess/WebPageProxy.cpp
@@ -25,6 +25,8 @@
 
 #include "WebPageProxy.h"
 
+#include "AuthenticationChallengeProxy.h"
+#include "AuthenticationDecisionListener.h"
 #include "DrawingAreaProxy.h"
 #include "FindIndicator.h"
 #include "MessageID.h"
@@ -55,6 +57,7 @@
 #include "WebProcessManager.h"
 #include "WebProcessMessages.h"
 #include "WebProcessProxy.h"
+#include "WebProtectionSpace.h"
 #include "WebURLRequest.h"
 #include <WebCore/FloatRect.h>
 #include <WebCore/MIMETypeRegistry.h>
@@ -1529,4 +1532,20 @@ void WebPageProxy::backForwardClear()
     m_backForwardList->clear();
 }
 
+void WebPageProxy::canAuthenticateAgainstProtectionSpaceInFrame(uint64_t frameID, const WebCore::ProtectionSpace& coreProtectionSpace, bool& canAuthenticate)
+{
+    WebFrameProxy* frame = process()->webFrame(frameID);
+    RefPtr<WebProtectionSpace> protectionSpace = WebProtectionSpace::create(coreProtectionSpace);
+    
+    canAuthenticate = m_loaderClient.canAuthenticateAgainstProtectionSpaceInFrame(this, frame, protectionSpace.get());
+}
+
+void WebPageProxy::didReceiveAuthenticationChallenge(uint64_t frameID, const WebCore::AuthenticationChallenge& coreChallenge, uint64_t challengeID)
+{
+    WebFrameProxy* frame = process()->webFrame(frameID);
+    RefPtr<AuthenticationChallengeProxy> authenticationChallenge = AuthenticationChallengeProxy::create(coreChallenge, challengeID, this);
+    
+    m_loaderClient.didReceiveAuthenticationChallengeInFrame(this, frame, authenticationChallenge.get(), authenticationChallenge->listener());
+}
+
 } // namespace WebKit
diff --git a/WebKit2/UIProcess/WebPageProxy.h b/WebKit2/UIProcess/WebPageProxy.h
index 2851351..846f30e 100644
--- a/WebKit2/UIProcess/WebPageProxy.h
+++ b/WebKit2/UIProcess/WebPageProxy.h
@@ -61,9 +61,11 @@ namespace CoreIPC {
 }
 
 namespace WebCore {
+    class AuthenticationChallenge;
     class Cursor;
     class FloatRect;
     class IntSize;
+    class ProtectionSpace;
     struct ViewportArguments;
     struct WindowFeatures;
 }
@@ -377,6 +379,9 @@ private:
     void didChangeAcceleratedCompositing(bool compositing, DrawingAreaInfo&);
 #endif
 
+    void canAuthenticateAgainstProtectionSpaceInFrame(uint64_t frameID, const WebCore::ProtectionSpace&, bool& canAuthenticate);
+    void didReceiveAuthenticationChallenge(uint64_t frameID, const WebCore::AuthenticationChallenge&, uint64_t challengeID);
+
     PageClient* m_pageClient;
     WebLoaderClient m_loaderClient;
     WebPolicyClient m_policyClient;
diff --git a/WebKit2/UIProcess/WebPageProxy.messages.in b/WebKit2/UIProcess/WebPageProxy.messages.in
index a585cce..0b33ed9 100644
--- a/WebKit2/UIProcess/WebPageProxy.messages.in
+++ b/WebKit2/UIProcess/WebPageProxy.messages.in
@@ -135,4 +135,8 @@ messages -> WebPageProxy {
     # Accelerated compsiting messages.
     DidChangeAcceleratedCompositing(bool compositing) -> (WebKit::DrawingAreaInfo newDrawingArea)
 #endif
+
+    # Authentication
+    CanAuthenticateAgainstProtectionSpaceInFrame(uint64_t frameID, WebCore::ProtectionSpace protectionSpace) -> (bool canAuthenticate)
+    DidReceiveAuthenticationChallenge(uint64_t frameID, WebCore::AuthenticationChallenge challenge, uint64_t challengeID)
 }
diff --git a/WebKit2/WebKit2.pro b/WebKit2/WebKit2.pro
index 1b718b4..c2234d6 100644
--- a/WebKit2/WebKit2.pro
+++ b/WebKit2/WebKit2.pro
@@ -130,11 +130,13 @@ INCLUDEPATH = \
     UIProcess/API/cpp \
     UIProcess/API/cpp/qt \
     UIProcess/API/qt \
+    UIProcess/Authentication \
     UIProcess/Downloads \
     UIProcess/Launcher \
     UIProcess/Plugins \
     UIProcess/qt \
     WebProcess \
+    WebProcess/Authentication \
     WebProcess/Downloads \
     WebProcess/Downloads/qt \
     WebProcess/InjectedBundle \
@@ -159,6 +161,7 @@ QMAKE_CXXFLAGS += "-include $$PREFIX_HEADER"
 DEFINES += BUILDING_QT__
 
 WEBKIT2_GENERATED_HEADERS = \
+    $$WEBKIT2_GENERATED_SOURCES_DIR/AuthenticationManagerMessages.h \
     $$WEBKIT2_GENERATED_SOURCES_DIR/DownloadProxyMessages.h \
     $$WEBKIT2_GENERATED_SOURCES_DIR/PluginControllerProxyMessages.h \
     $$WEBKIT2_GENERATED_SOURCES_DIR/PluginProcessMessages.h \
@@ -174,6 +177,7 @@ WEBKIT2_GENERATED_HEADERS = \
     $$WEBKIT2_GENERATED_SOURCES_DIR/WebProcessProxyMessages.h
 
 WEBKIT2_GENERATED_SOURCES = \
+    $$WEBKIT2_GENERATED_SOURCES_DIR/AuthenticationManagerMessageReceiver.cpp \
     $$WEBKIT2_GENERATED_SOURCES_DIR/DownloadProxyMessageReceiver.cpp \
     $$WEBKIT2_GENERATED_SOURCES_DIR/PluginControllerProxyMessageReceiver.cpp \
     $$WEBKIT2_GENERATED_SOURCES_DIR/PluginProcessMessageReceiver.cpp \
@@ -262,10 +266,13 @@ HEADERS += \
     Shared/qt/UpdateChunk.h \
     Shared/qt/WebEventFactoryQt.h \
     UIProcess/API/C/WKAPICast.h \
+    UIProcess/API/C/WKAuthenticationChallenge.h \
+    UIProcess/API/C/WKAuthenticationDecisionListener.h \
     UIProcess/API/C/WKBackForwardList.h \
     UIProcess/API/C/WKBackForwardListItem.h \
     UIProcess/API/C/WKContext.h \
     UIProcess/API/C/WKContextPrivate.h \
+    UIProcess/API/C/WKCredential.h \
     UIProcess/API/C/WKDownload.h \
     UIProcess/API/C/WKFrame.h \
     UIProcess/API/C/WKFramePolicyListener.h \
@@ -277,6 +284,7 @@ HEADERS += \
     UIProcess/API/C/WKPagePrivate.h \
     UIProcess/API/C/WKPreferences.h \
     UIProcess/API/C/WKPreferencesPrivate.h \
+    UIProcess/API/C/WKProtectionSpace.h \
     UIProcess/API/C/WebKit2.h \
     UIProcess/API/C/qt/WKNativeEvent.h \
     UIProcess/API/cpp/WKRetainPtr.h \
@@ -289,6 +297,10 @@ HEADERS += \
     UIProcess/API/qt/qwkpage.h \
     UIProcess/API/qt/qwkpage_p.h \
     UIProcess/API/qt/qwkpreferences.h \
+    UIProcess/Authentication/AuthenticationChallengeProxy.h \
+    UIProcess/Authentication/AuthenticationDecisionListener.h \
+    UIProcess/Authentication/WebCredential.h \
+    UIProcess/Authentication/WebProtectionSpace.h \
     UIProcess/ChunkedUpdateDrawingAreaProxy.h \
     UIProcess/Downloads/DownloadProxy.h \
     UIProcess/DrawingAreaProxy.h \
@@ -329,6 +341,7 @@ HEADERS += \
     UIProcess/WebUIClient.h \
     UIProcess/qt/WebContextMenuProxyQt.h \
     UIProcess/qt/WebPopupMenuProxyQt.h \
+    WebProcess/Authentication/AuthenticationManager.h \
     WebProcess/Downloads/Download.h \
     WebProcess/Downloads/DownloadManager.h \
     WebProcess/InjectedBundle/API/c/WKBundleBackForwardList.h \
@@ -448,9 +461,12 @@ SOURCES += \
     Shared/qt/WebEventFactoryQt.cpp \
     Shared/qt/WebURLRequestQt.cpp \
     Shared/qt/WebURLResponseQt.cpp \
+    UIProcess/API/C/WKAuthenticationChallenge.cpp \
+    UIProcess/API/C/WKAuthenticationDecisionListener.cpp \
     UIProcess/API/C/WKBackForwardList.cpp \
     UIProcess/API/C/WKBackForwardListItem.cpp \
     UIProcess/API/C/WKContext.cpp \
+    UIProcess/API/C/WKCredential.cpp \
     UIProcess/API/C/WKDownload.cpp \
     UIProcess/API/C/WKFrame.cpp \
     UIProcess/API/C/WKFramePolicyListener.cpp \
@@ -460,6 +476,7 @@ SOURCES += \
     UIProcess/API/C/WKPageGroup.cpp \
     UIProcess/API/C/WKPageNamespace.cpp \
     UIProcess/API/C/WKPreferences.cpp \
+    UIProcess/API/C/WKProtectionSpace.cpp \
     UIProcess/API/cpp/qt/WKStringQt.cpp \
     UIProcess/API/cpp/qt/WKURLQt.cpp \
     UIProcess/API/qt/ClientImpl.cpp \
@@ -467,6 +484,10 @@ SOURCES += \
     UIProcess/API/qt/qwkhistory.cpp \
     UIProcess/API/qt/qwkpage.cpp \
     UIProcess/API/qt/qwkpreferences.cpp \
+    UIProcess/Authentication/AuthenticationChallengeProxy.cpp \
+    UIProcess/Authentication/AuthenticationDecisionListener.cpp \
+    UIProcess/Authentication/WebCredential.cpp \
+    UIProcess/Authentication/WebProtectionSpace.cpp \
     UIProcess/ChunkedUpdateDrawingAreaProxy.cpp \
     UIProcess/Downloads/DownloadProxy.cpp \
     UIProcess/DrawingAreaProxy.cpp \
@@ -514,6 +535,7 @@ SOURCES += \
     UIProcess/qt/WebInspectorProxyQt.cpp \
     UIProcess/qt/WebPopupMenuProxyQt.cpp \
     UIProcess/qt/WebPreferencesQt.cpp \
+    WebProcess/Authentication/AuthenticationManager.cpp \
     WebProcess/Downloads/Download.cpp \
     WebProcess/Downloads/DownloadManager.cpp \
     WebProcess/Downloads/qt/DownloadQt.cpp \
diff --git a/WebKit2/WebKit2.xcodeproj/project.pbxproj b/WebKit2/WebKit2.xcodeproj/project.pbxproj
index 84850f5..fe165e5 100644
--- a/WebKit2/WebKit2.xcodeproj/project.pbxproj
+++ b/WebKit2/WebKit2.xcodeproj/project.pbxproj
@@ -205,6 +205,27 @@
 		512935D81288D19400A4B695 /* WebContextMenuItem.h in Headers */ = {isa = PBXBuildFile; fileRef = 512935D61288D19400A4B695 /* WebContextMenuItem.h */; };
 		512935E31288D97800A4B695 /* InjectedBundlePageContextMenuClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 512935E11288D97800A4B695 /* InjectedBundlePageContextMenuClient.cpp */; };
 		512935E41288D97800A4B695 /* InjectedBundlePageContextMenuClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 512935E21288D97800A4B695 /* InjectedBundlePageContextMenuClient.h */; };
+		512F588A12A8836600629530 /* AuthenticationManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 512F588712A8836600629530 /* AuthenticationManager.cpp */; };
+		512F588B12A8836600629530 /* AuthenticationManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 512F588812A8836600629530 /* AuthenticationManager.h */; };
+		512F588C12A8836600629530 /* AuthenticationManager.messages.in in Resources */ = {isa = PBXBuildFile; fileRef = 512F588912A8836600629530 /* AuthenticationManager.messages.in */; };
+		512F589612A8838800629530 /* AuthenticationChallengeProxy.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 512F588E12A8838800629530 /* AuthenticationChallengeProxy.cpp */; };
+		512F589712A8838800629530 /* AuthenticationChallengeProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = 512F588F12A8838800629530 /* AuthenticationChallengeProxy.h */; };
+		512F589812A8838800629530 /* AuthenticationDecisionListener.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 512F589012A8838800629530 /* AuthenticationDecisionListener.cpp */; };
+		512F589912A8838800629530 /* AuthenticationDecisionListener.h in Headers */ = {isa = PBXBuildFile; fileRef = 512F589112A8838800629530 /* AuthenticationDecisionListener.h */; };
+		512F589A12A8838800629530 /* WebCredential.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 512F589212A8838800629530 /* WebCredential.cpp */; };
+		512F589B12A8838800629530 /* WebCredential.h in Headers */ = {isa = PBXBuildFile; fileRef = 512F589312A8838800629530 /* WebCredential.h */; };
+		512F589C12A8838800629530 /* WebProtectionSpace.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 512F589412A8838800629530 /* WebProtectionSpace.cpp */; };
+		512F589D12A8838800629530 /* WebProtectionSpace.h in Headers */ = {isa = PBXBuildFile; fileRef = 512F589512A8838800629530 /* WebProtectionSpace.h */; };
+		512F58A212A883AD00629530 /* AuthenticationManagerMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 512F58A012A883AD00629530 /* AuthenticationManagerMessageReceiver.cpp */; };
+		512F58A312A883AD00629530 /* AuthenticationManagerMessages.h in Headers */ = {isa = PBXBuildFile; fileRef = 512F58A112A883AD00629530 /* AuthenticationManagerMessages.h */; };
+		512F58F512A88A5400629530 /* WKAuthenticationChallenge.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 512F58ED12A88A5400629530 /* WKAuthenticationChallenge.cpp */; };
+		512F58F612A88A5400629530 /* WKAuthenticationChallenge.h in Headers */ = {isa = PBXBuildFile; fileRef = 512F58EE12A88A5400629530 /* WKAuthenticationChallenge.h */; };
+		512F58F712A88A5400629530 /* WKAuthenticationDecisionListener.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 512F58EF12A88A5400629530 /* WKAuthenticationDecisionListener.cpp */; };
+		512F58F812A88A5400629530 /* WKAuthenticationDecisionListener.h in Headers */ = {isa = PBXBuildFile; fileRef = 512F58F012A88A5400629530 /* WKAuthenticationDecisionListener.h */; };
+		512F58F912A88A5400629530 /* WKCredential.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 512F58F112A88A5400629530 /* WKCredential.cpp */; };
+		512F58FA12A88A5400629530 /* WKCredential.h in Headers */ = {isa = PBXBuildFile; fileRef = 512F58F212A88A5400629530 /* WKCredential.h */; };
+		512F58FB12A88A5400629530 /* WKProtectionSpace.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 512F58F312A88A5400629530 /* WKProtectionSpace.cpp */; };
+		512F58FC12A88A5400629530 /* WKProtectionSpace.h in Headers */ = {isa = PBXBuildFile; fileRef = 512F58F412A88A5400629530 /* WKProtectionSpace.h */; };
 		5153569C1291B1D2000749DC /* WebPageContextMenuClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5153569A1291B1D2000749DC /* WebPageContextMenuClient.cpp */; };
 		5153569D1291B1D2000749DC /* WebPageContextMenuClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 5153569B1291B1D2000749DC /* WebPageContextMenuClient.h */; };
 		51578B831209ECEF00A37C4A /* WebData.h in Headers */ = {isa = PBXBuildFile; fileRef = 51578B821209ECEF00A37C4A /* WebData.h */; };
@@ -810,6 +831,27 @@
 		512935D61288D19400A4B695 /* WebContextMenuItem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebContextMenuItem.h; sourceTree = "<group>"; };
 		512935E11288D97800A4B695 /* InjectedBundlePageContextMenuClient.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InjectedBundlePageContextMenuClient.cpp; sourceTree = "<group>"; };
 		512935E21288D97800A4B695 /* InjectedBundlePageContextMenuClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InjectedBundlePageContextMenuClient.h; sourceTree = "<group>"; };
+		512F588712A8836600629530 /* AuthenticationManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AuthenticationManager.cpp; sourceTree = "<group>"; };
+		512F588812A8836600629530 /* AuthenticationManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AuthenticationManager.h; sourceTree = "<group>"; };
+		512F588912A8836600629530 /* AuthenticationManager.messages.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = AuthenticationManager.messages.in; sourceTree = "<group>"; };
+		512F588E12A8838800629530 /* AuthenticationChallengeProxy.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AuthenticationChallengeProxy.cpp; sourceTree = "<group>"; };
+		512F588F12A8838800629530 /* AuthenticationChallengeProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AuthenticationChallengeProxy.h; sourceTree = "<group>"; };
+		512F589012A8838800629530 /* AuthenticationDecisionListener.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AuthenticationDecisionListener.cpp; sourceTree = "<group>"; };
+		512F589112A8838800629530 /* AuthenticationDecisionListener.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AuthenticationDecisionListener.h; sourceTree = "<group>"; };
+		512F589212A8838800629530 /* WebCredential.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebCredential.cpp; sourceTree = "<group>"; };
+		512F589312A8838800629530 /* WebCredential.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebCredential.h; sourceTree = "<group>"; };
+		512F589412A8838800629530 /* WebProtectionSpace.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebProtectionSpace.cpp; sourceTree = "<group>"; };
+		512F589512A8838800629530 /* WebProtectionSpace.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebProtectionSpace.h; sourceTree = "<group>"; };
+		512F58A012A883AD00629530 /* AuthenticationManagerMessageReceiver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AuthenticationManagerMessageReceiver.cpp; sourceTree = "<group>"; };
+		512F58A112A883AD00629530 /* AuthenticationManagerMessages.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AuthenticationManagerMessages.h; sourceTree = "<group>"; };
+		512F58ED12A88A5400629530 /* WKAuthenticationChallenge.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKAuthenticationChallenge.cpp; sourceTree = "<group>"; };
+		512F58EE12A88A5400629530 /* WKAuthenticationChallenge.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKAuthenticationChallenge.h; sourceTree = "<group>"; };
+		512F58EF12A88A5400629530 /* WKAuthenticationDecisionListener.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKAuthenticationDecisionListener.cpp; sourceTree = "<group>"; };
+		512F58F012A88A5400629530 /* WKAuthenticationDecisionListener.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKAuthenticationDecisionListener.h; sourceTree = "<group>"; };
+		512F58F112A88A5400629530 /* WKCredential.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKCredential.cpp; sourceTree = "<group>"; };
+		512F58F212A88A5400629530 /* WKCredential.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKCredential.h; sourceTree = "<group>"; };
+		512F58F312A88A5400629530 /* WKProtectionSpace.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKProtectionSpace.cpp; sourceTree = "<group>"; };
+		512F58F412A88A5400629530 /* WKProtectionSpace.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKProtectionSpace.h; sourceTree = "<group>"; };
 		5153569A1291B1D2000749DC /* WebPageContextMenuClient.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebPageContextMenuClient.cpp; sourceTree = "<group>"; };
 		5153569B1291B1D2000749DC /* WebPageContextMenuClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebPageContextMenuClient.h; sourceTree = "<group>"; };
 		51578B821209ECEF00A37C4A /* WebData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebData.h; sourceTree = "<group>"; };
@@ -1613,6 +1655,31 @@
 			tabWidth = 8;
 			usesTabs = 0;
 		};
+		512F588612A8834700629530 /* Authentication */ = {
+			isa = PBXGroup;
+			children = (
+				512F588712A8836600629530 /* AuthenticationManager.cpp */,
+				512F588812A8836600629530 /* AuthenticationManager.h */,
+				512F588912A8836600629530 /* AuthenticationManager.messages.in */,
+			);
+			path = Authentication;
+			sourceTree = "<group>";
+		};
+		512F588D12A8836F00629530 /* Authentication */ = {
+			isa = PBXGroup;
+			children = (
+				512F588E12A8838800629530 /* AuthenticationChallengeProxy.cpp */,
+				512F588F12A8838800629530 /* AuthenticationChallengeProxy.h */,
+				512F589012A8838800629530 /* AuthenticationDecisionListener.cpp */,
+				512F589112A8838800629530 /* AuthenticationDecisionListener.h */,
+				512F589212A8838800629530 /* WebCredential.cpp */,
+				512F589312A8838800629530 /* WebCredential.h */,
+				512F589412A8838800629530 /* WebProtectionSpace.cpp */,
+				512F589512A8838800629530 /* WebProtectionSpace.h */,
+			);
+			path = Authentication;
+			sourceTree = "<group>";
+		};
 		51B3004D12529CF5000B5CA0 /* cf */ = {
 			isa = PBXGroup;
 			children = (
@@ -1626,6 +1693,7 @@
 		BC032D5C10F436D50058C15A /* WebProcess */ = {
 			isa = PBXGroup;
 			children = (
+				512F588612A8834700629530 /* Authentication */,
 				1A61614C127798B5003ACD86 /* Downloads */,
 				BC204EDF11C83E72008F3375 /* InjectedBundle */,
 				1A6FA01C11E1526300DB1371 /* mac */,
@@ -1710,6 +1778,7 @@
 			isa = PBXGroup;
 			children = (
 				BC032DC410F4387C0058C15A /* API */,
+				512F588D12A8836F00629530 /* Authentication */,
 				51B3004D12529CF5000B5CA0 /* cf */,
 				1AB7D4C71288AA9A00CFD08C /* Downloads */,
 				BC111B18112F5FB400337BAB /* Launcher */,
@@ -1809,6 +1878,10 @@
 			children = (
 				BCB63477116BF10600603215 /* WebKit2.h */,
 				BCDDB32C124EC2E10048D13C /* WKAPICast.h */,
+				512F58ED12A88A5400629530 /* WKAuthenticationChallenge.cpp */,
+				512F58EE12A88A5400629530 /* WKAuthenticationChallenge.h */,
+				512F58EF12A88A5400629530 /* WKAuthenticationDecisionListener.cpp */,
+				512F58F012A88A5400629530 /* WKAuthenticationDecisionListener.h */,
 				BC646C1611DD399F006455B0 /* WKBackForwardList.cpp */,
 				BC646C1711DD399F006455B0 /* WKBackForwardList.h */,
 				BC646C1811DD399F006455B0 /* WKBackForwardListItem.cpp */,
@@ -1816,6 +1889,8 @@
 				BCB9E24A1120E15C00A137E0 /* WKContext.cpp */,
 				BCB9E2491120E15C00A137E0 /* WKContext.h */,
 				BCC938E01180DE440085E5FE /* WKContextPrivate.h */,
+				512F58F112A88A5400629530 /* WKCredential.cpp */,
+				512F58F212A88A5400629530 /* WKCredential.h */,
 				1AB7D78C1288CD9A00CFD08C /* WKDownload.cpp */,
 				1AB7D78B1288CD9A00CFD08C /* WKDownload.h */,
 				BCE469571214EDF4000B98EB /* WKFormSubmissionListener.cpp */,
@@ -1839,6 +1914,8 @@
 				BCD597CF112B56AC00EC8C23 /* WKPreferences.cpp */,
 				BCD597CE112B56AC00EC8C23 /* WKPreferences.h */,
 				762B7484120BBA2D00819339 /* WKPreferencesPrivate.h */,
+				512F58F312A88A5400629530 /* WKProtectionSpace.cpp */,
+				512F58F412A88A5400629530 /* WKProtectionSpace.h */,
 			);
 			path = C;
 			sourceTree = "<group>";
@@ -2195,6 +2272,8 @@
 		C0CE729D1247E71D00BC0EC4 /* Derived Sources */ = {
 			isa = PBXGroup;
 			children = (
+				512F58A012A883AD00629530 /* AuthenticationManagerMessageReceiver.cpp */,
+				512F58A112A883AD00629530 /* AuthenticationManagerMessages.h */,
 				1AB7D6171288B9D900CFD08C /* DownloadProxyMessageReceiver.cpp */,
 				1AB7D6181288B9D900CFD08C /* DownloadProxyMessages.h */,
 				1A2D8437127F65D5001EB962 /* NPObjectMessageReceiverMessageReceiver.cpp */,
@@ -2528,6 +2607,16 @@
 				BC7B633712A45ABA00D174A4 /* WKPageGroup.h in Headers */,
 				BC7B633D12A45D1200D174A4 /* WKBundlePageGroup.h in Headers */,
 				37F623B812A57B6200E3FDF6 /* WKFindOptions.h in Headers */,
+				512F588B12A8836600629530 /* AuthenticationManager.h in Headers */,
+				512F589712A8838800629530 /* AuthenticationChallengeProxy.h in Headers */,
+				512F589912A8838800629530 /* AuthenticationDecisionListener.h in Headers */,
+				512F589B12A8838800629530 /* WebCredential.h in Headers */,
+				512F589D12A8838800629530 /* WebProtectionSpace.h in Headers */,
+				512F58A312A883AD00629530 /* AuthenticationManagerMessages.h in Headers */,
+				512F58F612A88A5400629530 /* WKAuthenticationChallenge.h in Headers */,
+				512F58F812A88A5400629530 /* WKAuthenticationDecisionListener.h in Headers */,
+				512F58FA12A88A5400629530 /* WKCredential.h in Headers */,
+				512F58FC12A88A5400629530 /* WKProtectionSpace.h in Headers */,
 				F634445612A885C8000612D8 /* WebSecurityOrigin.h in Headers */,
 				F634445D12A885E9000612D8 /* WKSecurityOrigin.h in Headers */,
 			);
@@ -2635,6 +2724,7 @@
 			buildActionMask = 2147483647;
 			files = (
 				8DC2EF530486A6940098B216 /* InfoPlist.strings in Resources */,
+				512F588C12A8836600629530 /* AuthenticationManager.messages.in in Resources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -2925,6 +3015,16 @@
 				1AA4792312A59FD9008236C3 /* PluginProcessMac.mm in Sources */,
 				BC84EB1812A7100C0083F2DA /* WebPreferencesMac.mm in Sources */,
 				BC2DFBA312A761A500E732A3 /* WebPreferencesCF.cpp in Sources */,
+				512F588A12A8836600629530 /* AuthenticationManager.cpp in Sources */,
+				512F589612A8838800629530 /* AuthenticationChallengeProxy.cpp in Sources */,
+				512F589812A8838800629530 /* AuthenticationDecisionListener.cpp in Sources */,
+				512F589A12A8838800629530 /* WebCredential.cpp in Sources */,
+				512F589C12A8838800629530 /* WebProtectionSpace.cpp in Sources */,
+				512F58A212A883AD00629530 /* AuthenticationManagerMessageReceiver.cpp in Sources */,
+				512F58F512A88A5400629530 /* WKAuthenticationChallenge.cpp in Sources */,
+				512F58F712A88A5400629530 /* WKAuthenticationDecisionListener.cpp in Sources */,
+				512F58F912A88A5400629530 /* WKCredential.cpp in Sources */,
+				512F58FB12A88A5400629530 /* WKProtectionSpace.cpp in Sources */,
 				F634445C12A885E9000612D8 /* WKSecurityOrigin.cpp in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
diff --git a/WebKit2/WebProcess/Authentication/AuthenticationManager.cpp b/WebKit2/WebProcess/Authentication/AuthenticationManager.cpp
new file mode 100644
index 0000000..36757d6
--- /dev/null
+++ b/WebKit2/WebProcess/Authentication/AuthenticationManager.cpp
@@ -0,0 +1,104 @@
+/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "AuthenticationManager.h"
+
+#include "MessageID.h"
+#include "WebCoreArgumentCoders.h"
+#include "WebFrame.h"
+#include "WebPage.h"
+#include "WebPageProxyMessages.h"
+#include "WebProcess.h"
+#include <WebCore/AuthenticationChallenge.h>
+#include <WebCore/AuthenticationClient.h>
+
+namespace WebKit {
+
+static uint64_t generateAuthenticationChallengeID()
+{
+    static uint64_t uniqueAuthenticationChallengeID = 1;
+    return uniqueAuthenticationChallengeID++;
+}
+
+AuthenticationManager& AuthenticationManager::shared()
+{
+    static AuthenticationManager& manager = *new AuthenticationManager;
+    return manager;
+}
+
+AuthenticationManager::AuthenticationManager()
+{
+}
+
+void AuthenticationManager::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder* arguments)
+{
+    didReceiveAuthenticationManagerMessage(connection, messageID, arguments);
+}
+
+void AuthenticationManager::didReceiveAuthenticationChallenge(WebFrame* frame, const WebCore::AuthenticationChallenge& authenticationChallenge)
+{
+    ASSERT(frame);
+    ASSERT(frame->page());
+
+    uint64_t id = generateAuthenticationChallengeID();
+    m_challenges.set(id, authenticationChallenge);    
+    
+    WebProcess::shared().connection()->send(Messages::WebPageProxy::DidReceiveAuthenticationChallenge(frame->frameID(), authenticationChallenge, id), frame->page()->pageID());
+}
+
+void AuthenticationManager::useCredentialForChallenge(uint64_t challengeID, const WebCore::Credential& credential)
+{
+    WebCore::AuthenticationChallenge challenge = m_challenges.take(challengeID);
+    ASSERT(!challenge.isNull());
+    WebCore::AuthenticationClient* coreClient = challenge.authenticationClient();
+    if (!coreClient)
+        return;
+
+    coreClient->receivedCredential(challenge, credential);
+}
+
+void AuthenticationManager::continueWithoutCredentialForChallenge(uint64_t challengeID)
+{
+    WebCore::AuthenticationChallenge challenge = m_challenges.take(challengeID);
+    ASSERT(!challenge.isNull());
+    WebCore::AuthenticationClient* coreClient = challenge.authenticationClient();
+    if (!coreClient)
+        return;
+
+    coreClient->receivedRequestToContinueWithoutCredential(challenge);
+}
+
+void AuthenticationManager::cancelChallenge(uint64_t challengeID)
+{
+    WebCore::AuthenticationChallenge challenge = m_challenges.take(challengeID);
+    ASSERT(!challenge.isNull());
+    WebCore::AuthenticationClient* coreClient = challenge.authenticationClient();
+    if (!coreClient)
+        return;
+
+    coreClient->receivedCancellation(challenge);
+}
+
+} // namespace WebKit
diff --git a/WebKit2/WebProcess/Authentication/AuthenticationManager.h b/WebKit2/WebProcess/Authentication/AuthenticationManager.h
new file mode 100644
index 0000000..ce5ff1c
--- /dev/null
+++ b/WebKit2/WebProcess/Authentication/AuthenticationManager.h
@@ -0,0 +1,71 @@
+/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef AuthenticationManager_h
+#define AuthenticationManager_h
+
+#include <wtf/HashMap.h>
+
+namespace CoreIPC {
+    class ArgumentDecoder;
+    class Connection;
+    class MessageID;
+}
+
+namespace WebCore {
+    class AuthenticationChallenge;
+    class Credential;
+}
+
+namespace WebKit {
+
+class WebFrame;
+
+class AuthenticationManager {
+    WTF_MAKE_NONCOPYABLE(AuthenticationManager);
+
+public:
+    static AuthenticationManager& shared();
+
+    void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
+
+    void didReceiveAuthenticationChallenge(WebFrame*, const WebCore::AuthenticationChallenge&);
+
+    void useCredentialForChallenge(uint64_t challengeID, const WebCore::Credential&);
+    void continueWithoutCredentialForChallenge(uint64_t challengeID);
+    void cancelChallenge(uint64_t challengeID);
+
+private:
+    AuthenticationManager();
+
+    void didReceiveAuthenticationManagerMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
+
+    typedef HashMap<uint64_t, WebCore::AuthenticationChallenge> AuthenticationChallengeMap;
+    AuthenticationChallengeMap m_challenges;
+};
+
+} // namespace WebKit
+
+#endif // AuthenticationManager_h
diff --git a/WebKit2/WebProcess/Authentication/AuthenticationManager.messages.in b/WebKit2/WebProcess/Authentication/AuthenticationManager.messages.in
new file mode 100644
index 0000000..264cd55
--- /dev/null
+++ b/WebKit2/WebProcess/Authentication/AuthenticationManager.messages.in
@@ -0,0 +1,27 @@
+# Copyright (C) 2010 Apple Inc. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1.  Redistributions of source code must retain the above copyright
+#     notice, this list of conditions and the following disclaimer.
+# 2.  Redistributions in binary form must reproduce the above copyright
+#     notice, this list of conditions and the following disclaimer in the
+#     documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR
+# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+messages -> AuthenticationManager {
+    void UseCredentialForChallenge(uint64_t challengeID, WebCore::Credential credential);
+    void ContinueWithoutCredentialForChallenge(uint64_t challengeID);
+    void CancelChallenge(uint64_t challengeID);
+}
diff --git a/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp b/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp
index 682e76f..88dd99e 100644
--- a/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp
+++ b/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp
@@ -28,6 +28,7 @@
 #define DISABLE_NOT_IMPLEMENTED_WARNINGS 1
 #include "NotImplemented.h"
 
+#include "AuthenticationManager.h"
 #include "InjectedBundleUserMessageCoders.h"
 #include "PlatformCertificateInfo.h"
 #include "PluginView.h"
@@ -155,9 +156,16 @@ bool WebFrameLoaderClient::shouldUseCredentialStorage(DocumentLoader*, unsigned
     return false;
 }
 
-void WebFrameLoaderClient::dispatchDidReceiveAuthenticationChallenge(DocumentLoader*, unsigned long identifier, const AuthenticationChallenge&)
+void WebFrameLoaderClient::dispatchDidReceiveAuthenticationChallenge(DocumentLoader*, unsigned long, const AuthenticationChallenge& challenge)
 {
-    notImplemented();
+    // FIXME: Authentication is a per-resource concept, but we don't do per-resource handling in the UIProcess at the API level quite yet.
+    // Once we do, we might need to make sure authentication fits with our solution.
+
+    WebPage* webPage = m_frame->page();
+    if (!webPage)
+        return;
+
+    AuthenticationManager::shared().didReceiveAuthenticationChallenge(m_frame, challenge);
 }
 
 void WebFrameLoaderClient::dispatchDidCancelAuthenticationChallenge(DocumentLoader*, unsigned long identifier, const AuthenticationChallenge&)    
@@ -166,10 +174,20 @@ void WebFrameLoaderClient::dispatchDidCancelAuthenticationChallenge(DocumentLoad
 }
 
 #if USE(PROTECTION_SPACE_AUTH_CALLBACK)
-bool WebFrameLoaderClient::canAuthenticateAgainstProtectionSpace(DocumentLoader*, unsigned long identifier, const ProtectionSpace&)
+bool WebFrameLoaderClient::canAuthenticateAgainstProtectionSpace(DocumentLoader*, unsigned long, const ProtectionSpace& protectionSpace)
 {
-    notImplemented();
-    return false;
+    // FIXME: Authentication is a per-resource concept, but we don't do per-resource handling in the UIProcess at the API level quite yet.
+    // Once we do, we might need to make sure authentication fits with our solution.
+    
+    WebPage* webPage = m_frame->page();
+    if (!webPage)
+        return false;
+        
+    bool canAuthenticate;
+    if (!webPage->sendSync(Messages::WebPageProxy::CanAuthenticateAgainstProtectionSpaceInFrame(m_frame->frameID(), protectionSpace), Messages::WebPageProxy::CanAuthenticateAgainstProtectionSpaceInFrame::Reply(canAuthenticate)))
+        return false;
+    
+    return canAuthenticate;
 }
 #endif
 
diff --git a/WebKit2/WebProcess/WebProcess.cpp b/WebKit2/WebProcess/WebProcess.cpp
index adb1668..b572dac 100644
--- a/WebKit2/WebProcess/WebProcess.cpp
+++ b/WebKit2/WebProcess/WebProcess.cpp
@@ -25,6 +25,7 @@
 
 #include "WebProcess.h"
 
+#include "AuthenticationManager.h"
 #include "DownloadManager.h"
 #include "InjectedBundle.h"
 #include "InjectedBundleMessageKinds.h"
@@ -458,6 +459,11 @@ void WebProcess::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::Mes
         return;
     }
 
+    if (messageID.is<CoreIPC::MessageClassAuthenticationManager>()) {
+        AuthenticationManager::shared().didReceiveMessage(connection, messageID, arguments);
+        return;
+    }
+
     if (messageID.is<CoreIPC::MessageClassInjectedBundle>()) {
         if (!m_injectedBundle)
             return;
diff --git a/WebKit2/win/WebKit2.vcproj b/WebKit2/win/WebKit2.vcproj
index ad8e788..ecc85f8 100755
--- a/WebKit2/win/WebKit2.vcproj
+++ b/WebKit2/win/WebKit2.vcproj
@@ -1099,6 +1099,22 @@
 				>
 			</File>
 			<Filter
+				Name="Authentication"
+				>
+				<File
+					RelativePath="..\WebProcess\Authentication\AuthenticationManager.cpp"
+					>
+				</File>
+				<File
+					RelativePath="..\WebProcess\Authentication\AuthenticationManager.h"
+					>
+				</File>
+				<File
+					RelativePath="..\WebProcess\Authentication\AuthenticationManager.messages.in"
+					>
+				</File>
+			</Filter>
+			<Filter
 				Name="WebCoreSupport"
 				>
 				<File
@@ -2029,6 +2045,22 @@
 						>
 					</File>
 					<File
+						RelativePath="..\UIProcess\API\C\WKAuthenticationChallenge.cpp"
+						>
+					</File>
+					<File
+						RelativePath="..\UIProcess\API\C\WKAuthenticationChallenge.h"
+						>
+					</File>
+					<File
+						RelativePath="..\UIProcess\API\C\WKAuthenticationDecisionListener.cpp"
+						>
+					</File>
+					<File
+						RelativePath="..\UIProcess\API\C\WKAuthenticationDecisionListener.h"
+						>
+					</File>
+					<File
 						RelativePath="..\UIProcess\API\C\WKBackForwardList.cpp"
 						>
 					</File>
@@ -2065,6 +2097,14 @@
 						>
 					</File>
 					<File
+						RelativePath="..\UIProcess\API\C\WKCredential.cpp"
+						>
+					</File>
+					<File
+						RelativePath="..\UIProcess\API\C\WKCredential.h"
+						>
+					</File>
+					<File
 						RelativePath="..\UIProcess\API\C\WKDownload.cpp"
 						>
 					</File>
@@ -2156,6 +2196,14 @@
 						RelativePath="..\UIProcess\API\C\WKPreferencesPrivate.h"
 						>
 					</File>
+					<File
+						RelativePath="..\UIProcess\API\C\WKProtectionSpace.cpp"
+						>
+					</File>
+					<File
+						RelativePath="..\UIProcess\API\C\WKProtectionSpace.h"
+						>
+					</File>
 					<Filter
 						Name="win"
 						>
@@ -2195,6 +2243,42 @@
 				</Filter>
 			</Filter>
 			<Filter
+				Name="Authentication"
+				>
+				<File
+					RelativePath="..\UIProcess\Authentication\AuthenticationChallengeProxy.cpp"
+					>
+				</File>
+				<File
+					RelativePath="..\UIProcess\Authentication\AuthenticationChallengeProxy.h"
+					>
+				</File>
+				<File
+					RelativePath="..\UIProcess\Authentication\AuthenticationDecisionListener.cpp"
+					>
+				</File>
+				<File
+					RelativePath="..\UIProcess\Authentication\AuthenticationDecisionListener.h"
+					>
+				</File>
+				<File
+					RelativePath="..\UIProcess\Authentication\WebCredential.cpp"
+					>
+				</File>
+				<File
+					RelativePath="..\UIProcess\Authentication\WebCredential.h"
+					>
+				</File>
+				<File
+					RelativePath="..\UIProcess\Authentication\WebProtectionSpace.cpp"
+					>
+				</File>
+				<File
+					RelativePath="..\UIProcess\Authentication\WebProtectionSpace.h"
+					>
+				</File>
+			</Filter>
+			<Filter
 				Name="cf"
 				>
 				<File
@@ -2595,6 +2679,14 @@
 			Name="Derived Sources"
 			>
 			<File
+				RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\AuthenticationManagerMessageReceiver.cpp"
+				>
+			</File>
+			<File
+				RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\AuthenticationManagerMessages.h"
+				>
+			</File>
+			<File
 				RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\DownloadProxyMessageReceiver.cpp"
 				>
 			</File>
diff --git a/WebKit2/win/WebKit2Common.vsprops b/WebKit2/win/WebKit2Common.vsprops
index 659e5a3..2dd8dcf 100755
--- a/WebKit2/win/WebKit2Common.vsprops
+++ b/WebKit2/win/WebKit2Common.vsprops
@@ -6,7 +6,7 @@
 	>
 	<Tool
 		Name="VCCLCompilerTool"
-		AdditionalIncludeDirectories="&quot;$(ProjectDir)\..\Platform&quot;;&quot;$(ProjectDir)\..\Platform\CoreIPC&quot;;&quot;$(ProjectDir)\..\PluginProcess&quot;;&quot;$(ProjectDir)\..\Shared&quot;;&quot;$(ProjectDir)\..\Shared\win&quot;;&quot;$(ProjectDir)\..\Shared\API\c&quot;;&quot;$(ProjectDir)\..\Shared\API\c\cf&quot;;&quot;$(ProjectDir)\..\Shared\API\c\win&quot;;&quot;$(ProjectDir)\..\Shared\CoreIPCSupport&quot;;&quot;$(ProjectDir)\..\UIProcess&quot;;&quot;$(ProjectDir)\..\UIProcess\API\C&quot;;&quot;$(ProjectDir)\..\UIProcess\API\C\win&quot;;&quot;$(ProjectDir)\..\UIProcess\API\cpp&quot;;&quot;$(ProjectDir)\..\UIProcess\API\win&quot;;&quot;$(ProjectDir)\..\UIProcess\Downloads&quot;;&quot;$(ProjectDir)\..\UIProcess\Launcher&quot;;&quot;$(ProjectDir)\..\UIProcess\Plugins&quot;;&quot;$(ProjectDir)\..\UIProcess\win&quot;;&quot;$(ProjectDir)\..\WebProcess&quot;;&quot;$(ProjectDir)\..\WebProcess\WebCoreSupport&quot;;&quot;$(ProjectDir)\..\WebProcess\WebCoreSupport\win&quot;;&quot;$(ProjectDir)\..\WebProcess\WebPage&quot;;&quot;$(ProjectDir)\..\WebProcess\WebPage\win&quot;;&quot;$(ProjectDir)\..\WebProcess\InjectedBundle&quot;;&quot;$(ProjectDir)\..\WebProcess\InjectedBundle\API\c&quot;;&quot;$(ProjectDir)\..\WebProcess\InjectedBundle\DOM&quot;;&quot;$(ProjectDir)\..\WebProcess\InjectedBundle\win&quot;;&quot;$(ProjectDir)\..\WebProcess\Plugins&quot;;&quot;$(ProjectDir)\..\WebProcess\Plugins\Netscape&quot;;&quot;$(ProjectDir)\..\WebProcess\win&quot;;&quot;$(ProjectDir)\..\WebProcess\Downloads&quot;;&quot;$(ProjectDir)\..\WebProcess\Downloads\cf&quot;;&quot;$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources&quot;;&quot;$(WebKitOutputDir)\Include&quot;;&quot;$(WebKitOutputDir)\Include\private&quot;;&quot;$(WebKitLibrariesDir)\Include&quot;;&quot;$(WebKitLibrariesDir)\Include\private&quot;;&quot;$(WebKitLibrariesDir)\Include\pthreads&quot;;&quot;$(WebKitOutputDir)\Include\JavaScriptCore&quot;;&quot;$(WebKitOutputDir)\Include\private\JavaScriptCore&quot;;&quot;$(WebKitLibrariesDir)\Include\JavaScriptCore&quot;;&quot;$(WebKitLibrariesDir)\Include\private\JavaScriptCore&quot;;&quot;$(WebKitOutputDir)\Include\WebCore\ForwardingHeaders&quot;;&quot;$(WebKitLibrariesDir)\Include\WebCore\ForwardingHeaders&quot;"
+		AdditionalIncludeDirectories="&quot;$(ProjectDir)\..\Platform&quot;;&quot;$(ProjectDir)\..\Platform\CoreIPC&quot;;&quot;$(ProjectDir)\..\PluginProcess&quot;;&quot;$(ProjectDir)\..\Shared&quot;;&quot;$(ProjectDir)\..\Shared\win&quot;;&quot;$(ProjectDir)\..\Shared\API\c&quot;;&quot;$(ProjectDir)\..\Shared\API\c\cf&quot;;&quot;$(ProjectDir)\..\Shared\API\c\win&quot;;&quot;$(ProjectDir)\..\Shared\CoreIPCSupport&quot;;&quot;$(ProjectDir)\..\UIProcess&quot;;&quot;$(ProjectDir)\..\UIProcess\API\C&quot;;&quot;$(ProjectDir)\..\UIProcess\API\C\win&quot;;&quot;$(ProjectDir)\..\UIProcess\API\cpp&quot;;&quot;$(ProjectDir)\..\UIProcess\API\win&quot;;&quot;$(ProjectDir)\..\UIProcess\Authentication&quot;;&quot;$(ProjectDir)\..\UIProcess\Downloads&quot;;&quot;$(ProjectDir)\..\UIProcess\Launcher&quot;;&quot;$(ProjectDir)\..\UIProcess\Plugins&quot;;&quot;$(ProjectDir)\..\UIProcess\win&quot;;&quot;$(ProjectDir)\..\WebProcess&quot;;&quot;$(ProjectDir)\..\WebProcess\WebCoreSupport&quot;;&quot;$(ProjectDir)\..\WebProcess\WebCoreSupport\win&quot;;&quot;$(ProjectDir)\..\WebProcess\WebPage&quot;;&quot;$(ProjectDir)\..\WebProcess\WebPage\win&quot;;&quot;$(ProjectDir)\..\WebProcess\InjectedBundle&quot;;&quot;$(ProjectDir)\..\WebProcess\InjectedBundle\API\c&quot;;&quot;$(ProjectDir)\..\WebProcess\InjectedBundle\DOM&quot;;&quot;$(ProjectDir)\..\WebProcess\InjectedBundle\win&quot;;&quot;$(ProjectDir)\..\WebProcess\Plugins&quot;;&quot;$(ProjectDir)\..\WebProcess\Plugins\Netscape&quot;;&quot;$(ProjectDir)\..\WebProcess\win&quot;;&quot;$(ProjectDir)\..\WebProcess\Authentication&quot;;&quot;$(ProjectDir)\..\WebProcess\Downloads&quot;;&quot;$(ProjectDir)\..\WebProcess\Downloads\cf&quot;;&quot;$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources&quot;;&quot;$(WebKitOutputDir)\Include&quot;;&quot;$(WebKitOutputDir)\Include\private&quot;;&quot;$(WebKitLibrariesDir)\Include&quot;;&quot;$(WebKitLibrariesDir)\Include\private&quot;;&quot;$(WebKitLibrariesDir)\Include\pthreads&quot;;&quot;$(WebKitOutputDir)\Include\JavaScriptCore&quot;;&quot;$(WebKitOutputDir)\Include\private\JavaScriptCore&quot;;&quot;$(WebKitLibrariesDir)\Include\JavaScriptCore&quot;;&quot;$(WebKitLibrariesDir)\Include\private\JavaScriptCore&quot;;&quot;$(WebKitOutputDir)\Include\WebCore\ForwardingHeaders&quot;;&quot;$(WebKitLibrariesDir)\Include\WebCore\ForwardingHeaders&quot;"
 		PreprocessorDefinitions="_USRDLL;WEBKIT_EXPORTS;FRAMEWORK_NAME=WebKit;BUILDING_WEBKIT"
 		UsePrecompiledHeader="2"
 		PrecompiledHeaderThrough="WebKit2Prefix.h"
diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog
index 8eb2c23..df70476 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -1,3 +1,17 @@
+2010-12-03  Brady Eidson  <beidson at apple.com>
+
+        Reviewed by Anders Carlsson.
+
+        Groundwork for <rdar://problem/7660733> and https://bugs.webkit.org/show_bug.cgi?id=50191
+        WebKit2 Authentication Support
+
+        Keep these builds working:
+        * MiniBrowser/mac/BrowserWindowController.m:
+        (-[BrowserWindowController awakeFromNib]):
+
+        * WebKitTestRunner/TestController.cpp:
+        (WTR::TestController::initialize):
+
 2010-12-02  Mihai Parparita  <mihaip at chromium.org>
 
         Reviewed by Tony Chang.
diff --git a/WebKitTools/MiniBrowser/mac/BrowserWindowController.m b/WebKitTools/MiniBrowser/mac/BrowserWindowController.m
index ff6246e..e3238af 100644
--- a/WebKitTools/MiniBrowser/mac/BrowserWindowController.m
+++ b/WebKitTools/MiniBrowser/mac/BrowserWindowController.m
@@ -554,6 +554,8 @@ static bool runBeforeUnloadConfirmPanel(WKPageRef page, WKStringRef message, WKF
         didRemoveFrameFromHierarchy,
         didDisplayInsecureContentForFrame,
         didRunInsecureContentForFrame,
+        0, // canAuthenticateAgainstProtectionSpaceInFrame
+        0, // didReceiveAuthenticationChallengeInFrame
         didStartProgress,
         didChangeProgress,
         didFinishProgress,
diff --git a/WebKitTools/WebKitTestRunner/TestController.cpp b/WebKitTools/WebKitTestRunner/TestController.cpp
index 0c49346..aa2d47c 100644
--- a/WebKitTools/WebKitTestRunner/TestController.cpp
+++ b/WebKitTools/WebKitTestRunner/TestController.cpp
@@ -257,6 +257,8 @@ void TestController::initialize(int argc, const char* argv[])
         0, // didRemoveFrameFromHierarchy
         0, // didDisplayInsecureContentForFrame
         0, // didRunInsecureContentForFrame
+        0, // canAuthenticateAgainstProtectionSpaceInFrame
+        0, // didReceiveAuthenticationChallengeInFrame
         0, // didStartProgress
         0, // didChangeProgress
         0, // didFinishProgress

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list