Skip to content

Commit 3001dc4

Browse files
committed
[WIP] Add requestUserInfo
This patch adds `requestUserInfo` to `PublicKeyCredentialUserEntity`. This allows a relying party to request user identifiers and attributes alongside a WebAuthn credential on `create()` to aid with account creation. Fixes 2336.
1 parent 3006eff commit 3001dc4

File tree

1 file changed

+160
-10
lines changed

1 file changed

+160
-10
lines changed

index.bs

Lines changed: 160 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@ spec: html; urlPrefix: https://html.spec.whatwg.org/multipage/
165165
text: origin; url: concept-origin
166166
text: document.domain; url:dom-document-domain
167167
urlPrefix: form-control-infrastructure.html
168+
text: autofill; url: autofill
168169
text: autofill detail token; url: autofill-detail-tokens
169170
text: non-autofill credential type; url: non-autofill-credential-type
170171

@@ -173,6 +174,13 @@ spec: url; urlPrefix: https://url.spec.whatwg.org
173174
text: scheme; url: concept-url-scheme
174175
text: port; url: concept-url-port
175176

177+
spec: string-meta; urlPrefix: https://www.w3.org/TR/string-meta/
178+
type: dictionary
179+
text: Localizable; url: Localizable
180+
type: attribute
181+
text: dir; url: dom-localizable-dir; for: Localizable
182+
text: language; url: dom-localizable-language; for: Localizable
183+
text: value; url: dom-localizable-value; for: Localizable
176184

177185
spec: TokenBinding; urlPrefix: https://tools.ietf.org/html/rfc8471#
178186
type: dfn
@@ -1479,6 +1487,7 @@ that are returned to the caller when a new credential is created, or a new asser
14791487
[SameObject] readonly attribute AuthenticatorResponse response;
14801488
readonly attribute DOMString? authenticatorAttachment;
14811489
AuthenticationExtensionsClientOutputs getClientExtensionResults();
1490+
PublicKeyCredentialUserInfo getUserInfo();
14821491
static Promise<boolean> isConditionalMediationAvailable();
14831492
PublicKeyCredentialJSON toJSON();
14841493
};
@@ -1517,14 +1526,16 @@ that are returned to the caller when a new credential is created, or a new asser
15171526
but later receive updates to support [=cross-platform attachment=] as well.
15181527
</div>
15191528

1520-
1521-
1522-
15231529
: {{PublicKeyCredential/getClientExtensionResults()}}
15241530
:: This operation returns the value of {{PublicKeyCredential/[[clientExtensionsResults]]}}, which is a [=map=] containing
15251531
[=extension identifier=] → [=client extension output=] entries produced by the extension's
15261532
[=client extension processing=].
15271533

1534+
: {{PublicKeyCredential/getUserInfo()}}
1535+
:: This operation returns the value of {{PublicKeyCredential/[[userInfo]]}},
1536+
which is a {{PublicKeyCredentialUserInfo}} dictionary containing [=user information=]
1537+
requested by the [=[RP]=]. If [=user information=] was not requested, returns `undefined`.
1538+
15281539
: {{PublicKeyCredential/isConditionalMediationAvailable()}}
15291540
:: {{PublicKeyCredential}} overrides this method to indicate availability for {{CredentialMediationRequirement/conditional}}
15301541
mediation during {{CredentialsContainer/get()|navigator.credentials.get()}}. [=[WRPS]=] SHOULD verify availability before
@@ -1649,6 +1660,10 @@ that are returned to the caller when a new credential is created, or a new asser
16491660
:: This [=internal slot=] contains the results of processing client extensions requested by the [=[RP]=] upon the
16501661
[=[RP]=]'s invocation of either {{CredentialsContainer/create()|navigator.credentials.create()}} or
16511662
{{CredentialsContainer/get()|navigator.credentials.get()}}.
1663+
1664+
: <dfn>\[[userInfo]]</dfn>
1665+
:: This [=internal slot=] contains the [=user information=] requested by the [=[RP]=].
1666+
If [=user information=] was not requested, contains the value is not present.
16521667
</dl>
16531668

16541669
{{PublicKeyCredential}}'s [=interface object=] inherits {{Credential}}'s implementation of
@@ -1748,12 +1763,14 @@ When this method is invoked, the user agent MUST execute the following algorithm
17481763

