From 6f8e7a4989d2c55eb7e56ae9aaec414048b0f723 Mon Sep 17 00:00:00 2001
From: Simone Onofri W3C First Public Working Draft, Copyright © 2024 the Contributors to the Federated Credential Management API Specification, published by the Federated Identity Community Group under the W3C Community Contributor License Agreement (CLA).
-A human-readable summary is available. Copyright © 2024 World Wide Web Consortium. W3C® liability, trademark and permissive document license rules apply. A Web Platform API that allows users to login to websites with their federated accounts in a privacy preserving manner. This specification was published by the Federated Identity Community Group.
- It is not a W3C Standard nor is it on the W3C Standards Track.
-
- Please note that under the W3C Community Contributor License Agreement (CLA) there is a limited opt-out and other conditions apply.
-
- Learn more about W3C Community and Business Groups. This section describes the status of this document at the time of
+ its publication. A list of
+ current W3C publications and the latest revision of this technical report
+ can be found in the W3C technical reports
+ index at https://www.w3.org/TR/. This document was published by the Federated Identity Working Group as a First Public Working Draft using the Recommendation
+ track. This document is intended to become a W3C Recommendation. The (archived) public mailing list public-fedid-wg@w3.org (see instructions)
+ is preferred for discussion of this specification.
+ When sending e-mail,
+ please put the text “fedcm” in the subject,
+ preferably like this:
+ “[fedcm] …summary of comment…” This document is a First Public Working Draft. Publication as a First Public Working Draft does not imply endorsement by W3C and its Members. This is a draft document and may be updated, replaced or
+ obsoleted by other documents at any time. It is inappropriate to cite this
+ document as other than work in progress. This document was produced by the Federated Identity Working Group. This document was produced by a group operating under
+ the W3C Patent Policy.
+ W3C maintains a public list of any patent disclosures made in connection with the deliverables of the group;
+ that page also includes instructions for disclosing a patent.
+ An individual who has actual knowledge of a patent which the individual believes contains Essential Claim(s) must disclose the information in accordance with section 6 of the W3C Patent Policy. This document is governed by the 03 November 2023 W3C Process Document. Federated Credential Management API
-
-
-
- More details about this document
+
+
+
Abstract
Status of this document
+ Status of this document
Table of Contents
Conformance
"cookies"
or "*"
, and the request's client is
not null, and the client’s origin is same
origin with the top-level origin
while clearing cookies for
+ while clearing cookies for
origin it MUST remove any entries in the Login Status Map where
the key is the input origin. Once Clear-Site-Data supports partitioned cookies,
@@ -1465,22 +1272,22 @@ This specification introduces a new type of This specification introduces a new type of The The The
2.3. The IdentityCredential Interface
- Credential
, called an IdentityCredential
:Credential
, called an IdentityCredential
:
:
;
};
[
:
:
(
= {});
;
;
};
-
id
+ id
id
's attribute getter returns the empty string.id
's attribute getter returns the empty string.token
token
's attribute getter returns the value it is set to.
@@ -1490,12 +1297,12 @@ isAutoSelected's attribute getter returns the value it is
set to. It represents whether the user’s identity credential was automatically selected when
going through the UI flow which resulted in this
IdentityCredential
.
[[type]]
+ [[type]]
The IdentityCredential
's [[type]]
's value is "identity".
[[discovery]]
+ The IdentityCredential
's [[type]]
's value is "identity".
[[discovery]]
The IdentityCredential
's [[discovery]]
's value is remote
.
The IdentityCredential
's [[discovery]]
's value is remote
.
The main entrypoint in this specification is through the entrypoints exposed by the Credential Management API.
@@ -1508,7 +1315,7 @@If document is not allowed to use the identity-credentials-get policy-controlled feature, throw a "NotAllowedError
" DOMException
.
If document is not allowed to use the identity-credentials-get policy-controlled feature, throw a "NotAllowedError
" DOMException
.
Let promise be a new Promise
.
InvalidStateError
" DOMException
.
Run a Content Security Policy Level 3 check with a connect-src directive on the URL +
Run a Content Security Policy Level 3 check with a connect-src directive on the URL
passed as configUrl. If it fails, reject promise with a "NetworkError
" DOMException
.
If there is another pending disconnect
call for this globalObject (e.g., it has not yet thrown an exception or its associated Promise
has not yet been
resolved), reject promise with a "NetworkError
" DOMException
.
If configUrl is not a potentially trustworthy origin, reject promise with a +
If configUrl is not a potentially trustworthy origin, reject promise with a
"NetworkError
" DOMException
.
If the user has disabled the FedCM API on the globalObject, reject promise with a @@ -1670,8 +1477,8 @@
partial dictionary CredentialRequestOptions { +This specification introduces an extension to the
+CredentialRequestOptions
object:@@ -1728,25 +1535,25 @@partial dictionary CredentialRequestOptions {IdentityCredentialRequestOptions ; };
identity 2.3.3. The
-[[DiscoverFromExternalSource]](origin, options, sameOriginWithAncestors)
internal methodThe
[[DiscoverFromExternalSource]](origin, options, sameOriginWithAncestors)
algorithm runs in parallel inside Credential Management 1 § 2.5.1 Request a Credential to request +The
[[DiscoverFromExternalSource]](origin, options, sameOriginWithAncestors)
algorithm runs in parallel inside Credential Management 1 § 2.5.1 Request a Credential to request credentials and returns anIdentityCredential
or an error.This internal method accepts three arguments:
origin
This argument is the relevant settings object's origin, as determined by the
- calling get()
implementation, i.e., CredentialsContainer
's Request a Credential
abstract operation.
get()
implementation, i.e., CredentialsContainer
's Request a Credential
abstract operation.
options
This argument is a CredentialRequestOptions
object whose identity
member exists.
This argument is a CredentialRequestOptions
object whose identity
member exists.
sameOriginWithAncestors
This argument is a Boolean value which is true
if and only if the
caller’s environment settings object is same-origin with its ancestors. It is false
if caller is cross-origin.
Note: Invocation of this internal method indicates that it was allowed by permissions policy, which is evaluated at the Credential Management Level 1 level. +
Note: Invocation of this internal method indicates that it was allowed by permissions policy, which is evaluated at the Credential Management Level 1 level. See § 4 Permissions Policy Integration. As such, sameOriginWithAncestors is unused.
The options.signal
is used as an abort signal for the
+
The options.signal
is used as an abort signal for the
requests.
IdentityCredential
's [[DiscoverFromExternalSource]](origin, options, sameOriginWithAncestors)
algorithm is invoked, the user agent MUST execute the following steps. This returns an IdentityCredential
(or throws an error to the caller).
@@ -1756,7 +1563,7 @@ If the size of options["identity
"]["providers
"]
is not equal to 1, queue a global task on the DOM manipulation task source given globalObject to throw a new "NetworkError
" DOMException
Note: The globalObject is not currently passed onto the [[DiscoverFromExternalSource]](origin, options, sameOriginWithAncestors)
algorithm. See issue.
Note: The globalObject is not currently passed onto the [[DiscoverFromExternalSource]](origin, options, sameOriginWithAncestors)
algorithm. See issue.
Support choosing accounts from multiple IDPs, as described here.
The user agent can decide when to continue with the next steps.
@@ -1802,7 +1609,7 @@The create an IdentityCredential algorithm invokes the various FedCM fetches, shows the user
agent UI, and creates the IdentityCredential
that is then returned to the RP.
IdentityProviderRequestOptions
provider, a CredentialRequestOptions
options, and a globalObject, run the following steps. This returns an IdentityCredential
or a pair (failure, bool), where the bool indicates whether to skip delaying
+ To create an IdentityCredential given an IdentityProviderRequestOptions
provider, a CredentialRequestOptions
options, and a globalObject, run the following steps. This returns an IdentityCredential
or a pair (failure, bool), where the bool indicates whether to skip delaying
the exception thrown.
Let requiresUserMediation be provider’s configURL
's origin's requires user mediation.
Let mediation be options’s mediation
.
Let mediation be options’s mediation
.
If requiresUserMediation is true and mediation is
-"silent
", return (failure, true).
silent
", return (failure, true).
Let config be the result of running fetch the config file with provider and globalObject.
Let permission, disclosureTextShown, and isAutoSelected be set to false.
If mediation is not "required
", requiresUserMediation is false, and numRegisteredAccounts is equal to 1:
If mediation is not "required
", requiresUserMediation is false, and numRegisteredAccounts is equal to 1:
Set account to registeredAccount and accountState to the result of running compute the connection status algorithm given provider and account. When doing this, @@ -1962,7 +1769,7 @@
Set isAutoSelected to true.
Otherwise, if mediation is "silent
", return (failure, true).
Otherwise, if mediation is "silent
", return (failure, true).
Otherwise, if accountsList’s size is 1:
If configUrl is failure, return failure.
Run a Content Security Policy Level 3 check with a connect-src directive on the URL +
Run a Content Security Policy Level 3 check with a connect-src directive on the URL passed as configUrl. If it fails, return failure.
If configUrl is not a potentially trustworthy URL, return failure.
+If configUrl is not a potentially trustworthy URL, return failure.
Let rootUrl be a new URL.
If manifestUrl is not same origin with configUrl, return failure.
If manifestUrl is not a potentially trustworthy URL, return failure.
+If manifestUrl is not a potentially trustworthy URL, return failure.
Return manifestUrl.
If document is not allowed to use the identity-credentials-get policy-controlled feature, throw a "NotAllowedError
" DOMException
.
If document is not allowed to use the identity-credentials-get policy-controlled feature, throw a "NotAllowedError
" DOMException
.
If there does not exist an account account such that compute the connection status of provider, account, and globalObject returns connected, then throw a new "NetworkError
" DOMException
. This check can be performed by iterating over the connected accounts set or by keeping a separate data structure to make this lookup fast.
InvalidStateError
" DOMException
.
Run a Content Security Policy Level 3 check with a connect-src directive on the URL +
Run a Content Security Policy Level 3 check with a connect-src directive on the URL
passed as configUrl. If it fails, throw a new "NetworkError
" DOMException
.
If globalObject’s navigable is a top-level traversable, throw a new @@ -2822,7 +2629,7 @@
Endpoint
@@ -2860,7 +2667,7 @@ The IDP exposes a well-known file in a pre-defined location, specifically at the "web-identity" file at the IDPs's path ".well-known".
webidentity , and
+(b) with the Sec-Fetch-Dest header set to webidentity , and
(c) without revealing the RP in the Origin or Referer headers.The config file serves as a discovery device to other endpoints provided by the IDP.
webidentity ,
+(b) with the Sec-Fetch-Dest header set to webidentity ,
(c) without revealing the RP in the Origin or Referer headers, and
(d) without following HTTP redirects.The color is a subset of CSS <color> syntax, namely <hex-color>s, hsl()s, rgb()s and <named-color>. +The color is a subset of CSS <color> syntax, namely <hex-color>s, hsl()s, rgb()s and <named-color>. For example:
@@ -2978,7 +2785,7 @@
The accounts endpoint is fetched in the fetch the accounts algorithm: (a) with IDP cookies,
-(b) with the Sec-Fetch-Dest header set to For example: @@ -3056,7 +2863,7 @@client metadata endpoint provides metadata about RPs.The client metadata endpoint is fetched in the fetch the client metadata algorithm: (a) without cookies,
-(b) with the Sec-Fetch-Dest header set to The user agent also passes the client_id. @@ -3095,7 +2902,7 @@(a) as a POST request,
(b) with IDP cookies,
(c) with the RP's origin in the Origin header, and
-(d) with the Sec-Fetch-Dest header set to It will also contain the following parameters in the request body
webidentity ,
+(d) with the Sec-Fetch-Dest header set to webidentity ,
(e) without following HTTP redirects, and
(f) in "cors" mode.
|
It will also contain the following in the request body application/x-www-form-urlencoded
:
FedCM defines a policy-controlled feature identified by the string "identity-credentials-get"
.
-Its default allowlist is "self"
.
FedCM defines a policy-controlled feature identified by the string "identity-credentials-get"
.
+Its default allowlist is "self"
.
A Document
’s permissions policy determines whether any content
in that document is allowed to obtain a credential object using the Browser API.
-Attempting to invoke navigator.credentials.get({identity:..., ...})
in documents that are not allowed to use the identity-credentials-get feature will result
+Attempting to invoke navigator.credentials.get({identity:..., ...})
in documents that are not allowed to use the identity-credentials-get feature will result
in a promise rejected with a "NotAllowedError
" DOMException
.
This restriction can be controlled using the mechanisms described in Permissions Policy.
-Note: Algorithms specified in Credential Management Level 1 perform the actual +
Note: Algorithms specified in Credential Management Level 1 perform the actual
permissions policy evaluation. This is because such policy evaluation needs to
occur when there is access to the current settings object. The internal methods
-modified by this specification do not have such access since they are invoked in parallel by CredentialsContainer
's Request a Credential
abstract operation.
CredentialsContainer
's Request a Credential
abstract operation.
For the purposes of user agent automation and website testing, this document -defines the below WebDriver extension commands to interact with any +defines the below WebDriver extension commands to interact with any active FedCM dialogs.
In order to advertise the availability of the extension commands defined below, a new extension capability is defined.
+In order to advertise the availability of the extension commands defined below, a new extension capability is defined.
The remote end steps are:
+The remote end steps are:
The remote end steps are:
+The remote end steps are:
If parameters is not a JSON Object, return a WebDriver error with error code invalid argument.
+If parameters is not a JSON Object, return a WebDriver error with error code invalid argument.
If no FedCM dialog is currently open, return a WebDriver error with error code no such alert.
+If no FedCM dialog is currently open, return a WebDriver error with error code no such alert.
Let accountIndex be the result of getting a property named "accountIndex"
from parameters.
If accountIndex is undefined
or is less than 0 or greater than or
equal to the number of accounts that the user can choose from in the
-current flow, return a WebDriver error with error code invalid argument.
Close the dialog and continue the create an IdentityCredential algorithm as if the user had selected the account indicated by accountIndex and granted permission to sign-up, if applicable.
Return success with data null
.
Return success with data null
.
The remote end steps are:
+The remote end steps are:
If parameters is not a JSON Object, return a WebDriver error with error code invalid argument.
+If parameters is not a JSON Object, return a WebDriver error with error code invalid argument.
Let dialogButton be the result of getting a property named "dialogButton"
from parameters.
If dialogButton is not a string that is "ConfirmIdpLoginContinue
", return
-a WebDriver error with error code invalid argument.
If no FedCM dialog is currently open or the dialog is not a confirm IDP -login dialog, return a WebDriver error with error code no +login dialog, return a WebDriver error with error code no such alert.
Act as if the user had clicked the "continue" button in the confirm IDP login dialog and initiate the login flow.
Return success with data null
.
Return success with data null
.
The remote end steps are:
+The remote end steps are:
If no FedCM dialog is currently open, return a WebDriver error with error code no such alert.
+If no FedCM dialog is currently open, return a WebDriver error with error code no such alert.
Let accounts be the list of accounts that the user can or could choose from in the current flow.
@@ -3384,7 +3191,7 @@Return success with data list.
+Return success with data list.
Note: This command lets automation verify that the context api was applied properly
-The remote end steps are:
+The remote end steps are:
If no FedCM dialog is currently open, return a WebDriver error with error code no such alert.
+If no FedCM dialog is currently open, return a WebDriver error with error code no such alert.
Let data be a dictionary with an object with properties as follows:
subtitle
set to the subtitle of the open dialog, if there is one
Return success with data data.
+Return success with data data.
The remote end steps are:
+The remote end steps are:
If no FedCM dialog is currently open, return a WebDriver error with error code no such alert.
+If no FedCM dialog is currently open, return a WebDriver error with error code no such alert.
Let type be a string that is "AutoReauthn
" if the user is being auto-reauthenticated,
or "AccountChooser
" if the dialog is an account chooser, or "ConfirmIdpLogin
" if the
dialog is a confirm IDP login dialog.
Return success with data type.
+Return success with data type.
The remote end steps are:
+The remote end steps are:
If parameters is not a JSON Object, return a WebDriver error with error code invalid argument.
+If parameters is not a JSON Object, return a WebDriver error with error code invalid argument.
Let enabled be the result of getting a property named "enabled"
from parameters.
If enabled is undefined
or is not a boolean, return a WebDriver error with error code invalid argument.
If enabled is undefined
or is not a boolean, return a WebDriver error with error code invalid argument.
If enabled is false, disables the promise rejection delay; otherwise, re-enables it.
Return success with data null
.
Return success with data null
.
The remote end steps are:
+The remote end steps are:
If the user agent uses a cooldown delay, which disables the API for an amount of time after the user dismissed the dialog, then this command resets that cooldown such that the next FedCM call can succeed again.
Return success with data null
.
Return success with data null
.
This section provides a few of the security considerations for the FedCM API. Note that there is a @@ -3496,15 +3303,15 @@
The non-same-origin fetches include, for example, the brand icon. The user agent does not perform a Content Security Policy Level 3 check on these because they are directly specified from the manifest. In addition, the +
The non-same-origin fetches include, for example, the brand icon. The user agent does not perform a Content Security Policy Level 3 check on these because they are directly specified from the manifest. In addition, the rendering of this image is performed by the user agent, and as such this image cannot affect the RP site nor can they be inspected by the RP in any way.
The FedCM API introduces several non-static endpoints on the IDP, so these need to be protected
-from XSS attacks. In order to do so, the FedCM API introduces a new value for the Sec-Fetch-Dest header, a forbidden request-header. The requests initiated by the FedCM API
+from XSS attacks. In order to do so, the FedCM API introduces a new value for the Sec-Fetch-Dest header, a forbidden request-header. The requests initiated by the FedCM API
have a webidentity
value for this header. The value cannot be set by random websites, so the IDP can be confident that the request was originated by the FedCM browser rather than sent by a
websites trying to run an XSS attack. An IDP needs to check for this header’s value in the
credentialed requests it receives, which ensures that the request was initiated by the user agent,
@@ -3715,7 +3522,7 @@
params
are merged into the spec, deprecate the nonce
parameter
- params
are merged into the spec, deprecate the nonce
parameter
+ Note, this is an informative note.
+Requirements phrased in the imperative as part of algorithms + (such as "strip any leading space characters" + or "return false and abort these steps") + are to be interpreted with the meaning of the key word + ("must", "should", "may", etc) + used in introducing the algorithm.
+Conformance requirements phrased as algorithms or specific steps + can be implemented in any manner, + so long as the end result is equivalent. + In particular, the algorithms defined in this specification + are intended to be easy to understand + and are not intended to be performant. + Implementers are encouraged to optimize.
+IdentityCredential
: IdentityCredential
: disconnect
(options
= {});
token
;
isAutoSelected
;
@@ -5051,7 +4872,7 @@ identity
;
};
@@ -5175,54 +4996,6 @@ In only one current engine.
-In only one current engine.
-Headers/Permissions-Policy/identity-credentials-get
-In only one current engine.
-