Skip to content

Commit ddffc4d

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 ddffc4d

File tree

1 file changed

+132
-10
lines changed

1 file changed

+132
-10
lines changed

index.bs

Lines changed: 132 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,11 @@ 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: value; url: dom-localizable-value; for: Localizable
176182

177183
spec: TokenBinding; urlPrefix: https://tools.ietf.org/html/rfc8471#
178184
type: dfn
@@ -1479,6 +1485,7 @@ that are returned to the caller when a new credential is created, or a new asser
14791485
[SameObject] readonly attribute AuthenticatorResponse response;
14801486
readonly attribute DOMString? authenticatorAttachment;
14811487
AuthenticationExtensionsClientOutputs getClientExtensionResults();
1488+
PublicKeyCredentialUserInfo getUserInfo();
14821489
static Promise<boolean> isConditionalMediationAvailable();
14831490
PublicKeyCredentialJSON toJSON();
14841491
};
@@ -1517,14 +1524,15 @@ that are returned to the caller when a new credential is created, or a new asser
15171524
but later receive updates to support [=cross-platform attachment=] as well.
15181525
</div>
15191526

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

1532+
: {{PublicKeyCredential/getUserInfo()}}
1533+
:: This operation returns a {{PublicKeyCredentialUserInfo}} dictionary containing [=user information=]
1534+
requested by the [=[RP]=]. If [=user information=] was not requested, returns `undefined`.
1535+
15281536
: {{PublicKeyCredential/isConditionalMediationAvailable()}}
15291537
:: {{PublicKeyCredential}} overrides this method to indicate availability for {{CredentialMediationRequirement/conditional}}
15301538
mediation during {{CredentialsContainer/get()|navigator.credentials.get()}}. [=[WRPS]=] SHOULD verify availability before
@@ -1748,12 +1756,14 @@ When this method is invoked, the user agent MUST execute the following algorithm
17481756

17491757
1. Throw a "{{NotAllowedError}}" {{DOMException}}.
17501758

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

1763+
1. If <var ignore>sameOriginWithAncestors</var> is [FALSE]
1764+
or <code>|options|.{{PublicKeyCredentialCreationOptions/user}}.{{PublicKeyCredentialUserEntity/requestUserInfo}}</code> is present,
1765+
[=consume user activation=] of the [=relevant global object=].
1766+
17571767
1. Let |pkOptions| be the value of <code>|options|.{{CredentialCreationOptions/publicKey}}</code>.
17581768

17591769
1. If <code>|pkOptions|.{{PublicKeyCredentialCreationOptions/timeout}}</code> is present, check if its value lies within a
@@ -3629,8 +3639,9 @@ credential.
36293639

36303640
<xmp class="idl">
36313641
dictionary PublicKeyCredentialUserEntity : PublicKeyCredentialEntity {
3632-
required BufferSource id;
3633-
required DOMString displayName;
3642+
required BufferSource id;
3643+
required DOMString displayName;
3644+
PublicKeyCredentialRequestUserInfo requestUserInfo;
36343645
};
36353646
</xmp>
36363647

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

3690+
: <dfn>requestUserInfo</dfn>
3691+
:: An OPTIONAL {{PublicKeyCredentialRequestUserInfo}} dictionary indicating that the [=[RP]=] requests [=user information=]
3692+
to be returned with the {{PublicKeyCredential}} for the purposes of creating a new [=user account=].
3693+
</div>
36803694

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

@@ -3839,6 +3853,107 @@ Note: The {{AttestationConveyancePreference}} enumeration is deliberately not re
38393853
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]=].
38403854
</div>
38413855

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

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

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

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

8574-
<!-- no sec cons for clients enumerated at this time
85758689
## Security considerations for [=clients=] ## {#sctn-security-considerations-client}
8576-
-->
8690+
8691+
### [=UI redressing=] when requesting [=user information=] {#sctn-seccons-ui-redressing-request-user-info}
8692+
8693+
When a [=[RP]=] requests [=user information=] as part of a {{CredentialsContainer/create()}} request,
8694+
the user agent may offer prefilled default values for the requested [=user information/identifiers=]
8695+
and [=user information/attributes=], similar to [=autofill=].
8696+
It's important that [=clients=] consider the risk of [=UI redressing=]
8697+
and take appropriate measures to prevent malicious [=[WRPS]=] from obtaining [=user information=]
8698+
without the user's consent.
85778699

85788700
## Security considerations for [=[RPS]=] ## {#sctn-security-considerations-rp}
85798701

0 commit comments

Comments
 (0)