Modified: trunk/Source/WebKit/ChangeLog (289435 => 289436)
--- trunk/Source/WebKit/ChangeLog 2022-02-08 22:35:37 UTC (rev 289435)
+++ trunk/Source/WebKit/ChangeLog 2022-02-08 22:43:55 UTC (rev 289436)
@@ -1,3 +1,19 @@
+2022-02-08 J Pascoe <j_pas...@apple.com>
+
+ [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-08 Chris Dumez <cdu...@apple.com>
http/tests/cache-storage/cache-origins.https.html is flaky
Modified: trunk/Source/WebKit/UIProcess/WebAuthentication/Cocoa/WebAuthenticatorCoordinatorProxy.mm (289435 => 289436)
--- trunk/Source/WebKit/UIProcess/WebAuthentication/Cocoa/WebAuthenticatorCoordinatorProxy.mm 2022-02-08 22:35:37 UTC (rev 289435)
+++ trunk/Source/WebKit/UIProcess/WebAuthentication/Cocoa/WebAuthenticatorCoordinatorProxy.mm 2022-02-08 22:43:55 UTC (rev 289436)
@@ -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()];
}