Title: [135201] trunk/Source/WebKit2
Revision
135201
Author
beid...@apple.com
Date
2012-11-19 14:57:23 -0800 (Mon, 19 Nov 2012)

Log Message

Move tryUsePlatformCertificateInfoForChallenge from AuthenticationManager to PlatformCertificateInfo.
https://bugs.webkit.org/show_bug.cgi?id=102718

Reviewed by Sam Weinig.

Add the shared PlatformCertificateInfo version of the method:
* Shared/mac/PlatformCertificateInfo.h:
* Shared/mac/PlatformCertificateInfo.mm:
(WebKit::tryUsePlatformCertificateInfoForChallenge):

Use the new shared version:
* WebProcess/Authentication/AuthenticationManager.cpp:

Remove the old member version:
* WebProcess/Authentication/AuthenticationManager.h:
* WebProcess/Authentication/mac/AuthenticationManager.mac.mm: Removed.
* WebKit2.xcodeproj/project.pbxproj:

Modified Paths

Removed Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (135200 => 135201)


--- trunk/Source/WebKit2/ChangeLog	2012-11-19 22:54:22 UTC (rev 135200)
+++ trunk/Source/WebKit2/ChangeLog	2012-11-19 22:57:23 UTC (rev 135201)
@@ -1,3 +1,23 @@
+2012-11-19  Brady Eidson  <beid...@apple.com>
+
+        Move tryUsePlatformCertificateInfoForChallenge from AuthenticationManager to PlatformCertificateInfo.
+        https://bugs.webkit.org/show_bug.cgi?id=102718
+
+        Reviewed by Sam Weinig.
+
+        Add the shared PlatformCertificateInfo version of the method:
+        * Shared/mac/PlatformCertificateInfo.h:
+        * Shared/mac/PlatformCertificateInfo.mm:
+        (WebKit::tryUsePlatformCertificateInfoForChallenge):
+
+        Use the new shared version:
+        * WebProcess/Authentication/AuthenticationManager.cpp:
+
+        Remove the old member version:
+        * WebProcess/Authentication/AuthenticationManager.h:
+        * WebProcess/Authentication/mac/AuthenticationManager.mac.mm: Removed.
+        * WebKit2.xcodeproj/project.pbxproj:
+
 2012-11-19  Huang Dongsung  <luxte...@company100.net>
 
         Coordinated Graphics: refactor syncCanvas to handle the lifecycle clearly.

Modified: trunk/Source/WebKit2/Shared/mac/PlatformCertificateInfo.h (135200 => 135201)


--- trunk/Source/WebKit2/Shared/mac/PlatformCertificateInfo.h	2012-11-19 22:54:22 UTC (rev 135200)
+++ trunk/Source/WebKit2/Shared/mac/PlatformCertificateInfo.h	2012-11-19 22:57:23 UTC (rev 135201)
@@ -34,6 +34,10 @@
     class ArgumentEncoder;
 }
 
+namespace WebCore {
+    class AuthenticationChallenge;
+}
+
 namespace WebKit {
 
 class PlatformCertificateInfo {
@@ -55,6 +59,8 @@
     RetainPtr<CFArrayRef> m_certificateChain;
 };
 
+bool tryUsePlatformCertificateInfoForChallenge(const WebCore::AuthenticationChallenge&, const PlatformCertificateInfo&);
+
 } // namespace WebKit
 
 #endif // PlatformCertificateInfo_h

Modified: trunk/Source/WebKit2/Shared/mac/PlatformCertificateInfo.mm (135200 => 135201)


--- trunk/Source/WebKit2/Shared/mac/PlatformCertificateInfo.mm	2012-11-19 22:54:22 UTC (rev 135200)
+++ trunk/Source/WebKit2/Shared/mac/PlatformCertificateInfo.mm	2012-11-19 22:57:23 UTC (rev 135201)
@@ -29,6 +29,7 @@
 #import "ArgumentCodersCF.h"
 #import "ArgumentDecoder.h"
 #import "ArgumentEncoder.h"
+#import <WebCore/AuthenticationChallenge.h>
 #import <WebKitSystemInterface.h>
 
 using namespace WebCore;
@@ -89,4 +90,32 @@
 }
 #endif
 
