⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 160227 in webkit


Ignore:
Timestamp:
Dec 6, 2013, 10:21:05 AM (13 years ago)
Author:
mitz@apple.com
Message:

[Cocoa] Add load delegate methods for responding to authentication challenges
https://bugs.webkit.org/show_bug.cgi?id=125333

Reviewed by Darin Adler.

Source/WebCore:

  • WebCore.exp.in: Exported core(NSURLCredential *).

Source/WebKit2:

  • Shared/Cocoa/APIObject.mm:

(API::Object::newObject): Allocate a WKNSURLAuthenticationChallenge if the object is an
AuthenticationChallengeProxy.

  • UIProcess/API/Cocoa/WKBrowsingContextController.mm:

(canAuthenticateAgainstProtectionSpaceInFrame): Implemented this WKPageLoaderClient callback
by calling the load delegate.
(didReceiveAuthenticationChallengeInFrame): Ditto.
(setUpPageLoaderClient): Set the above callbacks in the client structure.

  • UIProcess/API/Cocoa/WKBrowsingContextLoadDelegatePrivate.h: Added. Declares two new

delegate methods.

  • UIProcess/API/Cocoa/WKNSURLAuthenticationChallenge.h: Added.

(WebKit::wrapper): Added. Returns an AuthenticationChallengeProxy’s wrapper as an
NSURLAuthenticationChallenge.

  • UIProcess/API/Cocoa/WKNSURLAuthenticationChallenge.mm: Added.

(-[WKNSURLAuthenticationChallenge _web_createTarget]): Override this WKObject method to
return a copy of the challenge with the sender set to a shared instance of
WKNSURLAuthenticationChallengeSender.
(-[WKNSURLAuthenticationChallenge _web_authenticationChallengeProxy]): Added. Returns the
wrapped object.
(-[WKNSURLAuthenticationChallengeSender cancelAuthenticationChallenge:]): Added. Calls
AuthenticationDecisionListener::cancel.
(-[WKNSURLAuthenticationChallengeSender continueWithoutCredentialForAuthenticationChallenge:]):
Added. Calls AuthenticationDecisionListener::useCredential, passing nullptr.
(-[WKNSURLAuthenticationChallengeSender useCredential:forAuthenticationChallenge:]): Added.
Calls AuthenticationDecisionListener::useCredential, passing the credential.

  • WebKit2.xcodeproj/project.pbxproj: Added references to new files.
