Commit 7c5455c6 authored by psolanki@apple.com's avatar psolanki@apple.com

2011-05-12 Pratik Solanki <psolanki@apple.com>

        Reviewed by Antti Koivisto.

        Part of WebCore should use CFNetwork-based loader on Mac
        https://bugs.webkit.org/show_bug.cgi?id=51836

        Implement mac specific Authentication functions when using CFNetwork.

        * WebCore.exp.in:
        * WebCore.xcodeproj/project.pbxproj:
        * platform/network/ResourceHandle.h:
        * platform/network/cf/AuthenticationCF.cpp:
        (WebCore::AuthenticationChallenge::authenticationClient):
        (WebCore::createCF):
        (WebCore::core):
        * platform/network/cf/AuthenticationCF.h:
        * platform/network/cf/AuthenticationChallenge.h:
        * platform/network/mac/AuthenticationMac.mm:
        (WebCore::core):
        (WebCore::mac):
        * platform/network/mac/CredentialStorageMac.mm:
2011-05-12  Pratik Solanki  <psolanki@apple.com>

        Reviewed by Antti Koivisto.

        Part of WebCore should use CFNetwork-based loader on Mac
        https://bugs.webkit.org/show_bug.cgi?id=51836

        Include AuthenticationCF.h header file.

        * Misc/WebDownload.mm:
        * Plugins/WebBaseNetscapePluginView.mm:
        * WebCoreSupport/WebFrameLoaderClient.mm:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@86414 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent c37dc208
