@inrupt/solid-client-authn-browser 1.17.3 → 1.17.5
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/index.js +4 -14
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +6 -16
- package/dist/index.mjs.map +1 -1
- package/dist/solid-client-authn.bundle.js +7 -7
- package/dist/solid-client-authn.bundle.js.map +1 -1
- package/package.json +5 -5
- package/src/ClientAuthentication.spec.ts +0 -19
- package/src/ClientAuthentication.ts +6 -15
package/dist/index.js
CHANGED
|
@@ -82,7 +82,7 @@ class ClientAuthentication extends solidClientAuthnCore.ClientAuthentication {
|
|
|
82
82
|
// If the user is providing a redirect IRI, it should not be modified, so
|
|
83
83
|
// normalization only applies if we default to the current location (which is
|
|
84
84
|
// a bad practice and should be discouraged).
|
|
85
|
-
const redirectUrl = (_a = options.redirectUrl) !== null && _a !== void 0 ? _a : oidcClientExt.
|
|
85
|
+
const redirectUrl = (_a = options.redirectUrl) !== null && _a !== void 0 ? _a : oidcClientExt.normalizeCallbackUrl(window.location.href);
|
|
86
86
|
if (!solidClientAuthnCore.isValidRedirectUrl(redirectUrl)) {
|
|
87
87
|
throw new Error(`${redirectUrl} is not a valid redirect URL, it is either a malformed IRI, includes a hash fragment, or reserved query parameters ('code' or 'state').`);
|
|
88
88
|
}
|
|
@@ -139,24 +139,14 @@ class ClientAuthentication extends solidClientAuthnCore.ClientAuthentication {
|
|
|
139
139
|
};
|
|
140
140
|
}
|
|
141
141
|
async cleanUrlAfterRedirect(url) {
|
|
142
|
-
const cleanedUpUrl =
|
|
143
|
-
cleanedUpUrl.searchParams.delete("state");
|
|
144
|
-
// For auth code flow
|
|
145
|
-
cleanedUpUrl.searchParams.delete("code");
|
|
146
|
-
// For implicit flow
|
|
147
|
-
cleanedUpUrl.searchParams.delete("id_token");
|
|
148
|
-
cleanedUpUrl.searchParams.delete("access_token");
|
|
149
|
-
// For login error
|
|
150
|
-
cleanedUpUrl.searchParams.delete("error");
|
|
151
|
-
cleanedUpUrl.searchParams.delete("error_description");
|
|
152
|
-
cleanedUpUrl.searchParams.delete("iss");
|
|
142
|
+
const cleanedUpUrl = solidClientAuthnCore.removeOpenIdParams(url).href;
|
|
153
143
|
// Remove OAuth-specific query params (since the login flow finishes with
|
|
154
144
|
// the browser being redirected back with OAuth2 query params (e.g. for
|
|
155
145
|
// 'code' and 'state'), and so if the user simply refreshes this page our
|
|
156
146
|
// authentication library will be called again with what are now invalid
|
|
157
147
|
// query parameters!).
|
|
158
|
-
window.history.replaceState(null, "", cleanedUpUrl
|
|
159
|
-
while (window.location.href !== cleanedUpUrl
|
|
148
|
+
window.history.replaceState(null, "", cleanedUpUrl);
|
|
149
|
+
while (window.location.href !== cleanedUpUrl) {
|
|
160
150
|
// Poll the current URL every ms. Active polling is required because
|
|
161
151
|
// window.history.replaceState is asynchronous, but the associated
|
|
162
152
|
// 'popstate' event which should be listened to is only sent on active
|