+bool tryUsePlatformCertificateInfoForChallenge(const AuthenticationChallenge& challenge, const PlatformCertificateInfo& certificateInfo)
+{
+    CFArrayRef chain = certificateInfo.certificateChain();
+    if (!chain)
+        return false;
+        
+    ASSERT(CFArrayGetCount(chain));
+
+    // The passed-in certificate chain includes the identity certificate at index 0, and additional certificates starting at index 1.
+    SecIdentityRef identity;
+    OSStatus result = SecIdentityCreateWithCertificate(NULL, (SecCertificateRef)CFArrayGetValueAtIndex(chain, 0), &identity);
+    if (result != errSecSuccess) {
+        LOG_ERROR("Unable to create SecIdentityRef with certificate - %i", result);
+        [challenge.sender() cancelAuthenticationChallenge:challenge.nsURLAuthenticationChallenge()];
+        return true;
+    }
+
+    CFIndex chainCount = CFArrayGetCount(chain);
+    NSArray *nsChain = chainCount > 1 ? [(NSArray *)chain subarrayWithRange:NSMakeRange(1, chainCount - 1)] : nil;
+
+    NSURLCredential *credential = [NSURLCredential credentialWithIdentity:identity
+                                                             certificates:nsChain
+                                                              persistence:NSURLCredentialPersistenceNone];
+
+    [challenge.sender() useCredential:credential forAuthenticationChallenge:challenge.nsURLAuthenticationChallenge()];
+    return true;
+}
+
 } // namespace WebKit

Modified: trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj (135200 => 135201)


--- trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj	2012-11-19 22:54:22 UTC (rev 135200)
+++ trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj	2012-11-19 22:57:23 UTC (rev 135201)
@@ -509,7 +509,6 @@
 		51B15A8513843A3900321AD8 /* EnvironmentUtilities.h in Headers */ = {isa = PBXBuildFile; fileRef = 51B15A8313843A3900321AD8 /* EnvironmentUtilities.h */; };
 		51B3005012529D0E000B5CA0 /* WebBackForwardListCF.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51B3004E12529D0E000B5CA0 /* WebBackForwardListCF.cpp */; };
 		51B3005112529D0E000B5CA0 /* WebPageProxyCF.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51B3004F12529D0E000B5CA0 /* WebPageProxyCF.cpp */; };
-		51C4032C136749D800DC972D /* AuthenticationManager.mac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 51C4032B136749D800DC972D /* AuthenticationManager.mac.mm */; };
 		51CBBA0F165219B6005BE8FD /* NetworkResourceLoadParameters.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51CBBA0D165219B6005BE8FD /* NetworkResourceLoadParameters.cpp */; };
 		51CBBA10165219B6005BE8FD /* NetworkResourceLoadParameters.h in Headers */ = {isa = PBXBuildFile; fileRef = 51CBBA0E165219B6005BE8FD /* NetworkResourceLoadParameters.h */; };
 		51D02F64132EC5B900BEAA96 /* WebIconDatabaseMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51D02F63132EC5B900BEAA96 /* WebIconDatabaseMessageReceiver.cpp */; };
