[Webkit-unassigned] [Bug 38271] Add canAuthenticateAgainstProtectionSpace() to frame loader so that a protection space can be inspected before attempting to authenticate against it
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Wed Apr 28 13:39:46 PDT 2010
https://bugs.webkit.org/show_bug.cgi?id=38271
David Kilzer (ddkilzer) <ddkilzer at webkit.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Attachment #54610|review? |review+
Flag| |
--- Comment #5 from David Kilzer (ddkilzer) <ddkilzer at webkit.org> 2010-04-28 13:39:46 PST ---
(From update of attachment 54610)
> Index: JavaScriptCore/wtf/Platform.h
> ===================================================================
> --- JavaScriptCore/wtf/Platform.h (revision 58413)
> +++ JavaScriptCore/wtf/Platform.h (working copy)
> @@ -1079,6 +1079,10 @@ on MinGW. See https://bugs.webkit.org/sh
> #endif
> #endif
>
> +#if ((PLATFORM(MAC) || PLATFORM(IPHONE)) && !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD))
> +#define WTF_USE_PROTECTION_SPACE_AUTH_CALLBACK 1
> +#endif
This should be:
#if (PLATFORM(MAC) && !defined(BUILDING_ON_TIGER) &&
!defined(BUILDING_ON_LEOPARD)) || PLATFORM(IPHONE)
> Index: WebCore/loader/EmptyClients.h
> ===================================================================
> --- WebCore/loader/EmptyClients.h (revision 58413)
> +++ WebCore/loader/EmptyClients.h (working copy)
> @@ -194,6 +194,7 @@ public:
> virtual void dispatchWillSendRequest(DocumentLoader*, unsigned long, ResourceRequest&, const ResourceResponse&) { }
> virtual void dispatchDidReceiveAuthenticationChallenge(DocumentLoader*, unsigned long, const AuthenticationChallenge&) { }
> virtual void dispatchDidCancelAuthenticationChallenge(DocumentLoader*, unsigned long, const AuthenticationChallenge&) { }
> + virtual bool canAuthenticateAgainstProtectionSpace(DocumentLoader*, unsigned long, const ProtectionSpace&) { return false; }
This should have #if USE(PROTECTION_SPACE_AUTH_CALLBACK)/#endif macro guards.
> Index: WebCore/platform/network/ResourceHandle.h
> ===================================================================
> --- WebCore/platform/network/ResourceHandle.h (revision 58413)
> +++ WebCore/platform/network/ResourceHandle.h (working copy)
> @@ -131,6 +132,7 @@ public:
>
> #if PLATFORM(MAC)
> void didCancelAuthenticationChallenge(const AuthenticationChallenge&);
> + bool canAuthenticateAgainstProtectionSpace(const ProtectionSpace&);
> NSURLConnection *connection() const;
> WebCoreResourceHandleAsDelegate *delegate();
> void releaseDelegate();
This should have #if USE(PROTECTION_SPACE_AUTH_CALLBACK)/#endif macro guards.
> Index: WebCore/platform/network/ResourceHandleClient.h
> ===================================================================
> --- WebCore/platform/network/ResourceHandleClient.h (revision 58413)
> +++ WebCore/platform/network/ResourceHandleClient.h (working copy)
> @@ -78,6 +79,7 @@ namespace WebCore {
> virtual bool shouldUseCredentialStorage(ResourceHandle*) { return false; }
> virtual void didReceiveAuthenticationChallenge(ResourceHandle*, const AuthenticationChallenge&) { }
> virtual void didCancelAuthenticationChallenge(ResourceHandle*, const AuthenticationChallenge&) { }
> + virtual bool canAuthenticateAgainstProtectionSpace(ResourceHandle*, const ProtectionSpace&) { return false; }
> virtual void receivedCancellation(ResourceHandle*, const AuthenticationChallenge&) { }
This should have #if USE(PROTECTION_SPACE_AUTH_CALLBACK)/#endif macro guards.
> Index: WebCore/platform/network/mac/AuthenticationMac.mm
> ===================================================================
> --- WebCore/platform/network/mac/AuthenticationMac.mm (revision 58413)
> +++ WebCore/platform/network/mac/AuthenticationMac.mm (working copy)
> @@ -194,6 +194,14 @@ NSURLProtectionSpace *mac(const Protecti
> case ProtectionSpaceAuthenticationSchemeHTMLForm:
> method = NSURLAuthenticationMethodHTMLForm;
> break;
> +#if USE(PROTECTION_SPACE_AUTH_CALLBACK)
> + case ProtectionSpaceAuthenticationSchemeServerTrustEvaluationRequested:
> + method = NSURLAuthenticationMethodServerTrust;
> + break;
> + case ProtectionSpaceAuthenticationSchemeClientCertificateRequested:
> + method = NSURLAuthenticationMethodClientCertificate;
> + break;
> +#endif
> case ProtectionSpaceAuthenticationSchemeNTLM:
> method = NSURLAuthenticationMethodNTLM;
> break;
These case statements should be after ProtectionSpaceAuthenticationSchemeNTLM
to keep the order in the enum definitions.
> @@ -293,6 +301,12 @@ ProtectionSpace core(NSURLProtectionSpac
> scheme = ProtectionSpaceAuthenticationSchemeHTTPDigest;
> else if ([method isEqualToString:NSURLAuthenticationMethodHTMLForm])
> scheme = ProtectionSpaceAuthenticationSchemeHTMLForm;
> +#if USE(PROTECTION_SPACE_AUTH_CALLBACK)
> + else if ([method isEqualToString:NSURLAuthenticationMethodClientCertificate])
> + scheme = ProtectionSpaceAuthenticationSchemeClientCertificateRequested;
> + else if ([method isEqualToString:NSURLAuthenticationMethodServerTrust])
> + scheme = ProtectionSpaceAuthenticationSchemeServerTrustEvaluationRequested;
> +#endif
> else if ([method isEqualToString:NSURLAuthenticationMethodNTLM])
> scheme = ProtectionSpaceAuthenticationSchemeNTLM;
> else {
Ditto.
> Index: WebKit/mac/WebView/WebDelegateImplementationCaching.h
> ===================================================================
> --- WebKit/mac/WebView/WebDelegateImplementationCaching.h (revision 58413)
> +++ WebKit/mac/WebView/WebDelegateImplementationCaching.h (working copy)
> @@ -35,6 +35,7 @@
> struct WebResourceDelegateImplementationCache {
> IMP didCancelAuthenticationChallengeFunc;
> IMP didReceiveAuthenticationChallengeFunc;
> + IMP canAuthenticateAgainstProtectionSpaceFunc;
> IMP identifierForRequestFunc;
> IMP willSendRequestFunc;
> IMP didReceiveResponseFunc;
This should have #if USE(PROTECTION_SPACE_AUTH_CALLBACK)/#endif macro guards.
> Index: WebKit/mac/WebView/WebResourceLoadDelegatePrivate.h
> ===================================================================
> --- WebKit/mac/WebView/WebResourceLoadDelegatePrivate.h (revision 58413)
> +++ WebKit/mac/WebView/WebResourceLoadDelegatePrivate.h (working copy)
> @@ -43,6 +43,14 @@ @interface NSObject (WebResourceLoadDele
> +/*!
> + @method webView:resource:canAuthenticateAgainstProtectionSpace:forDataSource:
> + @abstract Inspect an NSURLProtectionSpace before an authentication attempt is made
> + @param protectionSpace an NSURLProtectionSpace that will be used to generate an authentication challenge
> + @result Return YES if the resource load delegate is prepared to respond to an authentication challenge generated with protectionSpace, NO otherwise
> + */
> +- (BOOL)webView:(WebView *)sender resource:(id)identifier canAuthenticateAgainstProtectionSpace:(NSURLProtectionSpace *)protectionSpace forDataSource:(WebDataSource *)dataSource;
This needs some kind of #if/#endif protection so it can't be used on Tiger or
Leopard.
> Index: WebKit/mac/WebView/WebView.mm
> ===================================================================
> --- WebKit/mac/WebView/WebView.mm (revision 58413)
> +++ WebKit/mac/WebView/WebView.mm (working copy)
> @@ -1377,6 +1377,7 @@ - (void)_cacheResourceLoadDelegateImplem
> cache->didFinishLoadingFromDataSourceFunc = getMethod(delegate, @selector(webView:resource:didFinishLoadingFromDataSource:));
> cache->didLoadResourceFromMemoryCacheFunc = getMethod(delegate, @selector(webView:didLoadResourceFromMemoryCache:response:length:fromDataSource:));
> cache->didReceiveAuthenticationChallengeFunc = getMethod(delegate, @selector(webView:resource:didReceiveAuthenticationChallenge:fromDataSource:));
> + cache->canAuthenticateAgainstProtectionSpaceFunc = getMethod(delegate, @selector(webView:resource:canAuthenticateAgainstProtectionSpace:forDataSource:));
> cache->didReceiveContentLengthFunc = getMethod(delegate, @selector(webView:resource:didReceiveContentLength:fromDataSource:));
> cache->didReceiveResponseFunc = getMethod(delegate, @selector(webView:resource:didReceiveResponse:fromDataSource:));
> cache->identifierForRequestFunc = getMethod(delegate, @selector(webView:identifierForInitialRequest:fromDataSource:));
This should have #if USE(PROTECTION_SPACE_AUTH_CALLBACK)/#endif macro guards.
r=me with the fixes above.
--
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
More information about the webkit-unassigned
mailing list