Changeset 270730 in webkit
- Timestamp:
- Dec 11, 2020 9:19:32 PM (3 years ago)
- Location:
- trunk/Source
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r270729 r270730 1 2020-12-11 Jiewen Tan <jiewen_tan@apple.com> 2 3 [WebAuthn] Adopt new UI for the Platform Authenticator getAssertion flow 4 https://bugs.webkit.org/show_bug.cgi?id=219710 5 <rdar://problem/72154800> 6 7 Reviewed by Brent Fulgham. 8 9 Covered by manual tests. 10 11 * Modules/webauthn/AuthenticatorAssertionResponse.h: 12 (WebCore::AuthenticatorAssertionResponse::laContext const): 13 (WebCore::AuthenticatorAssertionResponse::setLAContext): 14 1 15 2020-12-11 Megan Gardner <megan_gardner@apple.com> 2 16 -
trunk/Source/WebCore/Modules/webauthn/AuthenticatorAssertionResponse.h
r258293 r270730 32 32 #include <wtf/spi/cocoa/SecuritySPI.h> 33 33 34 OBJC_CLASS LAContext; 35 34 36 namespace WebCore { 35 37 … … 48 50 size_t numberOfCredentials() const { return m_numberOfCredentials; } 49 51 SecAccessControlRef accessControl() const { return m_accessControl.get(); } 52 LAContext * laContext() const { return m_laContext.get(); } 50 53 51 54 WEBCORE_EXPORT void setAuthenticatorData(Vector<uint8_t>&&); … … 54 57 void setDisplayName(const String& displayName) { m_displayName = displayName; } 55 58 void setNumberOfCredentials(size_t numberOfCredentials) { m_numberOfCredentials = numberOfCredentials; } 59 void setLAContext(LAContext *context) { m_laContext = context; } 56 60 57 61 private: … … 70 74 size_t m_numberOfCredentials { 0 }; 71 75 RetainPtr<SecAccessControlRef> m_accessControl; 76 RetainPtr<LAContext> m_laContext; 72 77 }; 73 78 -
trunk/Source/WebKit/ChangeLog
r270726 r270730 1 2020-12-11 Jiewen Tan <jiewen_tan@apple.com> 2 3 [WebAuthn] Adopt new UI for the Platform Authenticator getAssertion flow 4 https://bugs.webkit.org/show_bug.cgi?id=219710 5 <rdar://problem/72154800> 6 7 Reviewed by Brent Fulgham. 8 9 This patch adopts the new UI for the platform authenticator getAssertion flow. It's more or less 10 the same as the security key one except an LAContext will be passed in from the UI. Now LocalAuthenticator 11 will just utilize the LAContext from the UI. 12 13 * UIProcess/WebAuthentication/Cocoa/AuthenticatorPresenterCoordinator.h: 14 * UIProcess/WebAuthentication/Cocoa/AuthenticatorPresenterCoordinator.mm: 15 (WebKit::AuthenticatorPresenterCoordinator::AuthenticatorPresenterCoordinator): 16 (WebKit::AuthenticatorPresenterCoordinator::~AuthenticatorPresenterCoordinator): 17 (WebKit::AuthenticatorPresenterCoordinator::selectAssertionResponse): 18 (WebKit::AuthenticatorPresenterCoordinator::didSelectAssertionResponse): 19 * UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm: 20 (WebKit::LocalAuthenticator::continueGetAssertionAfterResponseSelected): 21 * UIProcess/WebAuthentication/Cocoa/WKASCAuthorizationPresenterDelegate.mm: 22 (-[WKASCAuthorizationPresenterDelegate authorizationPresenter:credentialRequestedForLoginChoice:authenticatedContext:completionHandler:]): 23 1 24 2020-12-11 John Wilander <wilander@apple.com> 2 25 -
trunk/Source/WebKit/UIProcess/WebAuthentication/Cocoa/AuthenticatorPresenterCoordinator.h
r270724 r270730 36 36 #include <wtf/WeakPtr.h> 37 37 38 OBJC_CLASS ASCAuthorizationPresentationContext; 38 39 OBJC_CLASS ASCAuthorizationPresenter; 39 40 OBJC_CLASS ASCLoginChoiceProtocol; 40 41 OBJC_CLASS LAContext; 41 42 OBJC_CLASS WKASCAuthorizationPresenterDelegate; 42 43 namespace WebCore {44 class AuthenticatorAssertionResponse;45 }46 43 47 44 namespace WebKit { … … 57 54 58 55 AuthenticatorPresenterCoordinator(const AuthenticatorManager&, const String& rpId, const TransportSet&, WebCore::ClientDataType); 56 ~AuthenticatorPresenterCoordinator(); 59 57 60 58 void updatePresenter(WebAuthenticationStatus); … … 67 65 void setLAContext(LAContext *); 68 66 69 void didSelectAssertionResponse(ASCLoginChoiceProtocol * );67 void didSelectAssertionResponse(ASCLoginChoiceProtocol *, LAContext *); 70 68 71 69 private: 72 70 WeakPtr<AuthenticatorManager> m_manager; 71 RetainPtr<ASCAuthorizationPresentationContext> m_context; 73 72 RetainPtr<ASCAuthorizationPresenter> m_presenter; 74 73 RetainPtr<WKASCAuthorizationPresenterDelegate> m_presenterDelegate; -
trunk/Source/WebKit/UIProcess/WebAuthentication/Cocoa/AuthenticatorPresenterCoordinator.mm
r270724 r270730 42 42 { 43 43 #if HAVE(ASC_AUTH_UI) 44 auto presentationContext = adoptNS([allocASCAuthorizationPresentationContextInstance() initWithRequestContext:nullptr appIdentifier:nullptr]);44 m_context = adoptNS([allocASCAuthorizationPresentationContextInstance() initWithRequestContext:nullptr appIdentifier:nullptr]); 45 45 if ([getASCAuthorizationPresentationContextClass() instancesRespondToSelector:@selector(setServiceName:)]) 46 [ presentationContext setServiceName:rpId];46 [m_context setServiceName:rpId]; 47 47 48 48 switch (type) { 49 49 case ClientDataType::Create: 50 50 if (transports.contains(AuthenticatorTransport::Internal)) 51 [ presentationContext addLoginChoice:adoptNS([allocASCPlatformPublicKeyCredentialLoginChoiceInstance() initRegistrationChoice]).get()];51 [m_context addLoginChoice:adoptNS([allocASCPlatformPublicKeyCredentialLoginChoiceInstance() initRegistrationChoice]).get()]; 52 52 if (transports.contains(AuthenticatorTransport::Usb) || transports.contains(AuthenticatorTransport::Nfc)) 53 [ presentationContext addLoginChoice:adoptNS([allocASCSecurityKeyPublicKeyCredentialLoginChoiceInstance() initRegistrationChoice]).get()];53 [m_context addLoginChoice:adoptNS([allocASCSecurityKeyPublicKeyCredentialLoginChoiceInstance() initRegistrationChoice]).get()]; 54 54 break; 55 55 case ClientDataType::Get: 56 56 if (transports.contains(AuthenticatorTransport::Usb) || transports.contains(AuthenticatorTransport::Nfc)) 57 [ presentationContext addLoginChoice:adoptNS([allocASCSecurityKeyPublicKeyCredentialLoginChoiceInstance() initAssertionPlaceholderChoice]).get()];57 [m_context addLoginChoice:adoptNS([allocASCSecurityKeyPublicKeyCredentialLoginChoiceInstance() initAssertionPlaceholderChoice]).get()]; 58 58 break; 59 59 default: … … 77 77 }); 78 78 }); 79 [m_presenter presentAuthorizationWithContext: presentationContext.get() completionHandler:completionHandler.get()];79 [m_presenter presentAuthorizationWithContext:m_context.get() completionHandler:completionHandler.get()]; 80 80 #endif // HAVE(ASC_AUTH_UI) 81 } 82 83 AuthenticatorPresenterCoordinator::~AuthenticatorPresenterCoordinator() 84 { 85 if (m_laContextHandler) 86 m_laContextHandler(nullptr); 87 if (m_responseHandler) 88 m_responseHandler(nullptr); 81 89 } 82 90 … … 115 123 return; 116 124 } 117 // FIXME(219710): Adopt new UI for the Platform Authenticator getAssertion flow. 125 126 if (source == WebAuthenticationSource::Local) { 127 auto loginChoices = adoptNS([[NSMutableArray alloc] init]); 128 129 for (auto& response : responses) { 130 RetainPtr<NSData> userHandle; 131 if (response->userHandle()) 132 userHandle = adoptNS([[NSData alloc] initWithBytes:response->userHandle()->data() length:response->userHandle()->byteLength()]); 133 134 auto loginChoice = adoptNS([allocASCPlatformPublicKeyCredentialLoginChoiceInstance() initWithName:response->name() displayName:response->displayName() userHandle:userHandle.get()]); 135 [loginChoices addObject:loginChoice.get()]; 136 137 m_credentials.add((ASCLoginChoiceProtocol *)loginChoice.get(), WTFMove(response)); 138 } 139 140 [loginChoices addObjectsFromArray:[m_context loginChoices]]; // Adds the security key option if exists. 141 [m_presenter updateInterfaceWithLoginChoices:loginChoices.get()]; 142 return; 143 } 118 144 #endif // HAVE(ASC_AUTH_UI) 119 145 } … … 148 174 } 149 175 150 void AuthenticatorPresenterCoordinator::didSelectAssertionResponse(ASCLoginChoiceProtocol *loginChoice )176 void AuthenticatorPresenterCoordinator::didSelectAssertionResponse(ASCLoginChoiceProtocol *loginChoice, LAContext *context) 151 177 { 152 178 auto response = m_credentials.take(loginChoice); 153 179 if (!response) 154 180 return; 181 182 if (context) 183 response->setLAContext(context); 155 184 156 185 m_responseHandler(response.get()); -
trunk/Source/WebKit/UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm
r270694 r270730 532 532 m_state = State::ResponseSelected; 533 533 534 if (webAuthenticationModernEnabled()) { 535 auto accessControlRef = response->accessControl(); 536 LAContext *context = response->laContext(); 537 auto callback = [ 538 weakThis = makeWeakPtr(*this), 539 response = WTFMove(response) 540 ] (LocalConnection::UserVerification verification) mutable { 541 ASSERT(RunLoop::isMain()); 542 if (!weakThis) 543 return; 544 545 weakThis->continueGetAssertionAfterUserVerification(WTFMove(response), verification, response->laContext()); 546 }; 547 548 m_connection->verifyUser(accessControlRef, context, WTFMove(callback)); 549 return; 550 } 551 534 552 auto& requestOptions = WTF::get<PublicKeyCredentialRequestOptions>(requestData().options); 535 553 -
trunk/Source/WebKit/UIProcess/WebAuthentication/Cocoa/WKASCAuthorizationPresenterDelegate.mm
r270724 r270730 65 65 return; 66 66 } 67 68 if (![(ASCPlatformPublicKeyCredentialLoginChoice *)loginChoice isRegistrationRequest]) { 69 [self dispatchCoordinatorCallback:[loginChoice, context = retainPtr(context)] (WebKit::AuthenticatorPresenterCoordinator& coordinator) mutable { 70 coordinator.didSelectAssertionResponse((ASCLoginChoiceProtocol *)loginChoice, context.get()); 71 }]; 72 73 return; 74 } 67 75 } 68 76 … … 70 78 if ([(ASCSecurityKeyPublicKeyCredentialLoginChoice *)loginChoice loginChoiceKind] == ASCSecurityKeyPublicKeyCredentialLoginChoiceKindAssertion) { 71 79 [self dispatchCoordinatorCallback:[loginChoice] (WebKit::AuthenticatorPresenterCoordinator& coordinator) mutable { 72 coordinator.didSelectAssertionResponse((ASCLoginChoiceProtocol *)loginChoice );80 coordinator.didSelectAssertionResponse((ASCLoginChoiceProtocol *)loginChoice, nil); 73 81 }]; 74 82
Note: See TracChangeset
for help on using the changeset viewer.