Title: [289551] branches/safari-614.1.3-branch/Source/WebKit
Revision
289551
Author
[email protected]
Date
2022-02-10 10:29:46 -0800 (Thu, 10 Feb 2022)

Log Message

Cherry-pick r289436. rdar://problem/87908259

    [WebAuthn] Use AuthenticationServicesAgent for WebAuthn calls on iOS
    https://bugs.webkit.org/show_bug.cgi?id=236151
    rdar://87908259

    Reviewed by Brent Fulgham.

    This patch starts using the ASC apis to make WebAuthn calls on iOS the
    same way they are made on macOS. Some cleanup work will be needed to
    deprecate the WebAuthn process after this change is made.

    * UIProcess/WebAuthentication/Cocoa/WebAuthenticatorCoordinatorProxy.mm:
    (WebKit::WebAuthenticatorCoordinatorProxy::performRequest): Deleted.
    (WebKit::WebAuthenticatorCoordinatorProxy::isUserVerifyingPlatformAuthenticatorAvailable): Deleted.

    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@289436 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Modified Paths

Diff

Modified: branches/safari-614.1.3-branch/Source/WebKit/ChangeLog (289550 => 289551)


--- branches/safari-614.1.3-branch/Source/WebKit/ChangeLog	2022-02-10 17:54:04 UTC (rev 289550)
+++ branches/safari-614.1.3-branch/Source/WebKit/ChangeLog	2022-02-10 18:29:46 UTC (rev 289551)
@@ -1,3 +1,40 @@
+2022-02-10  Alan Coon  <[email protected]>
+
+        Cherry-pick r289436. rdar://problem/87908259
+
+    [WebAuthn] Use AuthenticationServicesAgent for WebAuthn calls on iOS
+    https://bugs.webkit.org/show_bug.cgi?id=236151
+    rdar://87908259
+    
+    Reviewed by Brent Fulgham.
+    
+    This patch starts using the ASC apis to make WebAuthn calls on iOS the
+    same way they are made on macOS. Some cleanup work will be needed to
+    deprecate the WebAuthn process after this change is made.
+    
+    * UIProcess/WebAuthentication/Cocoa/WebAuthenticatorCoordinatorProxy.mm:
+    (WebKit::WebAuthenticatorCoordinatorProxy::performRequest): Deleted.
+    (WebKit::WebAuthenticatorCoordinatorProxy::isUserVerifyingPlatformAuthenticatorAvailable): Deleted.
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@289436 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2022-02-08  J Pascoe  <[email protected]>
+
+            [WebAuthn] Use AuthenticationServicesAgent for WebAuthn calls on iOS
+            https://bugs.webkit.org/show_bug.cgi?id=236151
+            rdar://87908259
+
+            Reviewed by Brent Fulgham.
+
+            This patch starts using the ASC apis to make WebAuthn calls on iOS the
+            same way they are made on macOS. Some cleanup work will be needed to
+            deprecate the WebAuthn process after this change is made.
+
+            * UIProcess/WebAuthentication/Cocoa/WebAuthenticatorCoordinatorProxy.mm:
+            (WebKit::WebAuthenticatorCoordinatorProxy::performRequest): Deleted.
+            (WebKit::WebAuthenticatorCoordinatorProxy::isUserVerifyingPlatformAuthenticatorAvailable): Deleted.
+
 2022-02-07  Carlos Garcia Campos  <[email protected]>
 
         [WebDriver] Add support for shadow roots

Modified: branches/safari-614.1.3-branch/Source/WebKit/UIProcess/WebAuthentication/Cocoa/WebAuthenticatorCoordinatorProxy.mm (289550 => 289551)


