Changeset 236153 in webkit
- Timestamp:
- Sep 18, 2018, 1:55:55 PM (8 years ago)
- Location:
- trunk/Source/WebKit
- Files:
-
- 21 edited
-
ChangeLog (modified) (1 diff)
-
NetworkProcess/cocoa/NetworkSessionCocoa.mm (modified) (1 diff)
-
Shared/Authentication/AuthenticationManager.cpp (modified) (1 diff)
-
Shared/Authentication/AuthenticationManager.h (modified) (1 diff)
-
UIProcess/API/C/WKAuthenticationChallenge.cpp (modified) (2 diffs)
-
UIProcess/API/C/WKAuthenticationDecisionListener.cpp (modified) (1 diff)
-
UIProcess/API/C/WKPage.cpp (modified) (2 diffs)
-
UIProcess/API/Cocoa/WKNSURLAuthenticationChallenge.mm (modified) (5 diffs)
-
UIProcess/API/glib/WebKitAuthenticationRequest.cpp (modified) (10 diffs)
-
UIProcess/Authentication/AuthenticationChallengeProxy.cpp (modified) (4 diffs)
-
UIProcess/Authentication/AuthenticationChallengeProxy.h (modified) (1 diff)
-
UIProcess/Authentication/AuthenticationDecisionListener.cpp (modified) (2 diffs)
-
UIProcess/Authentication/AuthenticationDecisionListener.h (modified) (1 diff)
-
UIProcess/Authentication/cocoa/AuthenticationChallengeProxyCocoa.mm (modified) (2 diffs)
-
UIProcess/Cocoa/DownloadClient.mm (modified) (2 diffs)
-
UIProcess/Cocoa/NavigationState.mm (modified) (2 diffs)
-
UIProcess/Downloads/DownloadProxy.cpp (modified) (1 diff)
-
UIProcess/Network/NetworkProcessProxy.cpp (modified) (2 diffs)
-
UIProcess/ServiceWorkerProcessProxy.cpp (modified) (2 diffs)
-
UIProcess/WebPageProxy.cpp (modified) (1 diff)
-
UIProcess/WebPageProxy.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/ChangeLog
r236152 r236153 1 2018-09-18 Alex Christensen <achristensen@webkit.org> 2 3 Clean up AuthenticationChallengeProxy 4 https://bugs.webkit.org/show_bug.cgi?id=189668 5 6 Reviewed by Youenn Fablet. 7 8 At its core, it's a CompletionHandler with some information. 9 Make it more elegant and simple with no change in behavior and reduce the complexity of this security-sensitive object. 10 11 * NetworkProcess/cocoa/NetworkSessionCocoa.mm: 12 (toNSURLSessionAuthChallengeDisposition): 13 * Shared/Authentication/AuthenticationManager.cpp: 14 (WebKit::AuthenticationManager::rejectProtectionSpaceAndContinueForSingleChallenge): 15 * Shared/Authentication/AuthenticationManager.h: 16 * UIProcess/API/C/WKAuthenticationChallenge.cpp: 17 (WKAuthenticationChallengeGetDecisionListener): 18 (WKAuthenticationChallengeGetProtectionSpace): 19 (WKAuthenticationChallengeGetProposedCredential): 20 (WKAuthenticationChallengeGetPreviousFailureCount): 21 * UIProcess/API/C/WKPage.cpp: 22 (WKPageSetPageNavigationClient): 23 * UIProcess/API/Cocoa/WKNSURLAuthenticationChallenge.mm: 24 (-[WKNSURLAuthenticationChallengeSender cancelAuthenticationChallenge:]): 25 (-[WKNSURLAuthenticationChallengeSender continueWithoutCredentialForAuthenticationChallenge:]): 26 (-[WKNSURLAuthenticationChallengeSender useCredential:forAuthenticationChallenge:]): 27 (-[WKNSURLAuthenticationChallengeSender performDefaultHandlingForAuthenticationChallenge:]): 28 (-[WKNSURLAuthenticationChallengeSender rejectProtectionSpaceAndContinueWithChallenge:]): 29 * UIProcess/Authentication/AuthenticationChallengeProxy.cpp: 30 (WebKit::AuthenticationChallengeProxy::AuthenticationChallengeProxy): 31 (WebKit::AuthenticationChallengeProxy::~AuthenticationChallengeProxy): Deleted. 32 (WebKit::AuthenticationChallengeProxy::useCredential): Deleted. 33 (WebKit::AuthenticationChallengeProxy::cancel): Deleted. 34 (WebKit::AuthenticationChallengeProxy::performDefaultHandling): Deleted. 35 (WebKit::AuthenticationChallengeProxy::rejectProtectionSpaceAndContinue): Deleted. 36 (WebKit::AuthenticationChallengeProxy::proposedCredential const): Deleted. 37 (WebKit::AuthenticationChallengeProxy::protectionSpace const): Deleted. 38 (WebKit::AuthenticationChallengeProxy::setSecKeyProxyStore): Deleted. 39 * UIProcess/Authentication/AuthenticationChallengeProxy.h: 40 (WebKit::AuthenticationChallengeProxy::create): 41 (WebKit::AuthenticationChallengeProxy::listener const): 42 (WebKit::AuthenticationChallengeProxy::previousFailureCount const): Deleted. 43 * UIProcess/Authentication/AuthenticationDecisionListener.cpp: 44 (WebKit::AuthenticationDecisionListener::AuthenticationDecisionListener): 45 (WebKit::AuthenticationDecisionListener::~AuthenticationDecisionListener): 46 (WebKit::AuthenticationDecisionListener::useCredential): 47 (WebKit::AuthenticationDecisionListener::cancel): 48 (WebKit::AuthenticationDecisionListener::performDefaultHandling): 49 (WebKit::AuthenticationDecisionListener::rejectProtectionSpaceAndContinue): 50 (WebKit::AuthenticationDecisionListener::detachChallenge): Deleted. 51 * UIProcess/Authentication/AuthenticationDecisionListener.h: 52 (WebKit::AuthenticationDecisionListener::create): 53 * UIProcess/Authentication/cocoa/AuthenticationChallengeProxyCocoa.mm: 54 (WebKit::AuthenticationChallengeProxy::sendClientCertificateCredentialOverXpc): 55 (WebKit::AuthenticationChallengeProxy::sendClientCertificateCredentialOverXpc const): Deleted. 56 * UIProcess/Cocoa/DownloadClient.mm: 57 (WebKit::DownloadClient::didReceiveAuthenticationChallenge): 58 * UIProcess/Cocoa/NavigationState.mm: 59 (WebKit::NavigationState::NavigationClient::didReceiveAuthenticationChallenge): 60 * UIProcess/Downloads/DownloadProxy.cpp: 61 (WebKit::DownloadProxy::didReceiveAuthenticationChallenge): 62 * UIProcess/Network/NetworkProcessProxy.cpp: 63 (WebKit::NetworkProcessProxy::didReceiveAuthenticationChallenge): 64 * UIProcess/ServiceWorkerProcessProxy.cpp: 65 (WebKit::ServiceWorkerProcessProxy::didReceiveAuthenticationChallenge): 66 * UIProcess/WebPageProxy.cpp: 67 (WebKit::WebPageProxy::secKeyProxyStore): 68 (WebKit::WebPageProxy::didReceiveAuthenticationChallengeProxy): 69 * UIProcess/WebPageProxy.h: 70 1 71 2018-09-18 Ben Richards <benton_richards@apple.com> 2 72 -
trunk/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm
r235585 r236153 79 79 case WebKit::AuthenticationChallengeDisposition::Cancel: 80 80 return NSURLSessionAuthChallengeCancelAuthenticationChallenge; 81 case WebKit::AuthenticationChallengeDisposition::RejectProtectionSpace :81 case WebKit::AuthenticationChallengeDisposition::RejectProtectionSpaceAndContinue: 82 82 return NSURLSessionAuthChallengeRejectProtectionSpace; 83 83 } -
trunk/Source/WebKit/Shared/Authentication/AuthenticationManager.cpp
r235828 r236153 227 227 228 228 if (challenge.completionHandler) 229 challenge.completionHandler(AuthenticationChallengeDisposition::RejectProtectionSpace , Credential());229 challenge.completionHandler(AuthenticationChallengeDisposition::RejectProtectionSpaceAndContinue, { }); 230 230 else 231 231 ASSERT_NOT_REACHED(); -
trunk/Source/WebKit/Shared/Authentication/AuthenticationManager.h
r234941 r236153 56 56 PerformDefaultHandling, 57 57 Cancel, 58 RejectProtectionSpace 58 RejectProtectionSpaceAndContinue 59 59 }; 60 60 using ChallengeCompletionHandler = CompletionHandler<void(AuthenticationChallengeDisposition, const WebCore::Credential&)>; -
trunk/Source/WebKit/UIProcess/API/C/WKAuthenticationChallenge.cpp
r176829 r236153 43 43 WKAuthenticationDecisionListenerRef WKAuthenticationChallengeGetDecisionListener(WKAuthenticationChallengeRef challenge) 44 44 { 45 return toAPI( toImpl(challenge)->listener());45 return toAPI(&toImpl(challenge)->listener()); 46 46 } 47 47 … … 58 58 int WKAuthenticationChallengeGetPreviousFailureCount(WKAuthenticationChallengeRef challenge) 59 59 { 60 return toImpl(challenge)-> previousFailureCount();60 return toImpl(challenge)->core().previousFailureCount(); 61 61 } -
trunk/Source/WebKit/UIProcess/API/C/WKAuthenticationDecisionListener.cpp
r203743 r236153 40 40 void WKAuthenticationDecisionListenerUseCredential(WKAuthenticationDecisionListenerRef authenticationListener, WKCredentialRef credential) 41 41 { 42 toImpl(authenticationListener)->useCredential(toImpl(credential)); 42 if (credential) 43 toImpl(authenticationListener)->useCredential(toImpl(credential)->credential()); 44 else 45 toImpl(authenticationListener)->useCredential(std::nullopt); 43 46 } 44 47 -
trunk/Source/WebKit/UIProcess/API/C/WKPage.cpp
r235618 r236153 51 51 #include "APIWindowFeatures.h" 52 52 #include "AuthenticationChallengeProxy.h" 53 #include "AuthenticationDecisionListener.h" 53 54 #include "LegacySessionStateCoding.h" 54 55 #include "Logging.h" … … 2148 2149 void didReceiveAuthenticationChallenge(WebPageProxy& page, AuthenticationChallengeProxy& authenticationChallenge) override 2149 2150 { 2150 if (m_client.canAuthenticateAgainstProtectionSpace && !m_client.canAuthenticateAgainstProtectionSpace(toAPI(&page), toAPI( authenticationChallenge.protectionSpace()), m_client.base.clientInfo))2151 return authenticationChallenge. rejectProtectionSpaceAndContinue();2151 if (m_client.canAuthenticateAgainstProtectionSpace && !m_client.canAuthenticateAgainstProtectionSpace(toAPI(&page), toAPI(WebProtectionSpace::create(authenticationChallenge.core().protectionSpace()).ptr()), m_client.base.clientInfo)) 2152 return authenticationChallenge.listener().rejectProtectionSpaceAndContinue(); 2152 2153 if (!m_client.didReceiveAuthenticationChallenge) 2153 return authenticationChallenge. performDefaultHandling();2154 return authenticationChallenge.listener().performDefaultHandling(); 2154 2155 m_client.didReceiveAuthenticationChallenge(toAPI(&page), toAPI(&authenticationChallenge), m_client.base.clientInfo); 2155 2156 } -
trunk/Source/WebKit/UIProcess/API/Cocoa/WKNSURLAuthenticationChallenge.mm
r235828 r236153 71 71 checkChallenge(challenge); 72 72 WebKit::AuthenticationChallengeProxy& webChallenge = ((WKNSURLAuthenticationChallenge *)challenge)._web_authenticationChallengeProxy; 73 webChallenge.listener() ->cancel();73 webChallenge.listener().cancel(); 74 74 } 75 75 … … 78 78 checkChallenge(challenge); 79 79 WebKit::AuthenticationChallengeProxy& webChallenge = ((WKNSURLAuthenticationChallenge *)challenge)._web_authenticationChallengeProxy; 80 webChallenge.listener() ->useCredential(nullptr);80 webChallenge.listener().useCredential(std::nullopt); 81 81 } 82 82 … … 85 85 checkChallenge(challenge); 86 86 WebKit::AuthenticationChallengeProxy& webChallenge = ((WKNSURLAuthenticationChallenge *)challenge)._web_authenticationChallengeProxy; 87 webChallenge.listener() ->useCredential(WebKit::WebCredential::create(WebCore::Credential(credential)).ptr());87 webChallenge.listener().useCredential(WebCore::Credential(credential)); 88 88 } 89 89 … … 92 92 checkChallenge(challenge); 93 93 WebKit::AuthenticationChallengeProxy& webChallenge = ((WKNSURLAuthenticationChallenge *)challenge)._web_authenticationChallengeProxy; 94 webChallenge.listener() ->performDefaultHandling();94 webChallenge.listener().performDefaultHandling(); 95 95 } 96 96 … … 99 99 checkChallenge(challenge); 100 100 WebKit::AuthenticationChallengeProxy& webChallenge = ((WKNSURLAuthenticationChallenge *)challenge)._web_authenticationChallengeProxy; 101 webChallenge.listener() ->rejectProtectionSpaceAndContinue();101 webChallenge.listener().rejectProtectionSpaceAndContinue(); 102 102 } 103 103 -
trunk/Source/WebKit/UIProcess/API/glib/WebKitAuthenticationRequest.cpp
r218487 r236153 26 26 #include "WebKitCredentialPrivate.h" 27 27 #include "WebProtectionSpace.h" 28 #include <WebCore/AuthenticationChallenge.h> 29 #include <WebCore/ProtectionSpace.h> 28 30 #include <glib/gi18n-lib.h> 29 31 #include <wtf/glib/WTFGType.h> … … 187 189 g_return_val_if_fail(WEBKIT_IS_AUTHENTICATION_REQUEST(request), 0); 188 190 189 const WebCore::Credential& credential = request->priv->authenticationChallenge->proposedCredential()->credential();191 const auto& credential = request->priv->authenticationChallenge->core().proposedCredential(); 190 192 if (credential.isEmpty()) 191 193 return 0; … … 209 211 210 212 if (request->priv->host.isNull()) 211 request->priv->host = request->priv->authenticationChallenge-> protectionSpace()->host().utf8();213 request->priv->host = request->priv->authenticationChallenge->core().protectionSpace().host().utf8(); 212 214 return request->priv->host.data(); 213 215 } … … 227 229 g_return_val_if_fail(WEBKIT_IS_AUTHENTICATION_REQUEST(request), 0); 228 230 229 return request->priv->authenticationChallenge-> protectionSpace()->port();231 return request->priv->authenticationChallenge->core().protectionSpace().port(); 230 232 } 231 233 … … 245 247 246 248 if (request->priv->realm.isNull()) 247 request->priv->realm = request->priv->authenticationChallenge-> protectionSpace()->realm().utf8();249 request->priv->realm = request->priv->authenticationChallenge->core().protectionSpace().realm().utf8(); 248 250 return request->priv->realm.data(); 249 251 } … … 263 265 g_return_val_if_fail(WEBKIT_IS_AUTHENTICATION_REQUEST(request), WEBKIT_AUTHENTICATION_SCHEME_UNKNOWN); 264 266 265 return toWebKitAuthenticationScheme(request->priv->authenticationChallenge-> protectionSpace()->authenticationScheme());267 return toWebKitAuthenticationScheme(request->priv->authenticationChallenge->core().protectionSpace().authenticationScheme()); 266 268 } 267 269 … … 280 282 g_return_val_if_fail(WEBKIT_IS_AUTHENTICATION_REQUEST(request), FALSE); 281 283 282 return request->priv->authenticationChallenge-> protectionSpace()->isProxy();284 return request->priv->authenticationChallenge->core().protectionSpace().isProxy(); 283 285 } 284 286 … … 297 299 g_return_val_if_fail(WEBKIT_IS_AUTHENTICATION_REQUEST(request), 0); 298 300 299 return request->priv->authenticationChallenge-> previousFailureCount() ? TRUE : FALSE;301 return request->priv->authenticationChallenge->core().previousFailureCount() ? TRUE : FALSE; 300 302 } 301 303 … … 315 317 316 318 if (credential) 317 request->priv->authenticationChallenge->listener() ->useCredential(WebCredential::create(webkitCredentialGetCredential(credential)).ptr());319 request->priv->authenticationChallenge->listener().useCredential(webkitCredentialGetCredential(credential)); 318 320 else 319 request->priv->authenticationChallenge->listener() ->useCredential(nullptr);321 request->priv->authenticationChallenge->listener().useCredential(std::nullopt); 320 322 321 323 request->priv->handledRequest = true; … … 335 337 g_return_if_fail(WEBKIT_IS_AUTHENTICATION_REQUEST(request)); 336 338 337 request->priv->authenticationChallenge->listener() ->cancel();339 request->priv->authenticationChallenge->listener().cancel(); 338 340 339 341 g_signal_emit(request, signals[CANCELLED], 0); -
trunk/Source/WebKit/UIProcess/Authentication/AuthenticationChallengeProxy.cpp
r232165 r236153 28 28 29 29 #include "AuthenticationDecisionListener.h" 30 #include "AuthenticationManager.h" 30 31 #include "AuthenticationManagerMessages.h" 31 32 #include "ChildProcessProxy.h" … … 42 43 namespace WebKit { 43 44 44 AuthenticationChallengeProxy::AuthenticationChallengeProxy(WebCore::AuthenticationChallenge&& authenticationChallenge, uint64_t challengeID, IPC::Connection* connection)45 AuthenticationChallengeProxy::AuthenticationChallengeProxy(WebCore::AuthenticationChallenge&& authenticationChallenge, uint64_t challengeID, Ref<IPC::Connection>&& connection, WeakPtr<SecKeyProxyStore>&& secKeyProxyStore) 45 46 : m_coreAuthenticationChallenge(WTFMove(authenticationChallenge)) 46 , m_challengeID(challengeID) 47 , m_connection(connection) 47 , m_listener(AuthenticationDecisionListener::create([challengeID, connection = WTFMove(connection), secKeyProxyStore = WTFMove(secKeyProxyStore)](AuthenticationChallengeDisposition disposition, std::optional<WebCore::Credential>&& credential) { 48 switch (disposition) { 49 case AuthenticationChallengeDisposition::Cancel: 50 connection->send(Messages::AuthenticationManager::CancelChallenge(challengeID), 0); 51 break; 52 case AuthenticationChallengeDisposition::PerformDefaultHandling: 53 connection->send(Messages::AuthenticationManager::PerformDefaultHandling(challengeID), 0); 54 break; 55 case AuthenticationChallengeDisposition::RejectProtectionSpaceAndContinue: 56 connection->send(Messages::AuthenticationManager::RejectProtectionSpaceAndContinue(challengeID), 0); 57 break; 58 case AuthenticationChallengeDisposition::UseCredential: 59 if (!credential) { 60 connection->send(Messages::AuthenticationManager::ContinueWithoutCredentialForChallenge(challengeID), 0); 61 break; 62 } 63 64 #if HAVE(SEC_KEY_PROXY) 65 if (secKeyProxyStore) { 66 secKeyProxyStore->initialize(*credential); 67 sendClientCertificateCredentialOverXpc(connection, *secKeyProxyStore, challengeID, *credential); 68 break; 69 } 70 #endif 71 72 connection->send(Messages::AuthenticationManager::UseCredentialForChallenge(challengeID, *credential), 0); 73 } 74 })) 48 75 { 49 ASSERT(m_challengeID);50 m_listener = AuthenticationDecisionListener::create(this);51 }52 53 AuthenticationChallengeProxy::~AuthenticationChallengeProxy()54 {55 // If an outstanding AuthenticationChallengeProxy is being destroyed even though it hasn't been responded to yet,56 // we cancel it here so the process isn't waiting for an answer forever.57 if (m_challengeID)58 m_connection->send(Messages::AuthenticationManager::CancelChallenge(m_challengeID), 0);59 60 if (m_listener)61 m_listener->detachChallenge();62 }63 64 void AuthenticationChallengeProxy::useCredential(WebCredential* credential)65 {66 if (!m_challengeID)67 return;68 69 uint64_t challengeID = m_challengeID;70 m_challengeID = 0;71 72 if (!credential) {73 m_connection->send(Messages::AuthenticationManager::ContinueWithoutCredentialForChallenge(challengeID), 0);74 return;75 }76 77 #if HAVE(SEC_KEY_PROXY)78 if (protectionSpace()->authenticationScheme() == WebCore::ProtectionSpaceAuthenticationSchemeClientCertificateRequested) {79 if (!m_secKeyProxyStore) {80 m_connection->send(Messages::AuthenticationManager::ContinueWithoutCredentialForChallenge(challengeID), 0);81 return;82 }83 m_secKeyProxyStore->initialize(credential->credential());84 sendClientCertificateCredentialOverXpc(challengeID, credential->credential());85 return;86 }87 #endif88 m_connection->send(Messages::AuthenticationManager::UseCredentialForChallenge(challengeID, credential->credential()), 0);89 }90 91 void AuthenticationChallengeProxy::cancel()92 {93 if (!m_challengeID)94 return;95 96 m_connection->send(Messages::AuthenticationManager::CancelChallenge(m_challengeID), 0);97 98 m_challengeID = 0;99 }100 101 void AuthenticationChallengeProxy::performDefaultHandling()102 {103 if (!m_challengeID)104 return;105 106 m_connection->send(Messages::AuthenticationManager::PerformDefaultHandling(m_challengeID), 0);107 108 m_challengeID = 0;109 }110 111 void AuthenticationChallengeProxy::rejectProtectionSpaceAndContinue()112 {113 if (!m_challengeID)114 return;115 116 m_connection->send(Messages::AuthenticationManager::RejectProtectionSpaceAndContinue(m_challengeID), 0);117 118 m_challengeID = 0;119 76 } 120 77 … … 123 80 if (!m_webCredential) 124 81 m_webCredential = WebCredential::create(m_coreAuthenticationChallenge.proposedCredential()); 125 82 126 83 return m_webCredential.get(); 127 84 } … … 131 88 if (!m_webProtectionSpace) 132 89 m_webProtectionSpace = WebProtectionSpace::create(m_coreAuthenticationChallenge.protectionSpace()); 133 90 134 91 return m_webProtectionSpace.get(); 135 92 } 136 93 137 #if HAVE(SEC_KEY_PROXY)138 void AuthenticationChallengeProxy::setSecKeyProxyStore(SecKeyProxyStore& store)139 {140 m_secKeyProxyStore = makeWeakPtr(store);141 }142 #endif143 144 94 } // namespace WebKit -
trunk/Source/WebKit/UIProcess/Authentication/AuthenticationChallengeProxy.h
r232165 r236153 44 44 class AuthenticationChallengeProxy : public API::ObjectImpl<API::Object::Type::AuthenticationChallenge> { 45 45 public: 46 static Ref<AuthenticationChallengeProxy> create(WebCore::AuthenticationChallenge&& authenticationChallenge, uint64_t challengeID, IPC::Connection* connection)46 static Ref<AuthenticationChallengeProxy> create(WebCore::AuthenticationChallenge&& authenticationChallenge, uint64_t challengeID, Ref<IPC::Connection>&& connection, WeakPtr<SecKeyProxyStore>&& secKeyProxyStore) 47 47 { 48 return adoptRef(*new AuthenticationChallengeProxy(WTFMove(authenticationChallenge), challengeID, connection));48 return adoptRef(*new AuthenticationChallengeProxy(WTFMove(authenticationChallenge), challengeID, WTFMove(connection), WTFMove(secKeyProxyStore))); 49 49 } 50 51 ~AuthenticationChallengeProxy();52 53 void useCredential(WebCredential*);54 void cancel();55 void performDefaultHandling();56 void rejectProtectionSpaceAndContinue();57 50 58 AuthenticationDecisionListener* listener() const { return m_listener.get(); }59 51 WebCredential* proposedCredential() const; 60 52 WebProtectionSpace* protectionSpace() const; 61 int previousFailureCount() const { return m_coreAuthenticationChallenge.previousFailureCount(); } 53 54 AuthenticationDecisionListener& listener() const { return m_listener.get(); } 62 55 const WebCore::AuthenticationChallenge& core() { return m_coreAuthenticationChallenge; } 63 56 64 #if HAVE(SEC_KEY_PROXY)65 void setSecKeyProxyStore(SecKeyProxyStore&);66 #endif67 68 57 private: 69 AuthenticationChallengeProxy(WebCore::AuthenticationChallenge&&, uint64_t challengeID, IPC::Connection*);58 AuthenticationChallengeProxy(WebCore::AuthenticationChallenge&&, uint64_t challengeID, Ref<IPC::Connection>&&, WeakPtr<SecKeyProxyStore>&&); 70 59 71 60 #if HAVE(SEC_KEY_PROXY) 72 void sendClientCertificateCredentialOverXpc(uint64_t challengeID, const WebCore::Credential&) const;61 static void sendClientCertificateCredentialOverXpc(IPC::Connection&, SecKeyProxyStore&, uint64_t challengeID, const WebCore::Credential&); 73 62 #endif 74 63 75 64 WebCore::AuthenticationChallenge m_coreAuthenticationChallenge; 76 uint64_t m_challengeID;77 RefPtr<IPC::Connection> m_connection;78 RefPtr<AuthenticationDecisionListener> m_listener;79 65 mutable RefPtr<WebCredential> m_webCredential; 80 66 mutable RefPtr<WebProtectionSpace> m_webProtectionSpace; 81 82 #if HAVE(SEC_KEY_PROXY) 83 WeakPtr<SecKeyProxyStore> m_secKeyProxyStore; 84 #endif 67 Ref<AuthenticationDecisionListener> m_listener; 85 68 }; 86 69 -
trunk/Source/WebKit/UIProcess/Authentication/AuthenticationDecisionListener.cpp
r169782 r236153 28 28 29 29 #include "AuthenticationChallengeProxy.h" 30 #include "AuthenticationManager.h" 30 31 #include "AuthenticationManagerMessages.h" 31 32 #include "WebCertificateInfo.h" … … 36 37 namespace WebKit { 37 38 38 AuthenticationDecisionListener::AuthenticationDecisionListener( AuthenticationChallengeProxy* authenticationChallenge)39 : m_c hallengeProxy(authenticationChallenge)39 AuthenticationDecisionListener::AuthenticationDecisionListener(CompletionHandler<void(AuthenticationChallengeDisposition, std::optional<WebCore::Credential>&&)>&& completionHandler) 40 : m_completionHandler(WTFMove(completionHandler)) 40 41 { 41 42 } 42 43 43 void AuthenticationDecisionListener::useCredential(WebCredential* credential)44 AuthenticationDecisionListener::~AuthenticationDecisionListener() 44 45 { 45 if (m_challengeProxy) 46 m_challengeProxy->useCredential(credential); 46 if (m_completionHandler) 47 m_completionHandler(AuthenticationChallengeDisposition::Cancel, std::nullopt); 48 } 49 50 void AuthenticationDecisionListener::useCredential(std::optional<WebCore::Credential>&& credential) 51 { 52 if (m_completionHandler) 53 m_completionHandler(AuthenticationChallengeDisposition::UseCredential, WTFMove(credential)); 47 54 } 48 55 49 56 void AuthenticationDecisionListener::cancel() 50 57 { 51 if (m_c hallengeProxy)52 m_c hallengeProxy->cancel();58 if (m_completionHandler) 59 m_completionHandler(AuthenticationChallengeDisposition::Cancel, std::nullopt); 53 60 } 54 61 55 62 void AuthenticationDecisionListener::performDefaultHandling() 56 63 { 57 if (m_c hallengeProxy)58 m_c hallengeProxy->performDefaultHandling();64 if (m_completionHandler) 65 m_completionHandler(AuthenticationChallengeDisposition::PerformDefaultHandling, std::nullopt); 59 66 } 60 67 61 68 void AuthenticationDecisionListener::rejectProtectionSpaceAndContinue() 62 69 { 63 if (m_challengeProxy) 64 m_challengeProxy->rejectProtectionSpaceAndContinue(); 65 } 66 67 void AuthenticationDecisionListener::detachChallenge() 68 { 69 m_challengeProxy = 0; 70 if (m_completionHandler) 71 m_completionHandler(AuthenticationChallengeDisposition::RejectProtectionSpaceAndContinue, std::nullopt); 70 72 } 71 73 -
trunk/Source/WebKit/UIProcess/Authentication/AuthenticationDecisionListener.h
r186059 r236153 24 24 */ 25 25 26 #ifndef AuthenticationDecisionListener_h 27 #define AuthenticationDecisionListener_h 26 #pragma once 28 27 29 28 #include "APIObject.h" 30 29 31 #include <wtf/RefPtr.h> 30 #include <WebCore/Credential.h> 31 #include <wtf/CompletionHandler.h> 32 32 33 33 namespace WebKit { 34 34 35 enum class AuthenticationChallengeDisposition; 35 36 class AuthenticationChallengeProxy; 36 class WebCredential;37 37 38 38 class AuthenticationDecisionListener : public API::ObjectImpl<API::Object::Type::AuthenticationDecisionListener> { 39 39 public: 40 static Ref<AuthenticationDecisionListener> create( AuthenticationChallengeProxy* authenticationChallenge)40 static Ref<AuthenticationDecisionListener> create(CompletionHandler<void(AuthenticationChallengeDisposition, std::optional<WebCore::Credential>&&)>&& completionHandler) 41 41 { 42 return adoptRef(*new AuthenticationDecisionListener( authenticationChallenge));42 return adoptRef(*new AuthenticationDecisionListener(WTFMove(completionHandler))); 43 43 } 44 ~AuthenticationDecisionListener(); 44 45 45 void useCredential( WebCredential*);46 void useCredential(std::optional<WebCore::Credential>&&); 46 47 void cancel(); 47 48 void performDefaultHandling(); 48 49 void rejectProtectionSpaceAndContinue(); 49 50 50 void detachChallenge(); 51 private: 52 explicit AuthenticationDecisionListener(CompletionHandler<void(AuthenticationChallengeDisposition, std::optional<WebCore::Credential>&&)>&&); 51 53 52 private: 53 explicit AuthenticationDecisionListener(AuthenticationChallengeProxy*); 54 55 AuthenticationChallengeProxy* m_challengeProxy; 54 CompletionHandler<void(AuthenticationChallengeDisposition, std::optional<WebCore::Credential>&&)> m_completionHandler; 56 55 }; 57 56 58 57 } // namespace WebKit 59 60 #endif // WebAuthenticationDecisionListener_h -
trunk/Source/WebKit/UIProcess/Authentication/cocoa/AuthenticationChallengeProxyCocoa.mm
r232165 r236153 37 37 namespace WebKit { 38 38 39 void AuthenticationChallengeProxy::sendClientCertificateCredentialOverXpc( uint64_t challengeID, const WebCore::Credential& credential) const39 void AuthenticationChallengeProxy::sendClientCertificateCredentialOverXpc(IPC::Connection& connection, SecKeyProxyStore& secKeyProxyStore, uint64_t challengeID, const WebCore::Credential& credential) 40 40 { 41 ASSERT(m_secKeyProxyStore); 42 ASSERT(m_secKeyProxyStore->isInitialized()); 41 ASSERT(secKeyProxyStore.isInitialized()); 43 42 44 43 auto message = adoptOSObject(xpc_dictionary_create(nullptr, nullptr, 0)); 45 44 xpc_dictionary_set_string(message.get(), clientCertificateAuthenticationXPCMessageNameKey, clientCertificateAuthenticationXPCMessageNameValue); 46 45 xpc_dictionary_set_uint64(message.get(), clientCertificateAuthenticationXPCChallengeIDKey, challengeID); 47 xpc_dictionary_set_value(message.get(), clientCertificateAuthenticationXPCSecKeyProxyEndpointKey, m_secKeyProxyStore->get().endpoint._endpoint);46 xpc_dictionary_set_value(message.get(), clientCertificateAuthenticationXPCSecKeyProxyEndpointKey, secKeyProxyStore.get().endpoint._endpoint); 48 47 auto certificateDataArray = adoptOSObject(xpc_array_create(nullptr, 0)); 49 48 for (id certificate in credential.nsCredential().certificates) { … … 54 53 xpc_dictionary_set_uint64(message.get(), clientCertificateAuthenticationXPCPersistenceKey, static_cast<uint64_t>(credential.nsCredential().persistence)); 55 54 56 xpc_connection_send_message( m_connection->xpcConnection(), message.get());55 xpc_connection_send_message(connection.xpcConnection(), message.get()); 57 56 } 58 57 -
trunk/Source/WebKit/UIProcess/Cocoa/DownloadClient.mm
r235935 r236153 123 123 // FIXME: System Preview needs code here. 124 124 if (!m_delegateMethods.downloadDidReceiveAuthenticationChallengeCompletionHandler) { 125 authenticationChallenge.listener() ->performDefaultHandling();125 authenticationChallenge.listener().performDefaultHandling(); 126 126 return; 127 127 } … … 132 132 checker->didCallCompletionHandler(); 133 133 switch (disposition) { 134 case NSURLSessionAuthChallengeUseCredential: { 135 RefPtr<WebCredential> webCredential; 134 case NSURLSessionAuthChallengeUseCredential: 136 135 if (credential) 137 webCredential = WebCredential::create(WebCore::Credential(credential));138 139 authenticationChallenge->listener()->useCredential(webCredential.get());136 authenticationChallenge->listener().useCredential(WebCore::Credential(credential)); 137 else 138 authenticationChallenge->listener().useCredential(std::nullopt); 140 139 break; 141 }142 143 140 case NSURLSessionAuthChallengePerformDefaultHandling: 144 authenticationChallenge->listener() ->performDefaultHandling();141 authenticationChallenge->listener().performDefaultHandling(); 145 142 break; 146 143 147 144 case NSURLSessionAuthChallengeCancelAuthenticationChallenge: 148 authenticationChallenge->listener() ->cancel();145 authenticationChallenge->listener().cancel(); 149 146 break; 150 147 151 148 case NSURLSessionAuthChallengeRejectProtectionSpace: 152 authenticationChallenge->listener() ->rejectProtectionSpaceAndContinue();149 authenticationChallenge->listener().rejectProtectionSpaceAndContinue(); 153 150 break; 154 151 -
trunk/Source/WebKit/UIProcess/Cocoa/NavigationState.mm
r235935 r236153 853 853 { 854 854 if (!m_navigationState.m_navigationDelegateMethods.webViewDidReceiveAuthenticationChallengeCompletionHandler) 855 return authenticationChallenge. performDefaultHandling();856 857 auto navigationDelegate = m_navigationState.m_navigationDelegate.get(); 858 if (!navigationDelegate) 859 return authenticationChallenge. performDefaultHandling();855 return authenticationChallenge.listener().performDefaultHandling(); 856 857 auto navigationDelegate = m_navigationState.m_navigationDelegate.get(); 858 if (!navigationDelegate) 859 return authenticationChallenge.listener().performDefaultHandling(); 860 860 861 861 auto checker = CompletionHandlerCallChecker::create(navigationDelegate.get(), @selector(webView:didReceiveAuthenticationChallenge:completionHandler:)); … … 866 866 867 867 switch (disposition) { 868 case NSURLSessionAuthChallengeUseCredential: { 869 RefPtr<WebCredential> webCredential; 868 case NSURLSessionAuthChallengeUseCredential: 870 869 if (credential) 871 webCredential = WebCredential::create(WebCore::Credential(credential));872 873 challenge->useCredential(webCredential.get());870 challenge->listener().useCredential(Credential(credential)); 871 else 872 challenge->listener().useCredential(std::nullopt); 874 873 break; 875 }876 877 874 case NSURLSessionAuthChallengePerformDefaultHandling: 878 challenge-> performDefaultHandling();875 challenge->listener().performDefaultHandling(); 879 876 break; 880 877 881 878 case NSURLSessionAuthChallengeCancelAuthenticationChallenge: 882 challenge-> cancel();879 challenge->listener().cancel(); 883 880 break; 884 881 885 882 case NSURLSessionAuthChallengeRejectProtectionSpace: 886 challenge-> rejectProtectionSpaceAndContinue();883 challenge->listener().rejectProtectionSpaceAndContinue(); 887 884 break; 888 885 -
trunk/Source/WebKit/UIProcess/Downloads/DownloadProxy.cpp
r235265 r236153 121 121 return; 122 122 123 auto authenticationChallengeProxy = AuthenticationChallengeProxy::create(WTFMove(authenticationChallenge), challengeID, m _processPool->networkingProcessConnection());123 auto authenticationChallengeProxy = AuthenticationChallengeProxy::create(WTFMove(authenticationChallenge), challengeID, makeRef(*m_processPool->networkingProcessConnection()), nullptr); 124 124 125 125 m_processPool->downloadClient().didReceiveAuthenticationChallenge(*m_processPool, *this, authenticationChallengeProxy.get()); -
trunk/Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp
r236035 r236153 295 295 #if ENABLE(SERVICE_WORKER) 296 296 if (auto* serviceWorkerProcessProxy = m_processPool.serviceWorkerProcessProxyFromPageID(pageID)) { 297 auto authenticationChallenge = AuthenticationChallengeProxy::create(WTFMove(coreChallenge), challengeID, connection());297 auto authenticationChallenge = AuthenticationChallengeProxy::create(WTFMove(coreChallenge), challengeID, makeRef(*connection()), nullptr); 298 298 serviceWorkerProcessProxy->didReceiveAuthenticationChallenge(pageID, frameID, WTFMove(authenticationChallenge)); 299 299 return; … … 304 304 MESSAGE_CHECK(page); 305 305 306 auto authenticationChallenge = AuthenticationChallengeProxy::create(WTFMove(coreChallenge), challengeID, connection());306 auto authenticationChallenge = AuthenticationChallengeProxy::create(WTFMove(coreChallenge), challengeID, makeRef(*connection()), page->secKeyProxyStore(coreChallenge)); 307 307 page->didReceiveAuthenticationChallengeProxy(frameID, WTFMove(authenticationChallenge)); 308 308 } -
trunk/Source/WebKit/UIProcess/ServiceWorkerProcessProxy.cpp
r235632 r236153 30 30 31 31 #include "AuthenticationChallengeProxy.h" 32 #include "AuthenticationDecisionListener.h" 32 33 #include "WebCredential.h" 33 34 #include "WebPageGroup.h" … … 98 99 if (protectionSpace.authenticationScheme() == WebCore::ProtectionSpaceAuthenticationSchemeServerTrustEvaluationRequested && processPool().allowsAnySSLCertificateForServiceWorker()) { 99 100 auto credential = WebCore::Credential("accept server trust"_s, emptyString(), WebCore::CredentialPersistenceNone); 100 challenge-> useCredential(WebCredential::create(credential).ptr());101 challenge->listener().useCredential(credential); 101 102 return; 102 103 } 103 104 notImplemented(); 104 challenge-> performDefaultHandling();105 challenge->listener().performDefaultHandling(); 105 106 } 106 107 -
trunk/Source/WebKit/UIProcess/WebPageProxy.cpp
r236146 r236153 6335 6335 #endif 6336 6336 6337 WeakPtr<SecKeyProxyStore> WebPageProxy::secKeyProxyStore(const WebCore::AuthenticationChallenge& challenge) 6338 { 6339 #if HAVE(SEC_KEY_PROXY) 6340 if (challenge.protectionSpace().authenticationScheme() == ProtectionSpaceAuthenticationSchemeClientCertificateRequested) { 6341 auto secKeyProxyStore = SecKeyProxyStore::create(); 6342 auto weakPointer = makeWeakPtr(secKeyProxyStore.get()); 6343 m_websiteDataStore->addSecKeyProxyStore(WTFMove(secKeyProxyStore)); 6344 return weakPointer; 6345 } 6346 #endif 6347 return nullptr; 6348 } 6349 6337 6350 void WebPageProxy::didReceiveAuthenticationChallengeProxy(uint64_t, Ref<AuthenticationChallengeProxy>&& authenticationChallenge) 6338 6351 { 6339 #if HAVE(SEC_KEY_PROXY)6340 ASSERT(authenticationChallenge->protectionSpace());6341 if (authenticationChallenge->protectionSpace()->authenticationScheme() == ProtectionSpaceAuthenticationSchemeClientCertificateRequested) {6342 auto secKeyProxyStore = SecKeyProxyStore::create();6343 authenticationChallenge->setSecKeyProxyStore(secKeyProxyStore);6344 m_websiteDataStore->addSecKeyProxyStore(WTFMove(secKeyProxyStore));6345 }6346 #endif6347 6348 6352 if (m_navigationClient) 6349 6353 m_navigationClient->didReceiveAuthenticationChallenge(*this, authenticationChallenge.get()); 6350 6354 else 6351 authenticationChallenge-> performDefaultHandling();6355 authenticationChallenge->listener().performDefaultHandling(); 6352 6356 } 6353 6357 -
trunk/Source/WebKit/UIProcess/WebPageProxy.h
r236146 r236153 226 226 class RemoteLayerTreeTransaction; 227 227 class RemoteScrollingCoordinatorProxy; 228 class SecKeyProxyStore; 228 229 class UserData; 229 230 class ViewSnapshot; … … 437 438 void initializeWebPage(); 438 439 440 WeakPtr<SecKeyProxyStore> secKeyProxyStore(const WebCore::AuthenticationChallenge&); 441 439 442 void close(); 440 443 bool tryClose();
Note:
See TracChangeset
for help on using the changeset viewer.