@@ -1755,7 +1754,6 @@
 		51B15A8313843A3900321AD8 /* EnvironmentUtilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = EnvironmentUtilities.h; path = unix/EnvironmentUtilities.h; sourceTree = "<group>"; };
 		51B3004E12529D0E000B5CA0 /* WebBackForwardListCF.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = WebBackForwardListCF.cpp; path = cf/WebBackForwardListCF.cpp; sourceTree = "<group>"; };
 		51B3004F12529D0E000B5CA0 /* WebPageProxyCF.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = WebPageProxyCF.cpp; path = cf/WebPageProxyCF.cpp; sourceTree = "<group>"; };
-		51C4032B136749D800DC972D /* AuthenticationManager.mac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = AuthenticationManager.mac.mm; path = mac/AuthenticationManager.mac.mm; sourceTree = "<group>"; };
 		51CBBA0D165219B6005BE8FD /* NetworkResourceLoadParameters.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = NetworkResourceLoadParameters.cpp; path = Network/NetworkResourceLoadParameters.cpp; sourceTree = "<group>"; };
 		51CBBA0E165219B6005BE8FD /* NetworkResourceLoadParameters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = NetworkResourceLoadParameters.h; path = Network/NetworkResourceLoadParameters.h; sourceTree = "<group>"; };
 		51D02F63132EC5B900BEAA96 /* WebIconDatabaseMessageReceiver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebIconDatabaseMessageReceiver.cpp; sourceTree = "<group>"; };
@@ -3209,7 +3207,6 @@
 		512F588612A8834700629530 /* Authentication */ = {
 			isa = PBXGroup;
 			children = (
-				51C4032A136749C400DC972D /* mac */,
 				512F588712A8836600629530 /* AuthenticationManager.cpp */,
 				512F588812A8836600629530 /* AuthenticationManager.h */,
 				512F588912A8836600629530 /* AuthenticationManager.messages.in */,
@@ -3281,14 +3278,6 @@
 			name = cf;
 			sourceTree = "<group>";
 		};
-		51C4032A136749C400DC972D /* mac */ = {
-			isa = PBXGroup;
-			children = (
-				51C4032B136749D800DC972D /* AuthenticationManager.mac.mm */,
-			);
-			name = mac;
-			sourceTree = "<group>";
-		};
 		51FBB9C1132E079200F327B4 /* IconDatabase */ = {
 			isa = PBXGroup;
 			children = (
@@ -5461,7 +5450,6 @@
 				512F589612A8838800629530 /* AuthenticationChallengeProxy.cpp in Sources */,
 				512F589812A8838800629530 /* AuthenticationDecisionListener.cpp in Sources */,
 				512F588A12A8836600629530 /* AuthenticationManager.cpp in Sources */,
-				51C4032C136749D800DC972D /* AuthenticationManager.mac.mm in Sources */,
 				512F58A212A883AD00629530 /* AuthenticationManagerMessageReceiver.cpp in Sources */,
 				1A64256912DE42EC00CAAE2C /* BackingStore.cpp in Sources */,
 				1A64292D12DE5F9800CAAE2C /* BackingStoreMac.mm in Sources */,

Modified: trunk/Source/WebKit2/WebProcess/Authentication/AuthenticationManager.cpp (135200 => 135201)


--- trunk/Source/WebKit2/WebProcess/Authentication/AuthenticationManager.cpp	2012-11-19 22:54:22 UTC (rev 135200)
+++ trunk/Source/WebKit2/WebProcess/Authentication/AuthenticationManager.cpp	2012-11-19 22:57:23 UTC (rev 135201)
@@ -30,6 +30,7 @@
 #include "Download.h"
 #include "DownloadProxyMessages.h"
 #include "MessageID.h"
+#include "PlatformCertificateInfo.h"
 #include "WebCoreArgumentCoders.h"
 #include "WebFrame.h"
 #include "WebPage.h"

Modified: trunk/Source/WebKit2/WebProcess/Authentication/AuthenticationManager.h (135200 => 135201)


--- trunk/Source/WebKit2/WebProcess/Authentication/AuthenticationManager.h	2012-11-19 22:54:22 UTC (rev 135200)
+++ trunk/Source/WebKit2/WebProcess/Authentication/AuthenticationManager.h	2012-11-19 22:57:23 UTC (rev 135201)
@@ -65,8 +65,6 @@
     // CoreIPC::MessageReceiver
     virtual void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::MessageDecoder&) OVERRIDE;
     void didReceiveAuthenticationManagerMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::MessageDecoder&);
-
-    bool tryUsePlatformCertificateInfoForChallenge(const WebCore::AuthenticationChallenge&, const PlatformCertificateInfo&);
     
     typedef HashMap<uint64_t, WebCore::AuthenticationChallenge> AuthenticationChallengeMap;
     AuthenticationChallengeMap m_challenges;

Deleted: trunk/Source/WebKit2/WebProcess/Authentication/mac/AuthenticationManager.mac.mm (135200 => 135201)


--- trunk/Source/WebKit2/WebProcess/Authentication/mac/AuthenticationManager.mac.mm	2012-11-19 22:54:22 UTC (rev 135200)
+++ trunk/Source/WebKit2/WebProcess/Authentication/mac/AuthenticationManager.mac.mm	2012-11-19 22:57:23 UTC (rev 135201)
@@ -1,72 +0,0 @@
-/*
- * Copyright (C) 2011 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 "config.h"
-#include "AuthenticationManager.h"
-
-#if USE(SECURITY_FRAMEWORK)
-
-#include "PlatformCertificateInfo.h"
-#include <Security/SecIdentity.h>
-#include <WebCore/AuthenticationChallenge.h>
-
-using namespace WebCore;
-
-namespace WebKit {
-
-bool AuthenticationManager::tryUsePlatformCertificateInfoForChallenge(const AuthenticationChallenge& challenge, const PlatformCertificateInfo& certificateInfo)
-{
-    // FIXME (NetworkProcess): This occurs in the WebProcess and therefore won't work.
-    // We need this to happen in the NetworkProcess.
-
-    CFArrayRef chain = certificateInfo.certificateChain();
-    if (!chain)
-        return false;
-        
-    ASSERT(CFArrayGetCount(chain));
-
-    // The passed-in certificate chain includes the identity certificate at index 0, and additional certificates starting at index 1.
-    SecIdentityRef identity;
-    OSStatus result = SecIdentityCreateWithCertificate(NULL, (SecCertificateRef)CFArrayGetValueAtIndex(chain, 0), &identity);
-    if (result != errSecSuccess) {
-        LOG_ERROR("Unable to create SecIdentityRef with certificate - %i", result);
-        [challenge.sender() cancelAuthenticationChallenge:challenge.nsURLAuthenticationChallenge()];
-        return true;
-    }
-
-    CFIndex chainCount = CFArrayGetCount(chain);
-    NSArray *nsChain = chainCount > 1 ? [(NSArray *)chain subarrayWithRange:NSMakeRange(1, chainCount - 1)] : nil;
-
-    NSURLCredential *credential = [NSURLCredential credentialWithIdentity:identity
-                                                             certificates:nsChain
-                                                              persistence:NSURLCredentialPersistenceNone];
-
-    [challenge.sender() useCredential:credential forAuthenticationChallenge:challenge.nsURLAuthenticationChallenge()];
-    return true;
-}
-
-} // namespace WebKit
-
-#endif // USE(SECURITY_FRAMEWORK)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to