--- branches/safari-614.1.3-branch/Source/WebKit/UIProcess/WebAuthentication/Cocoa/WebAuthenticatorCoordinatorProxy.mm	2022-02-10 17:54:04 UTC (rev 289550)
+++ branches/safari-614.1.3-branch/Source/WebKit/UIProcess/WebAuthentication/Cocoa/WebAuthenticatorCoordinatorProxy.mm	2022-02-10 18:29:46 UTC (rev 289551)
@@ -309,6 +309,10 @@
 {
     auto proxy = adoptNS([allocASCAgentProxyInstance() init]);
 
+#if PLATFORM(IOS)
+    [proxy performAuthorizationRequestsForContext:requestContext.get() withCompletionHandler:makeBlockPtr([handler = WTFMove(handler), proxy = WTFMove(proxy)](id <ASCCredentialProtocol> credential, NSError *error) mutable {
+        callOnMainRunLoop([handler = WTFMove(handler), proxy = WTFMove(proxy), credential = retainPtr(credential), error = retainPtr(error)] () mutable {
+#elif PLATFORM(MAC)
     RetainPtr<NSWindow> window = m_webPageProxy.platformWindow();
     [proxy performAuthorizationRequestsForContext:requestContext.get() withClearanceHandler:makeBlockPtr([weakThis = WeakPtr { *this }, handler = WTFMove(handler), window = WTFMove(window), proxy = WTFMove(proxy)](NSXPCListenerEndpoint *daemonEndpoint, NSError *error) mutable {
         callOnMainRunLoop([weakThis, handler = WTFMove(handler), window = WTFMove(window), proxy = WTFMove(proxy), daemonEndpoint = retainPtr(daemonEndpoint), error = retainPtr(error)] () mutable {
@@ -319,7 +323,10 @@
             }
 
             weakThis->m_presenter = adoptNS([allocASCAuthorizationRemotePresenterInstance() init]);
-            [weakThis->m_presenter presentWithWindow:window.get() daemonEndpoint:daemonEndpoint.get() completionHandler:makeBlockPtr([handler = WTFMove(handler), proxy = WTFMove(proxy)](id <ASCCredentialProtocol> credential, NSError *error) mutable {
+            [weakThis->m_presenter presentWithWindow:window.get() daemonEndpoint:daemonEndpoint.get() completionHandler:makeBlockPtr([handler = WTFMove(handler), proxy = WTFMove(proxy)](id <ASCCredentialProtocol> credentialNotRetain, NSError *errorNotRetain) mutable {
+                auto credential = retainPtr(credentialNotRetain);
+                auto error = retainPtr(errorNotRetain);
+#endif
                 AuthenticatorResponseData response = { };
                 AuthenticatorAttachment attachment;
                 ExceptionData exceptionData = { };
@@ -328,7 +335,7 @@
                     attachment = AuthenticatorAttachment::Platform;
                     response.isAuthenticatorAttestationResponse = true;
 
-                    ASCPlatformPublicKeyCredentialRegistration *registrationCredential = credential;
+                    ASCPlatformPublicKeyCredentialRegistration *registrationCredential = credential.get();
                     response.rawId = toArrayBuffer(registrationCredential.credentialID);
                     response.attestationObject = toArrayBuffer(registrationCredential.attestationObject);
                 } else if ([credential isKindOfClass:getASCSecurityKeyPublicKeyCredentialRegistrationClass()]) {
@@ -335,7 +342,7 @@
                     attachment = AuthenticatorAttachment::CrossPlatform;
                     response.isAuthenticatorAttestationResponse = true;
 
-                    ASCSecurityKeyPublicKeyCredentialRegistration *registrationCredential = credential;
+                    ASCSecurityKeyPublicKeyCredentialRegistration *registrationCredential = credential.get();
                     response.rawId = toArrayBuffer(registrationCredential.credentialID);
                     response.attestationObject = toArrayBuffer(registrationCredential.attestationObject);
                 } else if ([credential isKindOfClass:getASCPlatformPublicKeyCredentialAssertionClass()]) {
@@ -342,7 +349,7 @@
                     attachment = AuthenticatorAttachment::Platform;
                     response.isAuthenticatorAttestationResponse = false;
 
-                    ASCPlatformPublicKeyCredentialAssertion *assertionCredential = credential;
+                    ASCPlatformPublicKeyCredentialAssertion *assertionCredential = credential.get();
                     response.rawId = toArrayBuffer(assertionCredential.credentialID);
                     response.authenticatorData = toArrayBuffer(assertionCredential.authenticatorData);
                     response.signature = toArrayBuffer(assertionCredential.signature);
@@ -351,7 +358,7 @@
                     attachment = AuthenticatorAttachment::CrossPlatform;
                     response.isAuthenticatorAttestationResponse = false;
 
-                    ASCSecurityKeyPublicKeyCredentialAssertion *assertionCredential = credential;
+                    ASCSecurityKeyPublicKeyCredentialAssertion *assertionCredential = credential.get();
                     response.rawId = toArrayBuffer(assertionCredential.credentialID);
                     response.authenticatorData = toArrayBuffer(assertionCredential.authenticatorData);
                     response.signature = toArrayBuffer(assertionCredential.signature);
@@ -360,13 +367,13 @@
                     attachment = (AuthenticatorAttachment) 0;
                     ExceptionCode exceptionCode;
                     NSString *errorMessage = nil;
-                    if ([error.domain isEqualToString:WKErrorDomain]) {
-                        exceptionCode = toExceptionCode(error.code);
-                        errorMessage = error.userInfo[NSLocalizedDescriptionKey];
+                    if ([error.get().domain isEqualToString:WKErrorDomain]) {
+                        exceptionCode = toExceptionCode(error.get().code);
+                        errorMessage = error.get().userInfo[NSLocalizedDescriptionKey];
                     } else {
                         exceptionCode = NotAllowedError;
 
-                        if ([error.domain isEqualToString:ASCAuthorizationErrorDomain] && error.code == ASCAuthorizationErrorUserCanceled)
+                        if ([error.get().domain isEqualToString:ASCAuthorizationErrorDomain] && error.get().code == ASCAuthorizationErrorUserCanceled)
                             errorMessage = @"This request has been cancelled by the user.";
                         else
                             errorMessage = @"Operation failed.";
@@ -376,7 +383,9 @@
                 }
 
                 handler(response, attachment, exceptionData);
+#if PLATFORM(MAC)
             }).get()];
+#endif
         });
     }).get()];
 }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to