Bug 189277 - [WebAuthN] Polish AuthenticatorManager and rename it to AuthenticatorCoordinator
Summary: [WebAuthN] Polish AuthenticatorManager and rename it to AuthenticatorCoordinator
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Jiewen Tan
URL:
Keywords: InRadar
Depends on:
Blocks: 181943
  Show dependency treegraph
 
Reported: 2018-09-04 15:39 PDT by Jiewen Tan
Modified: 2018-09-11 10:56 PDT (History)
11 users (show)

See Also:


Attachments
Patch (271.53 KB, patch)
2018-09-08 17:09 PDT, Jiewen Tan
no flags Details | Formatted Diff | Diff
Patch (271.05 KB, patch)
2018-09-08 20:21 PDT, Jiewen Tan
no flags Details | Formatted Diff | Diff
Patch (271.34 KB, patch)
2018-09-10 11:11 PDT, Jiewen Tan
cdumez: review+
Details | Formatted Diff | Diff
Patch for landing (271.29 KB, patch)
2018-09-10 15:29 PDT, Jiewen Tan
no flags Details | Formatted Diff | Diff
Patch for landing (271.93 KB, patch)
2018-09-10 16:00 PDT, Jiewen Tan
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jiewen Tan 2018-09-04 15:39:40 PDT
This task aims to polish AuthenticatorManager such that:
1) it is no longer a singleton. Instead, it will live with Page. It was a singleton simply because static PublicKeyCredential::isUserVerifyingPlatformAuthenticatorAvailable() have to access it. However, the issue can be solved by adding an attribute [CallWith=Document]. Therefore, there is no such need. Also, the singleton is illy implemented as it also owns a single IPC proxy to UI Process which means different web pages will talk to the same web page proxy. Anyway, making it live with Page should solve the problem.
2) Since we are now planning to support external authenticators, the manager of all authenticators will then have to live in UI Process which makes this AuthenticatorManager obsolete. Instead, rename it to AuthenticatorCoordinator.
3) Rename CredentialsMessenger to AuthenticatorCoordinatorClient to tight it to WebAuthN. Also, simplify the message reply model as PublicKeyCredentialCreationOptions/PublicKeyCredentialRequestOptions => ExceptionData/PublicKeyCredential for makeCredential/getAssertion operations.
Comment 1 Radar WebKit Bug Importer 2018-09-04 15:40:29 PDT
<rdar://problem/44115936>
Comment 2 Jiewen Tan 2018-09-08 17:09:32 PDT
Created attachment 349266 [details]
Patch
Comment 3 Jiewen Tan 2018-09-08 20:21:10 PDT
Created attachment 349274 [details]
Patch
Comment 4 Jiewen Tan 2018-09-10 11:11:33 PDT
Created attachment 349318 [details]
Patch
Comment 5 Chris Dumez 2018-09-10 12:35:41 PDT
Comment on attachment 349318 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=349318&action=review

r=me with suggestions.

> Source/WebCore/Modules/webauthn/PublicKeyCredentialCreationOptions.h:98
> +    encoder.encodeFixedLengthData(reinterpret_cast<const uint8_t*>(user.id.data()), user.id.length(), 1);

Why do we need the reinterpret_cast here?

Also, it seems like this could construct a temporary IPC::DataReference and encode that.

> Source/WebCore/page/Page.h:910
> +    std::unique_ptr<AuthenticatorCoordinator> m_authenticatorCoordinator;

Could this be a UniqueRef instead of a unique_ptr? It seems it cannot be null.
Comment 6 Jiewen Tan 2018-09-10 14:06:58 PDT
Comment on attachment 349318 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=349318&action=review

Thanks Chris for r+ this patch.

>> Source/WebCore/Modules/webauthn/PublicKeyCredentialCreationOptions.h:98
>> +    encoder.encodeFixedLengthData(reinterpret_cast<const uint8_t*>(user.id.data()), user.id.length(), 1);
> 
> Why do we need the reinterpret_cast here?
> 
> Also, it seems like this could construct a temporary IPC::DataReference and encode that.

It doesn't need to. IPC::DataReference is in WebKit so I could't use it in WebCore.

>> Source/WebCore/page/Page.h:910
>> +    std::unique_ptr<AuthenticatorCoordinator> m_authenticatorCoordinator;
> 
> Could this be a UniqueRef instead of a unique_ptr? It seems it cannot be null.

Sure, I was not aware of UniqueRef.
Comment 7 Jiewen Tan 2018-09-10 15:29:20 PDT
Created attachment 349336 [details]
Patch for landing
Comment 8 Jiewen Tan 2018-09-10 16:00:01 PDT
Created attachment 349347 [details]
Patch for landing
Comment 9 Jiewen Tan 2018-09-10 16:01:42 PDT
Comment on attachment 349347 [details]
Patch for landing

Added #include <JavaScriptCore/HeapInlines.h> to VRStageParameters.cpp to resolve the Win EWS bots linker error.
Comment 10 WebKit Commit Bot 2018-09-11 00:59:28 PDT
Comment on attachment 349347 [details]
Patch for landing

Clearing flags on attachment: 349347

Committed r235888: <https://trac.webkit.org/changeset/235888>
Comment 11 Jiewen Tan 2018-09-11 10:56:47 PDT
Build fix:
Committed r235900: <https://trac.webkit.org/changeset/235900>