@inrupt/solid-client-authn-browser 1.13.1 → 1.13.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/login/oidc/IssuerConfigFetcher.js +1 -1
- package/dist/login/oidc/IssuerConfigFetcher.js.map +1 -1
- package/dist/solid-client-authn.bundle.js +1 -1
- package/package.json +5 -5
- package/src/login/oidc/IssuerConfigFetcher.spec.ts +38 -0
- package/src/login/oidc/IssuerConfigFetcher.ts +6 -1
- package/tsconfig.json +2 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inrupt/solid-client-authn-browser",
|
|
3
|
-
"version": "1.13.
|
|
3
|
+
"version": "1.13.3",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"types": "dist/index",
|
|
6
6
|
"browser": "dist/index.js",
|
|
@@ -25,11 +25,11 @@
|
|
|
25
25
|
"cross-fetch": "^3.1.5"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@inrupt/oidc-client-ext": "^1.13.
|
|
29
|
-
"@inrupt/solid-client-authn-core": "^1.13.
|
|
28
|
+
"@inrupt/oidc-client-ext": "^1.13.3",
|
|
29
|
+
"@inrupt/solid-client-authn-core": "^1.13.3",
|
|
30
30
|
"@types/lodash.clonedeep": "^4.5.6",
|
|
31
31
|
"@types/node": "^18.0.3",
|
|
32
|
-
"@types/uuid": "^
|
|
32
|
+
"@types/uuid": "^9.0.1",
|
|
33
33
|
"events": "^3.3.0",
|
|
34
34
|
"jose": "^4.3.7",
|
|
35
35
|
"lodash.clonedeep": "^4.5.0",
|
|
@@ -41,5 +41,5 @@
|
|
|
41
41
|
"engines": {
|
|
42
42
|
"node": "^14.0.0 || ^16.0.0"
|
|
43
43
|
},
|
|
44
|
-
"gitHead": "
|
|
44
|
+
"gitHead": "46965b5ae611c9de77af67828ff814421e2ac7f3"
|
|
45
45
|
}
|
|
@@ -119,4 +119,42 @@ describe("IssuerConfigFetcher", () => {
|
|
|
119
119
|
);
|
|
120
120
|
expect(fetchedConfig.scopesSupported).toContain("openid");
|
|
121
121
|
});
|
|
122
|
+
|
|
123
|
+
it("should append the .well-known/openid-configuration path at the end of the issuer URL", async () => {
|
|
124
|
+
// The response value is irrelevant to this test.
|
|
125
|
+
const mockFetch = jest.fn<typeof fetch>().mockImplementation(
|
|
126
|
+
async () =>
|
|
127
|
+
new NodeResponse(
|
|
128
|
+
JSON.stringify({
|
|
129
|
+
issuer: "https://example.com",
|
|
130
|
+
// eslint-disable-next-line camelcase
|
|
131
|
+
claim_types_supported: "oidc",
|
|
132
|
+
})
|
|
133
|
+
)
|
|
134
|
+
);
|
|
135
|
+
window.fetch = mockFetch as typeof window.fetch;
|
|
136
|
+
const configFetcher = getIssuerConfigFetcher({
|
|
137
|
+
storageUtility: mockStorageUtility({}),
|
|
138
|
+
});
|
|
139
|
+
// No trailing slash
|
|
140
|
+
await configFetcher.fetchConfig("https://arbitrary.url");
|
|
141
|
+
expect(mockFetch).toHaveBeenLastCalledWith(
|
|
142
|
+
"https://arbitrary.url/.well-known/openid-configuration"
|
|
143
|
+
);
|
|
144
|
+
// A trailing slash
|
|
145
|
+
await configFetcher.fetchConfig("https://arbitrary.url/");
|
|
146
|
+
expect(mockFetch).toHaveBeenLastCalledWith(
|
|
147
|
+
"https://arbitrary.url/.well-known/openid-configuration"
|
|
148
|
+
);
|
|
149
|
+
// A path without a trailing slash
|
|
150
|
+
await configFetcher.fetchConfig("https://arbitrary.url/path");
|
|
151
|
+
expect(mockFetch).toHaveBeenLastCalledWith(
|
|
152
|
+
"https://arbitrary.url/path/.well-known/openid-configuration"
|
|
153
|
+
);
|
|
154
|
+
// A path with a trailing slash
|
|
155
|
+
await configFetcher.fetchConfig("https://arbitrary.url/path/");
|
|
156
|
+
expect(mockFetch).toHaveBeenLastCalledWith(
|
|
157
|
+
"https://arbitrary.url/path/.well-known/openid-configuration"
|
|
158
|
+
);
|
|
159
|
+
});
|
|
122
160
|
});
|
|
@@ -159,7 +159,12 @@ export default class IssuerConfigFetcher implements IIssuerConfigFetcher {
|
|
|
159
159
|
async fetchConfig(issuer: string): Promise<IIssuerConfig> {
|
|
160
160
|
let issuerConfig: IIssuerConfig;
|
|
161
161
|
|
|
162
|
-
const openIdConfigUrl = new URL(
|
|
162
|
+
const openIdConfigUrl = new URL(
|
|
163
|
+
WELL_KNOWN_OPENID_CONFIG,
|
|
164
|
+
// Make sure to append a slash at issuer URL, so that the .well-known URL
|
|
165
|
+
// includes the full issuer path. See https://openid.net/specs/openid-connect-discovery-1_0.html#ProviderConfig.
|
|
166
|
+
issuer.endsWith("/") ? issuer : `${issuer}/`
|
|
167
|
+
).href;
|
|
163
168
|
const issuerConfigRequestBody = await window.fetch(openIdConfigUrl);
|
|
164
169
|
// Check the validity of the fetched config
|
|
165
170
|
try {
|