Location:
trunk/Source
Files:
3 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r160226 r160227  
     12013-12-06  Dan Bernstein  <mitz@apple.com>
     2
     3        [Cocoa] Add load delegate methods for responding to authentication challenges
     4        https://bugs.webkit.org/show_bug.cgi?id=125333
     5
     6        Reviewed by Darin Adler.
     7
     8        * WebCore.exp.in: Exported core(NSURLCredential *).
     9
    1102013-12-06  Daniel Bates  <dabates@apple.com>
    211
  • trunk/Source/WebCore/WebCore.exp.in

    r160152 r160227  
    986986__ZN7WebCore4PathC1Ev
    987987__ZN7WebCore4PathD1Ev
     988__ZN7WebCore4coreEP15NSURLCredential
    988989__ZN7WebCore4coreEP20NSURLProtectionSpace
    989990__ZN7WebCore4coreEP28NSURLAuthenticationChallenge
  • trunk/Source/WebKit2/ChangeLog

    r160212 r160227  
     12013-12-06  Dan Bernstein  <mitz@apple.com>
     2
     3        [Cocoa] Add load delegate methods for responding to authentication challenges
     4        https://bugs.webkit.org/show_bug.cgi?id=125333
     5
     6        Reviewed by Darin Adler.
     7
     8        * Shared/Cocoa/APIObject.mm:
     9        (API::Object::newObject): Allocate a WKNSURLAuthenticationChallenge if the object is an
     10        AuthenticationChallengeProxy.
     11
     12        * UIProcess/API/Cocoa/WKBrowsingContextController.mm:
     13        (canAuthenticateAgainstProtectionSpaceInFrame): Implemented this WKPageLoaderClient callback
     14        by calling the load delegate.
     15        (didReceiveAuthenticationChallengeInFrame): Ditto.
     16        (setUpPageLoaderClient): Set the above callbacks in the client structure.
     17
     18        * UIProcess/API/Cocoa/WKBrowsingContextLoadDelegatePrivate.h: Added. Declares two new
     19        delegate methods.
     20
     21        * UIProcess/API/Cocoa/WKNSURLAuthenticationChallenge.h: Added.
     22        (WebKit::wrapper): Added. Returns an AuthenticationChallengeProxy’s wrapper as an
     23        NSURLAuthenticationChallenge.
     24        * UIProcess/API/Cocoa/WKNSURLAuthenticationChallenge.mm: Added.
     25        (-[WKNSURLAuthenticationChallenge _web_createTarget]): Override this WKObject method to
     26        return a copy of the challenge with the sender set to a shared instance of
     27        WKNSURLAuthenticationChallengeSender.
     28        (-[WKNSURLAuthenticationChallenge _web_authenticationChallengeProxy]): Added. Returns the
     29        wrapped object.
     30        (-[WKNSURLAuthenticationChallengeSender cancelAuthenticationChallenge:]): Added. Calls
     31        AuthenticationDecisionListener::cancel.
     32        (-[WKNSURLAuthenticationChallengeSender continueWithoutCredentialForAuthenticationChallenge:]):
     33        Added. Calls AuthenticationDecisionListener::useCredential, passing nullptr.
     34        (-[WKNSURLAuthenticationChallengeSender useCredential:forAuthenticationChallenge:]): Added.
     35        Calls AuthenticationDecisionListener::useCredential, passing the credential.
     36
     37        * WebKit2.xcodeproj/project.pbxproj: Added references to new files.
     38
    1392013-12-05  Gyuyoung Kim  <gyuyoung.kim@samsung.com>
    240
  • trunk/Source/WebKit2/Shared/Cocoa/APIObject.mm

    r159991 r160227  
    3838#import "WKNSString.h"
    3939#import "WKNSURL.h"
     40#import "WKNSURLAuthenticationChallenge.h"
    4041#import "WKNSURLProtectionSpace.h"
    4142#import "WKNavigationDataInternal.h"
     
    6566    case Type::Array:
    6667        wrapper = [WKNSArray alloc];
     68        break;
     69
     70    case Type::AuthenticationChallenge:
     71        wrapper = NSAllocateObject([WKNSURLAuthenticationChallenge self], size, nullptr);
    6772        break;
    6873
  • trunk/Source/WebKit2/UIProcess/API/Cocoa/WKBrowsingContextController.mm

    r160191 r160227  
    3838#import "WKNSArray.h"
    3939#import "WKNSError.h"
     40#import "WKNSURLAuthenticationChallenge.h"
    4041#import "WKNSURLExtras.h"
     42#import "WKNSURLProtectionSpace.h"
    4143#import "WKRetainPtr.h"
    4244#import "WKURLRequestNS.h"
     
    4850#import "WKBrowsingContextGroupInternal.h"
    4951#import "WKBrowsingContextHandleInternal.h"
    50 #import "WKBrowsingContextLoadDelegate.h"
     52#import "WKBrowsingContextLoadDelegatePrivate.h"
    5153#import "WKBrowsingContextPolicyDelegate.h"
    5254#import "WKProcessGroupInternal.h"
     
    440442}
    441443
     444static bool canAuthenticateAgainstProtectionSpaceInFrame(WKPageRef page, WKFrameRef frame, WKProtectionSpaceRef protectionSpace, const void *clientInfo)
     445{
     446    WKBrowsingContextController *browsingContext = (WKBrowsingContextController *)clientInfo;
     447    auto loadDelegate = browsingContext->_loadDelegate.get();
     448
     449    if ([loadDelegate respondsToSelector:@selector(browsingContextController:canAuthenticateAgainstProtectionSpace:)])
     450        return [(id <WKBrowsingContextLoadDelegatePrivate>)loadDelegate browsingContextController:browsingContext canAuthenticateAgainstProtectionSpace:wrapper(*toImpl(protectionSpace))];
     451
     452    return false;
     453}
     454
     455static void didReceiveAuthenticationChallengeInFrame(WKPageRef page, WKFrameRef frame, WKAuthenticationChallengeRef authenticationChallenge, const void *clientInfo)
     456{
     457    WKBrowsingContextController *browsingContext = (WKBrowsingContextController *)clientInfo;
     458    auto loadDelegate = browsingContext->_loadDelegate.get();
     459
     460    if ([loadDelegate respondsToSelector:@selector(browsingContextController:didReceiveAuthenticationChallenge:)])
     461        [(id <WKBrowsingContextLoadDelegatePrivate>)loadDelegate browsingContextController:browsingContext didReceiveAuthenticationChallenge:wrapper(*toImpl(authenticationChallenge))];
     462}
     463
    442464static void didStartProgress(WKPageRef page, const void* clientInfo)
    443465{
     
    493515    loaderClient.didFinishLoadForFrame = didFinishLoadForFrame;
    494516    loaderClient.didFailLoadWithErrorForFrame = didFailLoadWithErrorForFrame;
     517
     518    loaderClient.canAuthenticateAgainstProtectionSpaceInFrame = canAuthenticateAgainstProtectionSpaceInFrame;
     519    loaderClient.didReceiveAuthenticationChallengeInFrame = didReceiveAuthenticationChallengeInFrame;
    495520
    496521    loaderClient.didStartProgress = didStartProgress;
  • trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj

    r160146 r160227  
    476476                37F623B812A57B6200E3FDF6 /* WKFindOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 37F623B712A57B6200E3FDF6 /* WKFindOptions.h */; settings = {ATTRIBUTES = (Private, ); }; };
    477477                37F90DE31376560E0051CF68 /* HTTPCookieAcceptPolicy.h in Headers */ = {isa = PBXBuildFile; fileRef = F638954F133BEF38008941D5 /* HTTPCookieAcceptPolicy.h */; };
     478                37FC19471850FBF2008CFA47 /* WKBrowsingContextLoadDelegatePrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 37FC19461850FBF2008CFA47 /* WKBrowsingContextLoadDelegatePrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
     479                37FC194A18510D6A008CFA47 /* WKNSURLAuthenticationChallenge.mm in Sources */ = {isa = PBXBuildFile; fileRef = 37FC194818510D6A008CFA47 /* WKNSURLAuthenticationChallenge.mm */; };
     480                37FC194B18510D6A008CFA47 /* WKNSURLAuthenticationChallenge.h in Headers */ = {isa = PBXBuildFile; fileRef = 37FC194918510D6A008CFA47 /* WKNSURLAuthenticationChallenge.h */; };
    478481                3F87B9BD158940120090FF62 /* WebColorChooser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3F87B9BA15893F630090FF62 /* WebColorChooser.cpp */; };
    479482                3F87B9BE158940190090FF62 /* WebColorChooser.h in Headers */ = {isa = PBXBuildFile; fileRef = 3F87B9BB15893F630090FF62 /* WebColorChooser.h */; };
     
    20182021                37DFA6FF1810BB92001F4A9F /* WKFoundation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKFoundation.h; sourceTree = "<group>"; };
    20192022                37F623B712A57B6200E3FDF6 /* WKFindOptions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKFindOptions.h; sourceTree = "<group>"; };
     2023                37FC19461850FBF2008CFA47 /* WKBrowsingContextLoadDelegatePrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKBrowsingContextLoadDelegatePrivate.h; sourceTree = "<group>"; };
     2024                37FC194818510D6A008CFA47 /* WKNSURLAuthenticationChallenge.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKNSURLAuthenticationChallenge.mm; sourceTree = "<group>"; };
     2025                37FC194918510D6A008CFA47 /* WKNSURLAuthenticationChallenge.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKNSURLAuthenticationChallenge.h; sourceTree = "<group>"; };
    20202026                3F87B9BA15893F630090FF62 /* WebColorChooser.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebColorChooser.cpp; sourceTree = "<group>"; };
    20212027                3F87B9BB15893F630090FF62 /* WebColorChooser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebColorChooser.h; sourceTree = "<group>"; };
     
    37943800                                370F34A61829CFF3009027C8 /* WKBrowsingContextHistoryDelegate.h */,
    37953801                                BCBAAD0A14560A430053F82F /* WKBrowsingContextLoadDelegate.h */,
     3802                                37FC19461850FBF2008CFA47 /* WKBrowsingContextLoadDelegatePrivate.h */,
    37963803                                7CA254EA182993CE00FC8A41 /* WKBrowsingContextPolicyDelegate.h */,
    37973804                                BCA284D51492F2C7001F9042 /* WKConnection.h */,
     
    38033810                                370F34A01829BE1E009027C8 /* WKNavigationData.mm */,
    38043811                                370F34A41829BEA3009027C8 /* WKNavigationDataInternal.h */,
     3812                                37FC194918510D6A008CFA47 /* WKNSURLAuthenticationChallenge.h */,
     3813                                37FC194818510D6A008CFA47 /* WKNSURLAuthenticationChallenge.mm */,
    38053814                                BCBAACE5145225C90053F82F /* WKProcessGroup.h */,
    38063815                                BCBAACE6145225CA0053F82F /* WKProcessGroup.mm */,
     
    58445853                                518D2CAE12D5153B003BB93B /* WebBackForwardListItem.h in Headers */,
    58455854                                BC72B9FB11E6476B001EB4EA /* WebBackForwardListProxy.h in Headers */,
     5855                                37FC194B18510D6A008CFA47 /* WKNSURLAuthenticationChallenge.h in Headers */,
    58465856                                BCF50728124329AA005955AE /* WebCertificateInfo.h in Headers */,
    58475857                                BC032D7510F4378D0058C15A /* WebChromeClient.h in Headers */,
     
    61036113                                BC06F44E12DBDF3F002D78DE /* WKGeolocationPermissionRequest.h in Headers */,
    61046114                                BC0E619812D6CD120012A72A /* WKGeolocationPosition.h in Headers */,
     6115                                37FC19471850FBF2008CFA47 /* WKBrowsingContextLoadDelegatePrivate.h in Headers */,
    61056116                                BCC8B374125FB69000DE46A4 /* WKGeometry.h in Headers */,
    61066117                                B62E7312143047B00069EC35 /* WKHitTestResult.h in Headers */,
     
    70487059                                E14A954916E016A40068DE82 /* NetworkProcessPlatformStrategies.cpp in Sources */,
    70497060                                5179556D162877B100FA43B6 /* NetworkProcessProxy.cpp in Sources */,
     7061                                37FC194A18510D6A008CFA47 /* WKNSURLAuthenticationChallenge.mm in Sources */,
    70507062                                516319921628980A00E22F00 /* NetworkProcessProxyMac.mm in Sources */,
    70517063                                513A163C163088F6005D7D22 /* NetworkProcessProxyMessageReceiver.cpp in Sources */,
Note: See TracChangeset for help on using the changeset viewer.