17491764
1. Throw a "{{NotAllowedError}}" {{DOMException}}.
17501765

1751-
1. [=Consume user activation=] of the [=relevant global object=].
1752-
17531766
1. If the [=origin=] that is creating a credential is different from the [=top-level origin=] of the [=relevant global object=]
17541767
(i.e., is a different origin than the user can see in the address bar),
17551768
the [=client=] SHOULD make this fact clear to the user.
17561769

1770+
1. If <var ignore>sameOriginWithAncestors</var> is [FALSE]
1771+
or <code>|options|.{{PublicKeyCredentialCreationOptions/user}}.{{PublicKeyCredentialUserEntity/requestUserInfo}}</code> is present,
1772+
[=consume user activation=] of the [=relevant global object=].
1773+
17571774
1. Let |pkOptions| be the value of <code>|options|.{{CredentialCreationOptions/publicKey}}</code>.
17581775

17591776
1. If <code>|pkOptions|.{{PublicKeyCredentialCreationOptions/timeout}}</code> is present, check if its value lies within a
@@ -1897,6 +1914,24 @@ a numbered step. If outdented, it (today) is rendered as a bullet in the midst o
18971914
been completed. That authentication ceremony MAY be performed via other means than the
18981915
[=Web Authentication API=].
18991916

1917+
1. If <code>|options|.{{PublicKeyCredentialCreationOptions/user}}.{{PublicKeyCredentialUserEntity/requestUserInfo}}</code>
1918+
is present:
1919+
1920+
1. Prompt the user for the requested [=user information=] in such a way that the user selects a single [=user information/identifier type=]
1921+
and its value, and fills in all requested [=user information/attributes=].
1922+
1. Let |userInfo| be a {{PublicKeyCredentialUserInfo}} dictionary.
1923+
1. Set <code>|userInfo|.{{PublicKeyCredentialUserInfo/identifier}}.{{PublicKeyCredentialUserInfoIdentifier/type}}</code>
1924+
to the [=user information/identifier type=] selected by the user.
1925+
1. Set <code>|userInfo|.{{PublicKeyCredentialUserInfo/identifier}}.{{PublicKeyCredentialUserInfoIdentifier/value}}</code>
1926+
to the [=user information/identifier=] filled by the user.
1927+
1. For every [=user information/attribute type=] |attribute| in <code>|options|.{{PublicKeyCredentialCreationOptions/user}}.{{PublicKeyCredentialUserEntity/requestUserInfo}}.{{PublicKeyCredentialRequestUserInfo/attributes}}</code>
1928+
that is understood by the user agent:
1929+
1. Set <code>|userInfo|.{{PublicKeyCredentialUserInfo/attributes}}[|attribute|].{{Localizable/value}}</code>
1930+
to the [=user information/attribute=] filled by the user.
1931+
1. Set <code>|userInfo|.{{PublicKeyCredentialUserInfo/attributes}}[|attribute|].{{Localizable/language}}</code>
1932+
and <code>|userInfo|.{{PublicKeyCredentialUserInfo/attributes}}[|attribute|].{{Localizable/dir}}</code>
1933+
according to the user agent language settings or other relevant information.
1934+
19001935
1. Consider the value of {{PublicKeyCredentialCreationOptions/hints}} and craft the user interface accordingly, as the user-agent sees fit.
19011936

19021937
1. Start |lifetimeTimer|.
@@ -2171,6 +2206,9 @@ a numbered step. If outdented, it (today) is rendered as a bullet in the midst o
21712206
:: A new {{ArrayBuffer}}, created using |global|'s [=%ArrayBuffer%=], containing the bytes of
21722207
<code>|credentialCreationData|.[=credentialCreationData/clientExtensionResults=]</code>.
21732208

2209+
: {{PublicKeyCredential/[[userInfo]]}}
2210+
:: |userInfo|
2211+
21742212
1. Return |pubKeyCred|.
21752213

21762214
1. [=set/For each=] remaining |authenticator| in |issuedRequests| invoke the [=authenticatorCancel=] operation on
@@ -3629,8 +3667,9 @@ credential.
36293667

