Skip to content

Commit 344458d

Browse files
authored
Specify the continuation API (#662)
* Specify the continuation API Bug: w3c-fedid/custom-requests#1 * swap order * first * rename and in parallel * remove if necessary * failure
1 parent e6ce288 commit 344458d

File tree

1 file changed

+72
-17
lines changed

1 file changed

+72
-17
lines changed

spec/index.bs

+72-17
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,7 @@ This specification introduces a new type of {{Credential}}, called an {{Identity
451451
:: The {{Credential/id}}'s attribute getter returns the empty string.
452452
: <b>{{IdentityCredential/token}}</b>
453453
:: The {{IdentityCredential/token}}'s attribute getter returns the value it is set to.
454-
It represents the minted {{IdentityProviderToken/token}} provided by the [=IDP=].
454+
It represents the minted {{IdentityAssertionResponse/token}} provided by the [=IDP=].
455455
: <b>{{IdentityCredential/isAutoSelected}}</b>
456456
:: {{IdentityCredential/isAutoSelected}}'s attribute getter returns the value it is
457457
set to. It represents whether the user's identity credential was automatically selected when
@@ -673,8 +673,8 @@ dictionary IdentityProviderRequestOptions : IdentityProviderConfig {
673673
:: The {{id_assertion_endpoint_request/client_id}} provided to the [=RP=] out of band by the [=IDP=]
674674
: <b>{{IdentityProviderRequestOptions/nonce}}</b>
675675
:: A random number of the choice of the [=RP=]. It is generally used to associate a client
676-
session with a {{IdentityProviderToken/token}} and to mitigate replay attacks. Therefore, this value should have
677-
sufficient entropy such that it would be hard to guess.
676+
session with a {{IdentityAssertionResponse/token}} and to mitigate replay attacks.
677+
Therefore, this value should have sufficient entropy such that it would be hard to guess.
678678
: <b>{{IdentityProviderRequestOptions/loginHint}}</b>
679679
:: A string representing the login hint corresponding to an account which the RP wants the user
680680
agent to show to the user. If provided, the user agent will not show accounts which do not
@@ -1261,21 +1261,43 @@ To <dfn>fetch an identity assertion</dfn> given a {{USVString}}
12611261
set to the following steps given a <a spec=fetch for=/>response</a> |response| and |responseBody|:
12621262
1. Let |json| be the result of [=extract the JSON fetch response=] from |response| and
12631263
|responseBody|.
1264-
1. [=converted to an IDL value|Convert=] |json| to an {{IdentityProviderToken}}, |token|.
1264+
1. [=converted to an IDL value|Convert=] |json| to an {{IdentityAssertionResponse}}, |token|.
12651265
1. If one of the previous two steps threw an exception, set |credential| to failure
12661266
and return.
1267+
1. If neither {{IdentityAssertionResponse/token}} nor
1268+
{{IdentityAssertionResponse/continue_on}} was specified, set |credential| to failure
1269+
and return.
1270+
1. If {{IdentityAssertionResponse/token}} was specified, let |tokenString|
1271+
be |token|'s {{IdentityAssertionResponse/token}}.
1272+
1. Otherwise, run these steps [=in parallel=]:
1273+
1. Let |continueOnUrl| be the result of running [=parse url=] with |token|'s
1274+
{{IdentityAssertionResponse/continue_on}} and |globalObject|.
1275+
1. If |continueOnUrl| is failure, set |credential| to failure and return.
1276+
1. If |continueOnUrl| is not [=same origin=] with |tokenUrl|, set |credential|
1277+
to failure and return.
1278+
1. Let |tokenPair| be the result of [=show a continuation dialog=] with |continueOnUrl|.
1279+
1. If |tokenPair| is failure, set |credential| to failure and return.
1280+
1. Let |tokenString| be the first entry of |tokenPair|.
1281+
1. If the second entry of |tokenPair| is not null, set |accountId| to that second entry.
1282+
1. Wait for |tokenString| or |credential| to be set.
1283+
1. If |credential| is set:
1284+
1. Assert that |credential| is set to failure.
1285+
1. Return |credential|.
1286+
1. [=Create a connection between the RP and the IdP account=] with |provider|, |accountId|, and
1287+
|globalObject|.
12671288
1. Let |credential| be a new {{IdentityCredential}} given |globalObject|'s
12681289
<a for="global object">realm</a>.
1269-
1. Set |credential|'s {{IdentityCredential/token}} to |token|.
1290+
1. Set |credential|'s {{IdentityCredential/token}} to |tokenString|.
12701291
1. Set |credential|'s {{IdentityCredential/isAutoSelected}} to
12711292
|isAutoSelected|.
12721293
1. Wait for |credential| to be set.
12731294
1. Return |credential|.
12741295
</div>
12751296

12761297
<xmp class="idl">
1277-
dictionary IdentityProviderToken {
1278-
required USVString token;
1298+
dictionary IdentityAssertionResponse {
1299+
USVString token;
1300+
USVString continue_on;
12791301
};
12801302
</xmp>
12811303

@@ -1318,8 +1340,6 @@ an {{IdentityProviderAPIConfig}} |config|, an {{IdentityProviderRequestOptions}}
13181340
{{IdentityCredentialRequestOptions/context}} and |options|'s
13191341
{{IdentityCredentialRequestOptions/mode}} to customize the dialog shown.
13201342
1. If the user does not grant permission, return false.
1321-
1. [=Create a connection between the RP and the IdP account=] with |provider|, |account|, and
1322-
|globalObject|.
13231343
1. Return true.
13241344
</div>
13251345

@@ -1483,6 +1503,32 @@ success or failure.
14831503
1. Otherwise, return failure.
14841504
</div>
14851505

1506+
<div algorithm>
1507+
To <dfn>show a continuation dialog</dfn> given a |continueOnUrl|, run the
1508+
following steps. This returns a failure or a tuple (string, string?) (a token
1509+
and an optional account ID).
1510+
1. Assert: these steps are running [=in parallel=].
1511+
1. [=Create a fresh top-level traversable=] with |continueOnUrl|.
1512+
1. The user agent MAY [=set up browsing context features=] or otherwise
1513+
affect the presentation of this traversable in an implementation-defined
1514+
way.
1515+
1. Wait for the first occurence of one of the following conditions:
1516+
* The user closes the browsing context: return failure.
1517+
* {{IdentityProvider}}.{{IdentityProvider/close}} is called in the
1518+
context of this new traversable:
1519+
1. Close the traversable.
1520+
1. Return failure.
1521+
* {{IdentityProvider}}.{{IdentityProvider/resolve()}} is called in
1522+
the context of this new traversable.
1523+
1. Close the traversable.
1524+
1. Let |token| be the token that was passed to that resolve call.
1525+
1. If {{IdentityResolveOptions/accountId}} was specified in the
1526+
resolve call, let |accountId| be that account ID.
1527+
1. Otherwise, let |accountId| be null.
1528+
1. Return (|token|, |accountId|).
1529+
1530+
</div>
1531+
14861532
<div algorithm>
14871533
To <dfn>fetch the config file and show an IDP login dialog</dfn> given an
14881534
{{IdentityProviderConfig}} |provider|, and a |globalObject|, run the following
@@ -1511,8 +1557,13 @@ This specification introduces the {{IdentityUserInfo}} dictionary as well as the
15111557
USVString picture;
15121558
};
15131559

1560+
dictionary IdentityResolveOptions {
1561+
USVString accountId;
1562+
};
1563+
15141564
[Exposed=Window, SecureContext] interface IdentityProvider {
15151565
static undefined close();
1566+
static undefined resolve(DOMString token, optional IdentityResolveOptions options = {});
15161567
static Promise&lt;sequence&lt;IdentityUserInfo&gt;&gt; getUserInfo(IdentityProviderConfig config);
15171568
};
15181569
</pre>
@@ -1978,22 +2029,26 @@ the <a http-header>Origin</a> header value is represented by the
19782029
[=IDP=]-specific, the [=user agent=] cannot perform this check.
19792030
</div>
19802031

1981-
The response body must be a JSON object that can be [=converted to an IDL value|converted=] to an {{IdentityProviderToken}} without an exception.
2032+
The response body must be a JSON object that can be [=converted to an IDL value|converted=] to an {{IdentityAssertionResponse}} without an exception.
19822033

1983-
Every {{IdentityProviderToken}} is expected to have members with the following semantics:
2034+
Every {{IdentityAssertionResponse}} is expected to have members with the following semantics:
19842035

1985-
<dl dfn-type="dict-member" dfn-for="IdentityProviderToken">
2036+
<dl dfn-type="dict-member" dfn-for="IdentityAssertionResponse">
19862037
: <dfn>token</dfn>
19872038
:: The resulting token.
2039+
: <dfn>continue_on</dfn>
2040+
:: A URL that the user agent will open in a popup to finish the authentication process.
19882041
</dl>
19892042

1990-
The content of the {{IdentityProviderToken/token}} is opaque to the user agent and can contain
2043+
Only one of `token` and `continue_on` should be specified.
2044+
2045+
The content of the {{IdentityAssertionResponse/token}} is opaque to the user agent and can contain
19912046
anything that the [=IDP=] would like to pass to the
19922047
[=RP=] to facilitate the login. For this reason the [=RP=]
1993-
is expected to be the party responsible for validating the {{IdentityProviderToken/token}} passed
1994-
along from the [=IDP=] using the appropriate token validation
1995-
algorithms defined. One example of how this might be done is defined
1996-
in [[OIDC-Connect-Core#IDTokenValidation]].
2048+
is expected to be the party responsible for validating the
2049+
{{IdentityAssertionResponse/token}} passed along from the [=IDP=] using the
2050+
appropriate token validation algorithms defined. One example of how this might
2051+
be done is defined in [[OIDC-Connect-Core#IDTokenValidation]].
19972052

19982053
NOTE: For [=IDPs=], it is worth considering how
19992054
[portable](https://github.com/fedidcg/FedCM/issues/314) accounts are.

0 commit comments

Comments
 (0)