Skip to content

Commit 8201e01

Browse files
authored
Specify multiple configURLs (#667)
* Specify multiple configURLs Bug: #552 * Address comments from TallTed * don't return within the fetch handler * skip fetch if same-site * wellknown
1 parent 344458d commit 8201e01

File tree

1 file changed

+36
-17
lines changed

1 file changed

+36
-17
lines changed

spec/index.bs

+36-17
Original file line numberDiff line numberDiff line change
@@ -947,11 +947,12 @@ or failure.
947947
1. Set |rootUrl|'s [=url/scheme=] to |configUrl|'s [=url/scheme=].
948948
1. Set |rootUrl|'s [=url/host=] to |configUrl|'s [=url/host=]'s [=host/registrable domain=].
949949
1. Set |rootUrl|'s [=url/path=] to the <a>list</a> «".well-known", "web-identity"».
950-
1. Let |config|, |configInWellKnown| both be null.
950+
1. Let |config|, |wellKnown|, |accounts_url|, and |login_url| be null.
951+
1. Let |skipWellKnown| be false.
951952
1. Let |rpOrigin| be |globalObject|'s [=associated Document=]'s [=Document/origin=].
952953
1. If |rpOrigin| is not an [=opaque origin=], and |rootUrl|'s [=url/host=] is equal
953954
to |rpOrigin|'s [=host/registrable domain=], and |rootUrl|'s [=url/scheme=] is
954-
equal to |rpOrigin|'s [=origin/scheme=], set |configInWellKnown| to true.
955+
equal to |rpOrigin|'s [=origin/scheme=], set |skipWellKnown| to true.
955956

956957
Note: Because domain cookies are valid across an entire site, there is no privacy
957958
benefit from doing the well-known check if the RP and IDP are in the same site.
@@ -985,22 +986,18 @@ or failure.
985986
[pull request](https://github.com/whatwg/fetch/pull/1533) for details.
986987

987988
1. [=Fetch request=] with |wellKnownRequest| and |globalObject|, and with <var ignore>processResponseConsumeBody</var>
988-
set to the following steps given a <a spec=fetch for=/>response</a> |response| and |responseBody|:
989+
set to the following steps, given a <a spec=fetch for=/>response</a> |response| and |responseBody|:
989990
1. Let |json| be the result of [=extract the JSON fetch response=] from |response| and
990991
|responseBody|.
991-
1. [=converted to an IDL value|Convert=] |json| to an {{IdentityProviderWellKnown}},
992-
|discovery|.
992+
1. Set |wellKnown| to the result of [=converted to an IDL value|converting=] |json|
993+
to an {{IdentityProviderWellKnown}}.
993994
1. If one of the previous two steps threw an exception, or if the
994-
[=list/size=] of |discovery|["{{IdentityProviderWellKnown/provider_urls}}"] is
995-
greater than 1, set |configInWellKnown| to false.
995+
[=list/size=] of |wellKnown|["{{IdentityProviderWellKnown/provider_urls}}"] is
996+
greater than 1, set |wellKnown| to failure.
996997

997998
Issue: [relax](https://github.com/fedidcg/FedCM/issues/333) the size of the
998999
provider_urls array.
9991000

1000-
1. Otherwise, set to |configInWellKnown| to true if
1001-
|discovery|["{{IdentityProviderWellKnown/provider_urls}}"][0] [=string/is=] equal to
1002-
|provider|'s {{IdentityProviderConfig/configURL}}, and to false otherwise.
1003-
10041001
1. Let |configRequest| be a new <a spec=fetch for=/>request</a> as follows:
10051002

10061003
: [=request/url=]
@@ -1038,11 +1035,31 @@ or failure.
10381035
1. [=converted to an IDL value|Convert=] |json| to an {{IdentityProviderAPIConfig}} stored
10391036
in |config|.
10401037
1. If one of the previous two steps threw an exception, set |config| to failure.
1041-
1. Set |config|.{{IdentityProviderAPIConfig/login_url}} to the result of [=computing
1042-
the manifest URL=] with |provider|, |config| and |globalObject|.
1043-
1. If |config|.{{IdentityProviderAPIConfig/login_url}} is null, return failure.
1044-
1. Wait for both |config| and |configInWellKnown| to be set.
1045-
1. If |configInWellKnown| is true, return |config|. Otherwise, return failure.
1038+
1. Set |login_url| to the result of [=computing the manifest URL=] with |provider|,
1039+
|config|.{{IdentityProviderAPIConfig/login_url}}, and |globalObject|.
1040+
1. Set |accounts_url| to the result of [=computing the manifest URL=] with |provider|,
1041+
|config|.{{IdentityProviderAPIConfig/accounts_endpoint}}, and |globalObject|.
1042+
1. If |login_url| or |accounts_url| is failure, set |config| to failure.
1043+
1. Wait for |config| to be set.
1044+
1. If |config| is failure, return failure.
1045+
1. If |skipWellKnown| is true, return |config|.
1046+
1. Wait for |wellKnown| to be set.
1047+
1. If |wellKnown| is failure, return failure.
1048+
1. If |wellKnown|.{{IdentityProviderWellKnown/accounts_endpoint}} and
1049+
|wellKnown|.{{IdentityProviderWellKnown/login_url}} are set:
1050+
1. Let |well_known_accounts_url| be the result of [=computing the manifest URL=] with
1051+
|provider|, |wellKnown|.{{IdentityProviderWellKnown/accounts_endpoint}},
1052+
and |globalObject|.
1053+
1. Let |well_known_login_url| be the result of [=computing the manifest URL=] with |provider|,
1054+
|wellKnown|.{{IdentityProviderWellKnown/login_url}}, and |globalObject|.
1055+
1. If |well_known_accounts_url| is not [=url/equal=] to |accounts_url|, return failure.
1056+
1. If |well_known_login_url| is not [=url/equal=] to |login_url|, return failure.
1057+
1. Otherwise:
1058+
1. Let |allowed_config_url| be the result of [=computing the manifest URL=] with |provider|,
1059+
|wellKnown|.{{IdentityProviderWellKnown/provider_urls}}[0], and |globalObject|.
1060+
1. If |allowed_config_url| is not [=url/equal=] to |configUrl|, return failure.
1061+
1. Return |config|.
1062+
10461063
</div>
10471064

10481065
NOTE: a two-tier file system is used in order to prevent the [=IDP=] from easily determining the [=RP=]
@@ -1055,7 +1072,9 @@ path manipulation to fingerprint (for instance, by including the RP in the path)
10551072

10561073
<xmp class="idl">
10571074
dictionary IdentityProviderWellKnown {
1058-
required sequence<USVString> provider_urls;
1075+
sequence<USVString> provider_urls;
1076+
USVString accounts_endpoint;
1077+
USVString login_url;
10591078
};
10601079

10611080
dictionary IdentityProviderIcon {

0 commit comments

Comments
 (0)