36303668
<xmp class="idl">
36313669
dictionary PublicKeyCredentialUserEntity : PublicKeyCredentialEntity {
3632-
required BufferSource id;
3633-
required DOMString displayName;
3670+
required BufferSource id;
3671+
required DOMString displayName;
3672+
PublicKeyCredentialRequestUserInfo requestUserInfo;
36343673
};
36353674
</xmp>
36363675

@@ -3675,8 +3714,11 @@ credential.
36753714
When storing a {{PublicKeyCredentialUserEntity/displayName}} member's value,
36763715
the value MAY be truncated as described in [[#sctn-strings-truncation]]
36773716
using a size limit greater than or equal to 64 bytes.
3678-
</div>
36793717

3718+
: <dfn>requestUserInfo</dfn>
3719+
:: An OPTIONAL {{PublicKeyCredentialRequestUserInfo}} dictionary indicating that the [=[RP]=] requests [=user information=]
3720+
to be returned with the {{PublicKeyCredential}} for the purposes of creating a new [=user account=].
3721+
</div>
36803722

36813723
### Authenticator Selection Criteria (dictionary <dfn dictionary>AuthenticatorSelectionCriteria</dfn>) ### {#dictionary-authenticatorSelection}
36823724

@@ -3839,6 +3881,107 @@ Note: The {{AttestationConveyancePreference}} enumeration is deliberately not re
38393881
If permitted, the user agent SHOULD signal to the authenticator (at [invocation time](#CreateCred-InvokeAuthnrMakeCred)) that enterprise attestation is requested, and convey the resulting [=/AAGUID=] and [=attestation statement=], unaltered, to the [=[RP]=].
38403882
</div>
38413883

3884+
### Request User Information ### {#dictionary-requestUserInfo}
3885+
3886+
[=[WRPS]=] may use the {{PublicKeyCredentialRequestUserInfo}} dictionary to request [=user information=]
3887+
to be returned as part of the {{CredentialsContainer/create()}} request.
3888+
3889+
<dfn>User information</dfn> that may be requested consists of:
3890+
3891+
<dl dfn-type="dfn" dfn-for="user information">
3892+
: <dfn>Identifier</dfn>
3893+
:: A single string that can be used to uniquely identify a [=user account=],
3894+
and whose value will be used as the credential's {{PublicKeyCredentialEntity/name}}
3895+
and {{PublicKeyCredentialUserEntity/displayName}}.
3896+
3897+
Valid <dfn>identifier types</dfn> are:
3898+
* `"email"`: an email address, such as "[email protected]".
3899+
* `"phone"`: a full telephone number, including country code, such as "+1 617 253 5702".
3900+
: <dfn>Attributes</dfn>
3901+
:: A set of attributes about a user that are required when creating a [=user account=].
3902+
3903+
Valid <dfn>attribute types</dfn> are:
3904+
* `"name"`: a user's name, such as "Alex Müller".
3905+
</dl>
3906+
3907+
To request [=user information=], the [=[RP]=] specifies the [=user information/identifier types=]
3908+
and [=user information/attribute types=] it accepts:
3909+
3910+
<xmp class="idl">
3911+
dictionary PublicKeyCredentialRequestUserInfo {
3912+
required sequence<DOMString> identifiers;
3913+
sequence<DOMString> attributes = [];
3914+
};
3915+
</xmp>
3916+
3917+
<dl dfn-type="attribute" dfn-for="PublicKeyCredentialRequestUserInfo">
3918+
: {{PublicKeyCredentialRequestUserInfo/identifiers}}
3919+
:: The [=list=] of [=user information/identifier types=] accepted by the [=[RP]=] to create a [=user account=].
3920+
The [=[RP]=] can request multiple [=user information/identifier=] types
3921+
to indicate any of them may be accepted. However, only one [=user information/identifier=] is returned.
3922+
The [=client=] selects the [=user information/identifier=] type to return depending on user preference or other factors.
3923+
[=[WRPS]=] SHOULD pass the list of [=user information/identifiers=] in order of preference as a hint to [=clients=].
3924+
3925+
The credential's {{PublicKeyCredentialEntity/name}} and {{PublicKeyCredentialUserEntity/displayName}}
3926+
will be overridden by the value of the chosen [=user information/identifier=].
3927+
[=[WRPS]=] SHOULD pass an empty {{PublicKeyCredentialEntity/name}}
3928+
and {{PublicKeyCredentialUserEntity/displayName}} when using this option.
3929+
3930+
: {{PublicKeyCredentialRequestUserInfo/attributes}}
3931+
:: An OPTIONAL [=list=] of [=user information/attribute types=] required to create a [=user account=].
3932+
</dl>
3933+
3934+
[=user information/Identifiers=] and [=user information/attributes=] which are not recognized are ignored by the [=client=].
3935+
3936+
Note: Unlike regular {{CredentialsContainer/create()}} operations, requesting [=user information=]
3937+
[=consumes user activation=].
3938+
3939+
[=User information=] is returned to the [=[RP]=] in a {{PublicKeyCredentialUserInfo}} dictionary:
3940+
3941+
<xmp class="idl">
3942+
dictionary PublicKeyCredentialUserInfo {
3943+
required PublicKeyCredentialUserInfoIdentifier identifier;
3944+
required record<DOMString, PublicKeyCredentialUserInfoAttribute> attributes;
3945+
};
3946+
</xmp>
3947+
3948+
<dl dfn-type="attribute" dfn-for="PublicKeyCredentialUserInfo">
3949+
: {{PublicKeyCredentialUserInfo/identifier}}
3950+
:: The [=user information/identifier=] value claimed by the user.
3951+
: {{PublicKeyCredentialUserInfo/attributes}}
3952+
:: A [=map=] of [=user information/attribute types=] to values claimed by the user.
3953+
[=map/Keys=] MUST be present in the [=user information/attribute types=] requested by the [=[RP]=].
3954+
</dl>
3955+
3956+
<xmp class="idl">
3957+
dictionary PublicKeyCredentialUserInfoIdentifier {
3958+
required DOMString type;
3959+
required DOMString value;
3960+
};
3961+
</xmp>
3962+
3963+
<dl dfn-type="attribute" dfn-for="PublicKeyCredentialUserInfoIdentifier">
3964+
: {{PublicKeyCredentialUserInfoIdentifier/type}}
3965+
:: The type of [=user information/identifier=].
3966+
This MUST be one of the [=user information/identifier types=] requested by the [=[RP]=].
3967+
: {{PublicKeyCredentialUserInfoIdentifier/value}}
3968+
:: The value of the [=user information/identifier=] claimed by the user.
3969+
</dl>
3970+
3971+
<xmp class="idl">
3972+
dictionary PublicKeyCredentialUserInfoAttribute : Localizable {
3973+
};
3974+
</xmp>
3975+
3976+
<dl dfn-type="attribute" dfn-for="PublicKeyCredentialUserInfoAttribute">
3977+
: {{Localizable/value}}
3978+
:: The value of the [=user information/attribute=] claimed by the user
3979+
for the corresponding {{PublicKeyCredentialUserInfo/attributes}} key.
3980+
</dl>
3981+
3982+
The [=client=] MAY obtain [=user information=] from sources such as [=autofill=].
3983+
However, the [=client=] MUST allow the user to manually set any [=user information/identifier=]
3984+
and [=user information/attribute=] values.
38423985

38433986
## Options for Assertion Generation (dictionary <dfn dictionary>PublicKeyCredentialRequestOptions</dfn>) ## {#dictionary-assertion-options}
38443987

@@ -8571,9 +8714,16 @@ possible for [=[RPS]=] to trust any further [=attestation statements=] from the
85718714

85728715
See also the related security consideration for [=[RPS]=] in [[#sctn-revoked-attestation-certificates]].
85738716

8574-
<!-- no sec cons for clients enumerated at this time
85758717
## Security considerations for [=clients=] ## {#sctn-security-considerations-client}
8576-
-->
8718+
8719+
### [=UI redressing=] when requesting [=user information=] {#sctn-seccons-ui-redressing-request-user-info}
8720+
8721+
When a [=[RP]=] requests [=user information=] as part of a {{CredentialsContainer/create()}} request,
8722+
the user agent may offer prefilled default values for the requested [=user information/identifiers=]
8723+
and [=user information/attributes=], similar to [=autofill=].
8724+
It's important that [=clients=] consider the risk of [=UI redressing=]
8725+
and take appropriate measures to prevent malicious [=[WRPS]=] from obtaining [=user information=]
8726+
without the user's consent.
85778727

85788728
## Security considerations for [=[RPS]=] ## {#sctn-security-considerations-rp}
85798729

0 commit comments

Comments
 (0)