2011-05-12 Pratik Solanki <psolanki@apple.com>
Reviewed by Antti Koivisto.
Part of WebCore should use CFNetwork-based loader on Mac
https://bugs.webkit.org/show_bug.cgi?id=51836
Implement mac specific Authentication functions when using CFNetwork.
* WebCore.exp.in:
* WebCore.xcodeproj/project.pbxproj:
* platform/network/ResourceHandle.h:
* platform/network/cf/AuthenticationCF.cpp:
(WebCore::AuthenticationChallenge::authenticationClient):
(WebCore::createCF):
(WebCore::core):
* platform/network/cf/AuthenticationCF.h:
* platform/network/cf/AuthenticationChallenge.h:
* platform/network/mac/AuthenticationMac.mm:
(WebCore::core):
(WebCore::mac):
* platform/network/mac/CredentialStorageMac.mm:
2011-05-12 Ben Wells <benwells@chromium.org>
Reviewed by Simon Fraser.
......@@ -1652,6 +1652,10 @@ __ZN7WebCore3macERKNS_15ProtectionSpaceE
__ZNK7WebCore15ProtectionSpace20authenticationSchemeEv
#endif
#if USE(PROTECTION_SPACE_AUTH_CALLBACK) && USE(CFNETWORK)
__ZN7WebCore8createCFERKNS_15ProtectionSpaceE
#endif
#if ENABLE(SVG_ANIMATION) && ENABLE(SVG_DOM_OBJC_BINDINGS)
.objc_class_name_DOMSVGAnimateElement
.objc_class_name_DOMSVGAnimateTransformElement
......
......@@ -1642,7 +1642,7 @@
7E33CD01127F340D00BE8F17 /* PurgePriority.h in Headers */ = {isa = PBXBuildFile; fileRef = 7E33CD00127F340D00BE8F17 /* PurgePriority.h */; settings = {ATTRIBUTES = (Private, ); }; };
7E37EF2E1339208800B29250 /* SubresourceLoaderCF.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7E37EF2D1339208800B29250 /* SubresourceLoaderCF.cpp */; };
7EE6845F12D26E3800E79415 /* AuthenticationCF.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7EE6844C12D26E3800E79415 /* AuthenticationCF.cpp */; };
7EE6846012D26E3800E79415 /* AuthenticationCF.h in Headers */ = {isa = PBXBuildFile; fileRef = 7EE6844D12D26E3800E79415 /* AuthenticationCF.h */; };
7EE6846012D26E3800E79415 /* AuthenticationCF.h in Headers */ = {isa = PBXBuildFile; fileRef = 7EE6844D12D26E3800E79415 /* AuthenticationCF.h */; settings = {ATTRIBUTES = (Private, ); }; };
7EE6846112D26E3800E79415 /* AuthenticationChallenge.h in Headers */ = {isa = PBXBuildFile; fileRef = 7EE6844E12D26E3800E79415 /* AuthenticationChallenge.h */; settings = {ATTRIBUTES = (Private, ); }; };
7EE6846212D26E3800E79415 /* CookieJarCFNet.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7EE6844F12D26E3800E79415 /* CookieJarCFNet.cpp */; };
7EE6846312D26E3800E79415 /* CookieStorageCFNet.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7EE6845012D26E3800E79415 /* CookieStorageCFNet.cpp */; };
......@@ -122,7 +122,7 @@ public:
virtual void receivedCancellation(const AuthenticationChallenge&);
#endif
#if PLATFORM(MAC)
#if PLATFORM(MAC) && !USE(CFNETWORK)
void didCancelAuthenticationChallenge(const AuthenticationChallenge&);
#if USE(PROTECTION_SPACE_AUTH_CALLBACK)
bool canAuthenticateAgainstProtectionSpace(const ProtectionSpace&);
......@@ -131,10 +131,13 @@ public:
WebCoreResourceHandleAsDelegate *delegate();
void releaseDelegate();
id releaseProxy();
#endif
#if PLATFORM(MAC)
void schedule(SchedulePair*);
void unschedule(SchedulePair*);
#elif USE(CFNETWORK)
#endif
#if USE(CFNETWORK)
CFURLConnectionRef connection() const;
CFURLConnectionRef releaseConnectionForDownload();
static void setHostAllowsAnyHTTPSCertificate(const String&);
......
......@@ -68,6 +68,11 @@ AuthenticationChallenge::AuthenticationChallenge(CFURLAuthChallengeRef cfChallen
{
}
AuthenticationClient* AuthenticationChallenge::authenticationClient() const
{
return m_authenticationClient.get();
}
bool AuthenticationChallenge::platformCompare(const AuthenticationChallenge& a, const AuthenticationChallenge& b)
{
if (a.authenticationClient() != b.authenticationClient())
......@@ -170,6 +175,14 @@ CFURLProtectionSpaceRef createCF(const ProtectionSpace& coreSpace)
case ProtectionSpaceAuthenticationSchemeNegotiate:
scheme = kCFURLProtectionSpaceAuthenticationSchemeNegotiate;
break;
#if USE(PROTECTION_SPACE_AUTH_CALLBACK)
case ProtectionSpaceAuthenticationSchemeServerTrustEvaluationRequested:
scheme = kCFURLProtectionSpaceAuthenticationSchemeServerTrustEvaluationRequested;
break;
case ProtectionSpaceAuthenticationSchemeClientCertificateRequested:
scheme = kCFURLProtectionSpaceAuthenticationSchemeClientCertificateRequested;
break;
#endif
default:
ASSERT_NOT_REACHED();
}
......@@ -258,6 +271,14 @@ ProtectionSpace core(CFURLProtectionSpaceRef cfSpace)
case kCFURLProtectionSpaceAuthenticationSchemeNegotiate:
scheme = ProtectionSpaceAuthenticationSchemeNegotiate;
break;
#if USE(PROTECTION_SPACE_AUTH_CALLBACK)
case kCFURLProtectionSpaceAuthenticationSchemeClientCertificateRequested:
scheme = ProtectionSpaceAuthenticationSchemeClientCertificateRequested;
break;
case kCFURLProtectionSpaceAuthenticationSchemeServerTrustEvaluationRequested:
scheme = ProtectionSpaceAuthenticationSchemeServerTrustEvaluationRequested;
break;
#endif
default:
scheme = ProtectionSpaceAuthenticationSchemeUnknown;
ASSERT_NOT_REACHED();
......
......@@ -28,6 +28,16 @@
#if USE(CFNETWORK)
#ifdef __OBJC__
@class NSURLAuthenticationChallenge;
@class NSURLCredential;
@class NSURLProtectionSpace;
#else
class NSURLAuthenticationChallenge;
class NSURLCredential;
class NSURLProtectionSpace;
#endif
#include <CFNetwork/CFURLCredentialPriv.h>
typedef struct _CFURLAuthChallenge* CFURLAuthChallengeRef;
......@@ -43,9 +53,22 @@ CFURLAuthChallengeRef createCF(const AuthenticationChallenge&);
CFURLCredentialRef createCF(const Credential&);
CFURLProtectionSpaceRef createCF(const ProtectionSpace&);
#if PLATFORM(MAC)
AuthenticationChallenge core(CFURLAuthChallengeRef);
#endif
Credential core(CFURLCredentialRef);
ProtectionSpace core(CFURLProtectionSpaceRef);
#if PLATFORM(MAC)
AuthenticationChallenge core(NSURLAuthenticationChallenge *);
Credential core(NSURLCredential *);
ProtectionSpace core(NSURLProtectionSpace*);
NSURLAuthenticationChallenge *mac(const AuthenticationChallenge&);
NSURLCredential *mac(const Credential&);
NSURLProtectionSpace *mac(const ProtectionSpace&);
#endif
}
#endif // USE(CFNETWORK)
......
......@@ -50,7 +50,7 @@ public:
#if USE(CFNETWORK)
AuthenticationChallenge(CFURLAuthChallengeRef, AuthenticationClient*);
AuthenticationClient* authenticationClient() const { return m_authenticationClient.get(); }
AuthenticationClient* authenticationClient() const;
void setAuthenticationClient(AuthenticationClient* client) { m_authenticationClient = client; }
CFURLAuthChallengeRef cfURLAuthChallengeRef() const { return m_cfChallenge.get(); }
......
......@@ -25,8 +25,7 @@
#import "config.h"
#import "AuthenticationMac.h"
#if !USE(CFNETWORK)
#import "AuthenticationCF.h"
#import "AuthenticationChallenge.h"
#import "AuthenticationClient.h"
#import "Credential.h"
......@@ -36,6 +35,25 @@
#import <Foundation/NSURLCredential.h>
#import <Foundation/NSURLProtectionSpace.h>
#if USE(CFNETWORK)
@interface NSURLProtectionSpace (Details)
- (CFURLProtectionSpaceRef) _cfurlprotectionspace;
- (id)_initWithCFURLProtectionSpace:(CFURLProtectionSpaceRef)cfProtSpace;
@end
@interface NSURLAuthenticationChallenge (Details)
-(CFURLAuthChallengeRef)_createCFAuthChallenge;
+(NSURLAuthenticationChallenge *)_authenticationChallengeForCFAuthChallenge:(CFURLAuthChallengeRef)cfChallenge sender:(id <NSURLAuthenticationChallengeSender>)sender;
@end
@interface NSURLCredential (Details)
- (id) _initWithCFURLCredential:(CFURLCredentialRef)credential;
- (CFURLCredentialRef) _cfurlcredential;
@end
#endif
using namespace WebCore;
@interface WebCoreAuthenticationClientAsChallengeSender : NSObject <NSURLAuthenticationChallengeSender>
......@@ -90,6 +108,47 @@ using namespace WebCore;
namespace WebCore {
#if USE(CFNETWORK)
AuthenticationChallenge core(NSURLAuthenticationChallenge *macChallenge)
{
WebCoreAuthenticationClientAsChallengeSender *challengeSender = (WebCoreAuthenticationClientAsChallengeSender*) [macChallenge sender];
AuthenticationClient* authClient = [challengeSender client];
return AuthenticationChallenge([macChallenge _createCFAuthChallenge], authClient);
}
Credential core(NSURLCredential *macCredential)
{
return core([macCredential _cfurlcredential]);
}
ProtectionSpace core(NSURLProtectionSpace *macSpace)
{
return core([macSpace _cfurlprotectionspace]);
}
NSURLProtectionSpace *mac(const ProtectionSpace& coreSpace)
{
RetainPtr<CFURLProtectionSpaceRef> protectionSpace(AdoptCF, createCF(coreSpace));
return [[[NSURLProtectionSpace alloc] _initWithCFURLProtectionSpace:protectionSpace.get()] autorelease];
}
NSURLAuthenticationChallenge *mac(const AuthenticationChallenge& coreChallenge)
{
AuthenticationClient* authClient = coreChallenge.authenticationClient();
RetainPtr<WebCoreAuthenticationClientAsChallengeSender> challengeSender(AdoptNS, [[WebCoreAuthenticationClientAsChallengeSender alloc] initWithAuthenticationClient:authClient]);
RetainPtr<CFURLAuthChallengeRef> authChallenge(AdoptCF, createCF(coreChallenge));
return [[NSURLAuthenticationChallenge _authenticationChallengeForCFAuthChallenge:authChallenge.get() sender:challengeSender.get()] autorelease];
}
NSURLCredential *mac(const Credential& coreCredential)
{
RetainPtr<CFURLCredentialRef> credential(AdoptCF, createCF(coreCredential));
return [[[NSURLCredential alloc] _initWithCFURLCredential:credential.get()] autorelease];
}
#else
#ifdef BUILDING_ON_LEOPARD
// There is no constant in headers, but NTLM is supported.
NSString * const NSURLAuthenticationMethodNTLM = @"NSURLAuthenticationMethodNTLM";
......@@ -359,6 +418,6 @@ Credential core(NSURLCredential *macCredential)
return Credential([macCredential user], [macCredential password], persistence);
}
} // namespace WebCore
#endif // USE(CFNETWORK)
#endif // !USE(CFNETWORK)
} // namespace WebCore
......@@ -26,6 +26,8 @@
#include "config.h"
#include "CredentialStorage.h"
#if !USE(CFNETWORK)
#include "AuthenticationMac.h"
#include "Credential.h"
......@@ -38,3 +40,5 @@ Credential CredentialStorage::getFromPersistentStorage(const ProtectionSpace& pr
}
} // namespace WebCore
#endif // !USE(CFNETWORK)
2011-05-12 Pratik Solanki <psolanki@apple.com>
Reviewed by Antti Koivisto.
Part of WebCore should use CFNetwork-based loader on Mac
https://bugs.webkit.org/show_bug.cgi?id=51836
Include AuthenticationCF.h header file.
* Misc/WebDownload.mm:
* Plugins/WebBaseNetscapePluginView.mm:
* WebCoreSupport/WebFrameLoaderClient.mm:
2011-05-12 Adele Peterson <adele@apple.com>
Reviewed by Darin Adler and Adam Barth.
......
......@@ -30,6 +30,7 @@
#import <Foundation/NSURLAuthenticationChallenge.h>
#import <Foundation/NSURLDownload.h>
#import <WebCore/AuthenticationCF.h>
#import <WebCore/AuthenticationMac.h>
#import <WebCore/Credential.h>
#import <WebCore/CredentialStorage.h>
......
......@@ -41,6 +41,7 @@
#import "WebView.h"
#import "WebViewInternal.h"
#import <WebCore/AuthenticationCF.h>
#import <WebCore/AuthenticationMac.h>
#import <WebCore/BitmapImage.h>
#import <WebCore/Credential.h>
......
......@@ -74,6 +74,7 @@
#import "WebUIDelegate.h"
#import "WebUIDelegatePrivate.h"
#import "WebViewInternal.h"
#import <WebCore/AuthenticationCF.h>
#import <WebCore/AuthenticationMac.h>
#import <WebCore/BackForwardController.h>
#import <WebCore/BlockExceptions.h>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment