Changeset 169782 in webkit


Ignore:
Timestamp:
Jun 10, 2014 5:01:18 PM (10 years ago)
Author:
mitz@apple.com
Message:

Source/WebCore: WebCore part of [Cocoa] Handling authentication challenges should not require multiple delegate methods
https://bugs.webkit.org/show_bug.cgi?id=133697

Reviewed by Anders Carlsson.

  • platform/network/AuthenticationClient.h: Declared new virtual member functions for

requesting default handling of a challenge and rejecting a challenge.

  • platform/network/ResourceHandle.h: Override new AuthenticationClient functions.
  • platform/network/cf/ResourceHandleCFNet.cpp:

(WebCore::ResourceHandle::receivedRequestToPerformDefaultHandling): Added. Calls
CFURLConnectionPerformDefaultHandlingForChallenge.
(WebCore::ResourceHandle::receivedChallengeRejection): Added. Calls
CFURLConnectionRejectChallenge.

  • platform/network/cf/SocketStreamHandle.h: Override new AuthenticationClient functions.
  • platform/network/cf/SocketStreamHandleCFNet.cpp:

(WebCore::SocketStreamHandle::receivedRequestToPerformDefaultHandling): Added empty
override.
(WebCore::SocketStreamHandle::receivedChallengeRejection): Ditto.

Source/WebKit2: WebKit2 part of [Cocoa] Handling authentication challenges should not require multiple delegate methods
https://bugs.webkit.org/show_bug.cgi?id=133697

Reviewed by Anders Carlsson.

  • Shared/Authentication/AuthenticationManager.cpp:

(WebKit::AuthenticationManager::performDefaultHandling): Added. Calls the new
AuthenticationClient function receivedRequestToPerformDefaultHandling.
(WebKit::AuthenticationManager::rejectProtectionSpaceAndContinue): Added. Calls the new
AuthenticationClient function receivedChallengeRejection.

  • Shared/Authentication/AuthenticationManager.h:
  • Shared/Authentication/AuthenticationManager.messages.in: Added new messages

PerformDefaultHandling and RejectProtectionSpaceAndContinue.

  • Shared/Downloads/DownloadAuthenticationClient.h: Override new AuthenticationClient member

functions.

  • Shared/Downloads/ios/DownloadIOS.mm:

(WebKit::Download::receivedRequestToPerformDefaultHandling): Added empty implementation.
(WebKit::Download::receivedChallengeRejection): Ditto.

  • Shared/Downloads/mac/DownloadMac.mm:

(WebKit::Download::receivedRequestToPerformDefaultHandling): Added. Forwards to the sender.
(WebKit::Download::receivedChallengeRejection): Ditto.

  • UIProcess/API/Cocoa/WKNSURLAuthenticationChallenge.mm:

(checkChallenge): Factored out a bit of code into this helper function.
(-[WKNSURLAuthenticationChallengeSender cancelAuthenticationChallenge:]): Use new helper.
(-[WKNSURLAuthenticationChallengeSender continueWithoutCredentialForAuthenticationChallenge:]):
Ditto.
(-[WKNSURLAuthenticationChallengeSender useCredential:forAuthenticationChallenge:]): Ditto.
(-[WKNSURLAuthenticationChallengeSender performDefaultHandlingForAuthenticationChallenge:]):
Implemented this optional NSURLAuthenticationChallengeSender protocol method by forwarding
to the decision listener.
(-[WKNSURLAuthenticationChallengeSender rejectProtectionSpaceAndContinueWithChallenge:]):
Ditto.

  • UIProcess/API/Cocoa/WKNavigationDelegatePrivate.h: Declared new delegate method.
  • UIProcess/Authentication/AuthenticationChallengeProxy.cpp:

(WebKit::AuthenticationChallengeProxy::performDefaultHandling): Added. Sends a message to
the authentication manager.
(WebKit::AuthenticationChallengeProxy::rejectProtectionSpaceAndContinue): Ditto.

  • UIProcess/Authentication/AuthenticationChallengeProxy.h:
  • UIProcess/Authentication/AuthenticationDecisionListener.cpp:

(WebKit::AuthenticationDecisionListener::performDefaultHandling): Added. Forwards to the
authentication challenge proxy.
(WebKit::AuthenticationDecisionListener::rejectProtectionSpaceAndContinue): Ditto.

  • UIProcess/Authentication/AuthenticationDecisionListener.h:
  • UIProcess/Cocoa/NavigationState.h: Added flag in m_navigationDelegateMethods struct.
  • UIProcess/Cocoa/NavigationState.mm:

(WebKit::NavigationState::setNavigationDelegate): Initialize
webViewWillSendRequestForAuthenticationChallenge flag in the delegate methods struct.
(WebKit::NavigationState::LoaderClient::canAuthenticateAgainstProtectionSpaceInFrame): If
the delegate implements -_webView:willSendRequestForAuthenticationChallenge:, return true
here; the delegate will respond with -rejectProtectionSpaceAndContinueWithChallenge: if
it cannot authenticate.
(WebKit::NavigationState::LoaderClient::didReceiveAuthenticationChallengeInFrame): If the
delegate implements -_webView:willSendRequestForAuthenticationChallenge:, send that message.

Location:
trunk/Source
Files:
33 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r169781 r169782  
     12014-06-10  Dan Bernstein  <mitz@apple.com>
     2
     3        WebCore part of [Cocoa] Handling authentication challenges should not require multiple delegate methods
     4        https://bugs.webkit.org/show_bug.cgi?id=133697
     5
     6        Reviewed by Anders Carlsson.
     7
     8        * platform/network/AuthenticationClient.h: Declared new virtual member functions for
     9        requesting default handling of a challenge and rejecting a challenge.
     10        * platform/network/ResourceHandle.h: Override new AuthenticationClient functions.
     11        * platform/network/cf/ResourceHandleCFNet.cpp:
     12        (WebCore::ResourceHandle::receivedRequestToPerformDefaultHandling): Added. Calls
     13        CFURLConnectionPerformDefaultHandlingForChallenge.
     14        (WebCore::ResourceHandle::receivedChallengeRejection): Added. Calls
     15        CFURLConnectionRejectChallenge.
     16        * platform/network/cf/SocketStreamHandle.h: Override new AuthenticationClient functions.
     17        * platform/network/cf/SocketStreamHandleCFNet.cpp:
     18        (WebCore::SocketStreamHandle::receivedRequestToPerformDefaultHandling): Added empty
     19        override.
     20        (WebCore::SocketStreamHandle::receivedChallengeRejection): Ditto.
     21
    1222014-06-09  Brent Fulgham  <bfulgham@apple.com>
    223
  • trunk/Source/WebCore/platform/network/AuthenticationClient.h

    r50772 r169782  
    3737    virtual void receivedRequestToContinueWithoutCredential(const AuthenticationChallenge&) = 0;
    3838    virtual void receivedCancellation(const AuthenticationChallenge&) = 0;
     39    virtual void receivedRequestToPerformDefaultHandling(const AuthenticationChallenge&) = 0;
     40    virtual void receivedChallengeRejection(const AuthenticationChallenge&) = 0;
    3941
    4042    void ref() { refAuthenticationClient(); }
  • trunk/Source/WebCore/platform/network/ResourceHandle.h

    r169085 r169782  
    124124    virtual void receivedRequestToContinueWithoutCredential(const AuthenticationChallenge&) override;
    125125    virtual void receivedCancellation(const AuthenticationChallenge&) override;
     126    virtual void receivedRequestToPerformDefaultHandling(const AuthenticationChallenge&) override;
     127    virtual void receivedChallengeRejection(const AuthenticationChallenge&) override;
    126128#endif
    127129
  • trunk/Source/WebCore/platform/network/cf/ResourceHandleCFNet.cpp

    r169243 r169782  
    455455}
    456456
     457void ResourceHandle::receivedRequestToPerformDefaultHandling(const AuthenticationChallenge& challenge)
     458{
     459    LOG(Network, "CFNet - receivedRequestToPerformDefaultHandling()");
     460    ASSERT(!challenge.isNull());
     461    ASSERT(challenge.cfURLAuthChallengeRef());
     462    if (challenge != d->m_currentWebChallenge)
     463        return;
     464
     465    CFURLConnectionPerformDefaultHandlingForChallenge(d->m_connection.get(), challenge.cfURLAuthChallengeRef());
     466
     467    clearAuthentication();
     468}
     469
     470void ResourceHandle::receivedChallengeRejection(const AuthenticationChallenge& challenge)
     471{
     472    LOG(Network, "CFNet - receivedChallengeRejection()");
     473    ASSERT(!challenge.isNull());
     474    ASSERT(challenge.cfURLAuthChallengeRef());
     475    if (challenge != d->m_currentWebChallenge)
     476        return;
     477
     478    CFURLConnectionRejectChallenge(d->m_connection.get(), challenge.cfURLAuthChallengeRef());
     479
     480    clearAuthentication();
     481}
     482
    457483CFURLStorageSessionRef ResourceHandle::storageSession() const
    458484{
  • trunk/Source/WebCore/platform/network/cf/SocketStreamHandle.h

    r162774 r169782  
    8989    virtual void receivedRequestToContinueWithoutCredential(const AuthenticationChallenge&);
    9090    virtual void receivedCancellation(const AuthenticationChallenge&);
     91    virtual void receivedRequestToPerformDefaultHandling(const AuthenticationChallenge&);
     92    virtual void receivedChallengeRejection(const AuthenticationChallenge&);
    9193
    9294    virtual void refAuthenticationClient() { ref(); }
  • trunk/Source/WebCore/platform/network/cf/SocketStreamHandleCFNet.cpp

    r164358 r169782  
    664664}
    665665
     666void SocketStreamHandle::receivedRequestToPerformDefaultHandling(const AuthenticationChallenge&)
     667{
     668}
     669
     670void SocketStreamHandle::receivedChallengeRejection(const AuthenticationChallenge&)
     671{
     672}
     673
    666674unsigned short SocketStreamHandle::port() const
    667675{
  • trunk/Source/WebCore/platform/network/curl/ResourceHandleCurl.cpp

    r165996 r169782  
    283283}
    284284
     285void ResourceHandle::receivedRequestToPerformDefaultHandling(const AuthenticationChallenge&)
     286{
     287    ASSERT_NOT_REACHED();
     288}
     289
     290void ResourceHandle::receivedChallengeRejection(const AuthenticationChallenge&)
     291{
     292    ASSERT_NOT_REACHED();
     293}
     294
    285295} // namespace WebCore
    286296
  • trunk/Source/WebCore/platform/network/curl/SocketStreamHandle.h

    r156550 r169782  
    6262        void receivedRequestToContinueWithoutCredential(const AuthenticationChallenge&);
    6363        void receivedCancellation(const AuthenticationChallenge&);
     64        void receivedRequestToPerformDefaultHandling(const AuthenticationChallenge&);
     65        void receivedChallengeRejection(const AuthenticationChallenge&);
    6466    };
    6567
  • trunk/Source/WebCore/platform/network/curl/SocketStreamHandleCurl.cpp

    r165996 r169782  
    8989}
    9090
     91void SocketStreamHandle::receivedRequestToPerformDefaultHandling(const AuthenticationChallenge&)
     92{
     93    notImplemented();
     94}
     95
     96void SocketStreamHandle::receivedChallengeRejection(const AuthenticationChallenge&)
     97{
     98    notImplemented();
     99}
     100
    91101}  // namespace WebCore
    92102
  • trunk/Source/WebCore/platform/network/mac/ResourceHandleMac.mm

    r169551 r169782  
    690690}
    691691
     692void ResourceHandle::receivedRequestToPerformDefaultHandling(const AuthenticationChallenge& challenge)
     693{
     694    LOG(Network, "Handle %p receivedRequestToPerformDefaultHandling", this);
     695
     696    ASSERT(!challenge.isNull());
     697    if (challenge != d->m_currentWebChallenge)
     698        return;
     699
     700    [[d->m_currentMacChallenge sender] performDefaultHandlingForAuthenticationChallenge:d->m_currentMacChallenge];
     701
     702    clearAuthentication();
     703}
     704
     705void ResourceHandle::receivedChallengeRejection(const AuthenticationChallenge& challenge)
     706{
     707    LOG(Network, "Handle %p receivedChallengeRejection", this);
     708
     709    ASSERT(!challenge.isNull());
     710    if (challenge != d->m_currentWebChallenge)
     711        return;
     712
     713    [[d->m_currentMacChallenge sender] rejectProtectionSpaceAndContinueWithChallenge:d->m_currentMacChallenge];
     714
     715    clearAuthentication();
     716}
     717
    692718void ResourceHandle::continueWillCacheResponse(NSCachedURLResponse *response)
    693719{
  • trunk/Source/WebCore/platform/network/soup/ResourceHandleSoup.cpp

    r169560 r169782  
    11951195}
    11961196
     1197void ResourceHandle::receivedRequestToPerformDefaultHandling(const AuthenticationChallenge&)
     1198{
     1199    ASSERT_NOT_REACHED();
     1200}
     1201
     1202void ResourceHandle::receivedChallengeRejection(const AuthenticationChallenge&)
     1203{
     1204    ASSERT_NOT_REACHED();
     1205}
     1206
    11971207static bool waitingToSendRequest(ResourceHandle* handle)
    11981208{
  • trunk/Source/WebCore/platform/network/soup/SocketStreamHandle.h

    r168351 r169782  
    7979        void receivedRequestToContinueWithoutCredential(const AuthenticationChallenge&);
    8080        void receivedCancellation(const AuthenticationChallenge&);
     81        void receivedRequestToPerformDefaultHandling(const AuthenticationChallenge&);
     82        void receivedChallengeRejection(const AuthenticationChallenge&);
     83
    8184        void beginWaitingForSocketWritability();
    8285        void stopWaitingForSocketWritability();
  • trunk/Source/WebCore/platform/network/soup/SocketStreamHandleSoup.cpp

    r168351 r169782  
    229229}
    230230
     231void SocketStreamHandle::receivedRequestToPerformDefaultHandling(const AuthenticationChallenge&)
     232{
     233    notImplemented();
     234}
     235
     236void SocketStreamHandle::receivedChallengeRejection(const AuthenticationChallenge&)
     237{
     238    notImplemented();
     239}
     240
    231241void SocketStreamHandle::beginWaitingForSocketWritability()
    232242{
  • trunk/Source/WebCore/platform/network/win/SocketStreamHandle.h

    r156550 r169782  
    6262    void receivedRequestToContinueWithoutCredential(const AuthenticationChallenge&);
    6363    void receivedCancellation(const AuthenticationChallenge&);
     64    void receivedRequestToPerformDefaultHandling(const AuthenticationChallenge&);
     65    void receivedChallengeRejection(const AuthenticationChallenge&);
    6466};
    6567
  • trunk/Source/WebCore/platform/network/win/SocketStreamHandleWin.cpp

    r156550 r169782  
    8787}
    8888
     89void SocketStreamHandle::receivedRequestToPerformDefaultHandling(const AuthenticationChallenge&)
     90{
     91    notImplemented();
     92}
     93
     94void SocketStreamHandle::receivedChallengeRejection(const AuthenticationChallenge&)
     95{
     96    notImplemented();
     97}
     98
    8999} // namespace WebCore
  • trunk/Source/WebKit2/ChangeLog

    r169775 r169782  
     12014-06-10  Dan Bernstein  <mitz@apple.com>
     2
     3        WebKit2 part of [Cocoa] Handling authentication challenges should not require multiple delegate methods
     4        https://bugs.webkit.org/show_bug.cgi?id=133697
     5
     6        Reviewed by Anders Carlsson.
     7
     8        * Shared/Authentication/AuthenticationManager.cpp:
     9        (WebKit::AuthenticationManager::performDefaultHandling): Added. Calls the new
     10        AuthenticationClient function receivedRequestToPerformDefaultHandling.
     11        (WebKit::AuthenticationManager::rejectProtectionSpaceAndContinue): Added. Calls the new
     12        AuthenticationClient function receivedChallengeRejection.
     13        * Shared/Authentication/AuthenticationManager.h:
     14        * Shared/Authentication/AuthenticationManager.messages.in: Added new messages
     15        PerformDefaultHandling and RejectProtectionSpaceAndContinue.
     16
     17        * Shared/Downloads/DownloadAuthenticationClient.h: Override new AuthenticationClient member
     18        functions.
     19
     20        * Shared/Downloads/ios/DownloadIOS.mm:
     21        (WebKit::Download::receivedRequestToPerformDefaultHandling): Added empty implementation.
     22        (WebKit::Download::receivedChallengeRejection): Ditto.
     23
     24        * Shared/Downloads/mac/DownloadMac.mm:
     25        (WebKit::Download::receivedRequestToPerformDefaultHandling): Added. Forwards to the sender.
     26        (WebKit::Download::receivedChallengeRejection): Ditto.
     27
     28        * UIProcess/API/Cocoa/WKNSURLAuthenticationChallenge.mm:
     29        (checkChallenge): Factored out a bit of code into this helper function.
     30        (-[WKNSURLAuthenticationChallengeSender cancelAuthenticationChallenge:]): Use new helper.
     31        (-[WKNSURLAuthenticationChallengeSender continueWithoutCredentialForAuthenticationChallenge:]):
     32        Ditto.
     33        (-[WKNSURLAuthenticationChallengeSender useCredential:forAuthenticationChallenge:]): Ditto.
     34        (-[WKNSURLAuthenticationChallengeSender performDefaultHandlingForAuthenticationChallenge:]):
     35        Implemented this optional NSURLAuthenticationChallengeSender protocol method by forwarding
     36        to the decision listener.
     37        (-[WKNSURLAuthenticationChallengeSender rejectProtectionSpaceAndContinueWithChallenge:]):
     38        Ditto.
     39
     40        * UIProcess/API/Cocoa/WKNavigationDelegatePrivate.h: Declared new delegate method.
     41
     42        * UIProcess/Authentication/AuthenticationChallengeProxy.cpp:
     43        (WebKit::AuthenticationChallengeProxy::performDefaultHandling): Added. Sends a message to
     44        the authentication manager.
     45        (WebKit::AuthenticationChallengeProxy::rejectProtectionSpaceAndContinue): Ditto.
     46        * UIProcess/Authentication/AuthenticationChallengeProxy.h:
     47
     48        * UIProcess/Authentication/AuthenticationDecisionListener.cpp:
     49        (WebKit::AuthenticationDecisionListener::performDefaultHandling): Added. Forwards to the
     50        authentication challenge proxy.
     51        (WebKit::AuthenticationDecisionListener::rejectProtectionSpaceAndContinue): Ditto.
     52        * UIProcess/Authentication/AuthenticationDecisionListener.h:
     53
     54        * UIProcess/Cocoa/NavigationState.h: Added flag in m_navigationDelegateMethods struct.
     55        * UIProcess/Cocoa/NavigationState.mm:
     56        (WebKit::NavigationState::setNavigationDelegate): Initialize
     57        webViewWillSendRequestForAuthenticationChallenge flag in the delegate methods struct.
     58        (WebKit::NavigationState::LoaderClient::canAuthenticateAgainstProtectionSpaceInFrame): If
     59        the delegate implements -_webView:willSendRequestForAuthenticationChallenge:, return true
     60        here; the delegate will respond with -rejectProtectionSpaceAndContinueWithChallenge: if
     61        it cannot authenticate.
     62        (WebKit::NavigationState::LoaderClient::didReceiveAuthenticationChallengeInFrame): If the
     63        delegate implements -_webView:willSendRequestForAuthenticationChallenge:, send that message.
     64
    1652014-06-10  Timothy Horton  <timothy_horton@apple.com>
    266
  • trunk/Source/WebKit2/Shared/Authentication/AuthenticationManager.cpp

    r164255 r169782  
    157157}
    158158
     159void AuthenticationManager::performDefaultHandling(uint64_t challengeID)
     160{
     161    ASSERT(RunLoop::isMain());
     162
     163    AuthenticationChallenge challenge = m_challenges.take(challengeID);
     164    ASSERT(!challenge.isNull());
     165    AuthenticationClient* coreClient = challenge.authenticationClient();
     166    if (!coreClient) {
     167        // This authentication challenge comes from a download.
     168        Download::receivedRequestToPerformDefaultHandling(challenge);
     169        return;
     170    }
     171
     172    coreClient->receivedRequestToPerformDefaultHandling(challenge);
     173}
     174
     175void AuthenticationManager::rejectProtectionSpaceAndContinue(uint64_t challengeID)
     176{
     177    ASSERT(RunLoop::isMain());
     178
     179    AuthenticationChallenge challenge = m_challenges.take(challengeID);
     180    ASSERT(!challenge.isNull());
     181    AuthenticationClient* coreClient = challenge.authenticationClient();
     182    if (!coreClient) {
     183        // This authentication challenge comes from a download.
     184        Download::receivedChallengeRejection(challenge);
     185        return;
     186    }
     187
     188    coreClient->receivedChallengeRejection(challenge);
     189}
     190
    159191} // namespace WebKit
  • trunk/Source/WebKit2/Shared/Authentication/AuthenticationManager.h

    r162139 r169782  
    6363    void continueWithoutCredentialForChallenge(uint64_t challengeID);
    6464    void cancelChallenge(uint64_t challengeID);
    65    
     65    void performDefaultHandling(uint64_t challengeID);
     66    void rejectProtectionSpaceAndContinue(uint64_t challengeID);
     67
    6668    uint64_t outstandingAuthenticationChallengeCount() const { return m_challenges.size(); }
    6769
  • trunk/Source/WebKit2/Shared/Authentication/AuthenticationManager.messages.in

    r160487 r169782  
    2525    void ContinueWithoutCredentialForChallenge(uint64_t challengeID);
    2626    void CancelChallenge(uint64_t challengeID);
     27    void PerformDefaultHandling(uint64_t challengeID);
     28    void RejectProtectionSpaceAndContinue(uint64_t challengeID);
    2729}
  • trunk/Source/WebKit2/Shared/Downloads/Download.h

    r165707 r169782  
    101101    static void receivedRequestToContinueWithoutCredential(const WebCore::AuthenticationChallenge&);
    102102    static void receivedCancellation(const WebCore::AuthenticationChallenge&);
     103    static void receivedRequestToPerformDefaultHandling(const WebCore::AuthenticationChallenge&);
     104    static void receivedChallengeRejection(const WebCore::AuthenticationChallenge&);
    103105
    104106    void useCredential(const WebCore::AuthenticationChallenge&, const WebCore::Credential&);
  • trunk/Source/WebKit2/Shared/Downloads/DownloadAuthenticationClient.cpp

    r160101 r169782  
    5454}
    5555
     56void DownloadAuthenticationClient::receivedRequestToPerformDefaultHandling(const AuthenticationChallenge&)
     57{
     58    // FIXME (119667): This can probably be just removed.
     59}
     60
     61void DownloadAuthenticationClient::receivedChallengeRejection(const AuthenticationChallenge&)
     62{
     63    // FIXME (119667): This can probably be just removed.
     64}
     65
    5666} // namespace WebKit
  • trunk/Source/WebKit2/Shared/Downloads/DownloadAuthenticationClient.h

    r140752 r169782  
    5555    virtual void receivedRequestToContinueWithoutCredential(const WebCore::AuthenticationChallenge&);
    5656    virtual void receivedCancellation(const WebCore::AuthenticationChallenge&);
     57    virtual void receivedRequestToPerformDefaultHandling(const WebCore::AuthenticationChallenge&) override;
     58    virtual void receivedChallengeRejection(const WebCore::AuthenticationChallenge&) override;
    5759
    5860    virtual void refAuthenticationClient() { ref(); }
  • trunk/Source/WebKit2/Shared/Downloads/ios/DownloadIOS.mm

    r166206 r169782  
    170170}
    171171
     172void Download::receivedRequestToPerformDefaultHandling(const WebCore::AuthenticationChallenge&)
     173{
     174    notImplemented();
     175}
     176
     177void Download::receivedChallengeRejection(const WebCore::AuthenticationChallenge&)
     178{
     179    notImplemented();
     180}
     181
    172182} // namespace WebKit
    173183
  • trunk/Source/WebKit2/Shared/Downloads/mac/DownloadMac.mm

    r164776 r169782  
    126126}
    127127
     128void Download::receivedRequestToPerformDefaultHandling(const AuthenticationChallenge& authenticationChallenge)
     129{
     130    [authenticationChallenge.sender() performDefaultHandlingForAuthenticationChallenge:authenticationChallenge.nsURLAuthenticationChallenge()];
     131}
     132
     133void Download::receivedChallengeRejection(const AuthenticationChallenge& authenticationChallenge)
     134{
     135    [authenticationChallenge.sender() rejectProtectionSpaceAndContinueWithChallenge:authenticationChallenge.nsURLAuthenticationChallenge()];
     136}
     137
    128138} // namespace WebKit
    129139
  • trunk/Source/WebKit2/Shared/Downloads/soup/DownloadSoup.cpp

    r169612 r169782  
    283283}
    284284
     285void Download::receivedRequestToPerformDefaultHandling(const AuthenticationChallenge&)
     286{
     287    notImplemented();
     288}
     289
     290void Download::receivedChallengeRejection(const AuthenticationChallenge&)
     291{
     292    notImplemented();
     293}
     294
    285295} // namespace WebKit
  • trunk/Source/WebKit2/UIProcess/API/Cocoa/WKNSURLAuthenticationChallenge.mm

    r160227 r169782  
    6464@implementation WKNSURLAuthenticationChallengeSender
    6565
    66 - (void)cancelAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge
     66static void checkChallenge(NSURLAuthenticationChallenge *challenge)
    6767{
    6868    if ([challenge class] != [WKNSURLAuthenticationChallenge class])
    6969        [NSException raise:NSInvalidArgumentException format:@"The challenge was not sent by the receiver."];
     70}
    7071
     72- (void)cancelAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge
     73{
     74    checkChallenge(challenge);
    7175    AuthenticationChallengeProxy& webChallenge = ((WKNSURLAuthenticationChallenge *)challenge)._web_authenticationChallengeProxy;
    7276    webChallenge.listener()->cancel();
     
    7579- (void)continueWithoutCredentialForAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge
    7680{
    77     if ([challenge class] != [WKNSURLAuthenticationChallenge class])
    78         [NSException raise:NSInvalidArgumentException format:@"The challenge was not sent by the receiver."];
    79 
     81    checkChallenge(challenge);
    8082    AuthenticationChallengeProxy& webChallenge = ((WKNSURLAuthenticationChallenge *)challenge)._web_authenticationChallengeProxy;
    8183    webChallenge.listener()->useCredential(nullptr);
     
    8486- (void)useCredential:(NSURLCredential *)credential forAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge
    8587{
    86     if ([challenge class] != [WKNSURLAuthenticationChallenge class])
    87         [NSException raise:NSInvalidArgumentException format:@"The challenge was not sent by the receiver."];
     88    checkChallenge(challenge);
     89    AuthenticationChallengeProxy& webChallenge = ((WKNSURLAuthenticationChallenge *)challenge)._web_authenticationChallengeProxy;
     90    webChallenge.listener()->useCredential(WebCredential::create(core(credential)).get());
     91}
    8892
     93- (void)performDefaultHandlingForAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge
     94{
     95    checkChallenge(challenge);
    8996    AuthenticationChallengeProxy& webChallenge = ((WKNSURLAuthenticationChallenge *)challenge)._web_authenticationChallengeProxy;
     97    webChallenge.listener()->performDefaultHandling();
     98}
    9099
    91     webChallenge.listener()->useCredential(WebCredential::create(core(credential)).get());
     100- (void)rejectProtectionSpaceAndContinueWithChallenge:(NSURLAuthenticationChallenge *)challenge
     101{
     102    checkChallenge(challenge);
     103    AuthenticationChallengeProxy& webChallenge = ((WKNSURLAuthenticationChallenge *)challenge)._web_authenticationChallengeProxy;
     104    webChallenge.listener()->rejectProtectionSpaceAndContinue();
    92105}
    93106
  • trunk/Source/WebKit2/UIProcess/API/Cocoa/WKNavigationDelegatePrivate.h

    r169460 r169782  
    4545- (void)_webView:(WKWebView *)webView renderingProgressDidChange:(_WKRenderingProgressEvents)progressEvents;
    4646
     47- (void)_webView:(WKWebView *)webView willSendRequestForAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge;
    4748- (BOOL)_webView:(WKWebView *)webView canAuthenticateAgainstProtectionSpace:(NSURLProtectionSpace *)protectionSpace;
    4849- (void)_webView:(WKWebView *)webView didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge;
  • trunk/Source/WebKit2/UIProcess/Authentication/AuthenticationChallengeProxy.cpp

    r161148 r169782  
    8484}
    8585
     86void AuthenticationChallengeProxy::performDefaultHandling()
     87{
     88    if (!m_challengeID)
     89        return;
     90
     91    m_connection->send(Messages::AuthenticationManager::PerformDefaultHandling(m_challengeID), 0);
     92
     93    m_challengeID = 0;
     94}
     95
     96void AuthenticationChallengeProxy::rejectProtectionSpaceAndContinue()
     97{
     98    if (!m_challengeID)
     99        return;
     100
     101    m_connection->send(Messages::AuthenticationManager::RejectProtectionSpaceAndContinue(m_challengeID), 0);
     102
     103    m_challengeID = 0;
     104}
     105
    86106WebCredential* AuthenticationChallengeProxy::proposedCredential() const
    87107{
  • trunk/Source/WebKit2/UIProcess/Authentication/AuthenticationChallengeProxy.h

    r161148 r169782  
    5353    void useCredential(WebCredential*);
    5454    void cancel();
     55    void performDefaultHandling();
     56    void rejectProtectionSpaceAndContinue();
    5557
    5658    AuthenticationDecisionListener* listener() const { return m_listener.get(); }
  • trunk/Source/WebKit2/UIProcess/Authentication/AuthenticationDecisionListener.cpp

    r95901 r169782  
    5353}
    5454
     55void AuthenticationDecisionListener::performDefaultHandling()
     56{
     57    if (m_challengeProxy)
     58        m_challengeProxy->performDefaultHandling();
     59}
     60
     61void AuthenticationDecisionListener::rejectProtectionSpaceAndContinue()
     62{
     63    if (m_challengeProxy)
     64        m_challengeProxy->rejectProtectionSpaceAndContinue();
     65}
     66
    5567void AuthenticationDecisionListener::detachChallenge()
    5668{
  • trunk/Source/WebKit2/UIProcess/Authentication/AuthenticationDecisionListener.h

    r160384 r169782  
    4545    void useCredential(WebCredential*);
    4646    void cancel();
    47    
     47    void performDefaultHandling();
     48    void rejectProtectionSpaceAndContinue();
     49
    4850    void detachChallenge();
    4951
  • trunk/Source/WebKit2/UIProcess/Cocoa/NavigationState.h

    r169696 r169782  
    146146
    147147        bool webViewRenderingProgressDidChange : 1;
     148        bool webViewWillSendRequestForAuthenticationChallenge : 1;
    148149        bool webViewCanAuthenticateAgainstProtectionSpace : 1;
    149150        bool webViewDidReceiveAuthenticationChallenge : 1;
  • trunk/Source/WebKit2/UIProcess/Cocoa/NavigationState.mm

    r169696 r169782  
    127127    m_navigationDelegateMethods.webViewNavigationDidFinishDocumentLoad = [delegate respondsToSelector:@selector(_webView:navigationDidFinishDocumentLoad:)];
    128128    m_navigationDelegateMethods.webViewRenderingProgressDidChange = [delegate respondsToSelector:@selector(_webView:renderingProgressDidChange:)];
     129    m_navigationDelegateMethods.webViewWillSendRequestForAuthenticationChallenge = [delegate respondsToSelector:@selector(_webView:willSendRequestForAuthenticationChallenge:)];
    129130    m_navigationDelegateMethods.webViewCanAuthenticateAgainstProtectionSpace = [delegate respondsToSelector:@selector(_webView:canAuthenticateAgainstProtectionSpace:)];
    130131    m_navigationDelegateMethods.webViewDidReceiveAuthenticationChallenge = [delegate respondsToSelector:@selector(_webView:didReceiveAuthenticationChallenge:)];
     
    582583bool NavigationState::LoaderClient::canAuthenticateAgainstProtectionSpaceInFrame(WebKit::WebPageProxy*, WebKit::WebFrameProxy*, WebKit::WebProtectionSpace* protectionSpace)
    583584{
     585    if (m_navigationState.m_navigationDelegateMethods.webViewWillSendRequestForAuthenticationChallenge)
     586        return true;
     587
    584588    if (!m_navigationState.m_navigationDelegateMethods.webViewCanAuthenticateAgainstProtectionSpace)
    585589        return false;
     
    594598void NavigationState::LoaderClient::didReceiveAuthenticationChallengeInFrame(WebKit::WebPageProxy*, WebKit::WebFrameProxy*, WebKit::AuthenticationChallengeProxy* authenticationChallenge)
    595599{
     600    if (m_navigationState.m_navigationDelegateMethods.webViewWillSendRequestForAuthenticationChallenge) {
     601        auto navigationDelegate = m_navigationState.m_navigationDelegate.get();
     602        if (!navigationDelegate)
     603            return;
     604
     605        [static_cast<id <WKNavigationDelegatePrivate>>(navigationDelegate.get()) _webView:m_navigationState.m_webView willSendRequestForAuthenticationChallenge:wrapper(*authenticationChallenge)];
     606        return;
     607    }
     608
    596609    if (!m_navigationState.m_navigationDelegateMethods.webViewDidReceiveAuthenticationChallenge)
    597610        return;
Note: See TracChangeset for help on using the changeset viewer.