openapi-explorer 1.0.534 → 1.0.537
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.
|
@@ -480,6 +480,13 @@ export default class OpenApiExplorer extends LitElement {
|
|
|
480
480
|
this.resolvedSpec = null;
|
|
481
481
|
console.error('OpenAPI Explorer: Unable to resolve the API spec..', err); // eslint-disable-line no-console
|
|
482
482
|
}
|
|
483
|
+
|
|
484
|
+
try {
|
|
485
|
+
await checkForAuthToken.call(this);
|
|
486
|
+
} catch (error) {
|
|
487
|
+
// eslint-disable-next-line no-console
|
|
488
|
+
console.error('Failed to check for authentication token', error);
|
|
489
|
+
}
|
|
483
490
|
} // Public Method
|
|
484
491
|
|
|
485
492
|
|
|
@@ -163,11 +163,22 @@ export async function checkForAuthToken(redirectToApiLocation) {
|
|
|
163
163
|
|
|
164
164
|
const sanitizedUrlWithHash = newUrl.toString().replace(/#((code|state|access_token|id_token|authuser|expires_in|hd|prompt|scope|token_type)=[^&]+&?)*$/ig, '');
|
|
165
165
|
history.replaceState({}, undefined, sanitizedUrlWithHash);
|
|
166
|
+
let parsedState;
|
|
167
|
+
|
|
168
|
+
try {
|
|
169
|
+
// If somehow the state contains a question mark, just remove it, a ? is not a valid here
|
|
170
|
+
parsedState = JSON.parse(base64url.decode(parameters.state.replace(/\?.*$/, '')));
|
|
171
|
+
} catch (error) {
|
|
172
|
+
// eslint-disable-next-line no-console
|
|
173
|
+
console.error('The state parameter in the OAuth response is invalid', error, parameters.state);
|
|
174
|
+
return;
|
|
175
|
+
}
|
|
176
|
+
|
|
166
177
|
const {
|
|
167
178
|
apiKeyId,
|
|
168
179
|
flowId,
|
|
169
180
|
url
|
|
170
|
-
} =
|
|
181
|
+
} = parsedState;
|
|
171
182
|
|
|
172
183
|
if (redirectToApiLocation && url && !parameters.redirect_auth) {
|
|
173
184
|
const apiExplorerLocation = new URL(url);
|
|
@@ -521,6 +521,13 @@ class OpenApiExplorer extends _lit.LitElement {
|
|
|
521
521
|
this.resolvedSpec = null;
|
|
522
522
|
console.error('OpenAPI Explorer: Unable to resolve the API spec..', err); // eslint-disable-line no-console
|
|
523
523
|
}
|
|
524
|
+
|
|
525
|
+
try {
|
|
526
|
+
await _securitySchemeTemplate.checkForAuthToken.call(this);
|
|
527
|
+
} catch (error) {
|
|
528
|
+
// eslint-disable-next-line no-console
|
|
529
|
+
console.error('Failed to check for authentication token', error);
|
|
530
|
+
}
|
|
524
531
|
} // Public Method
|
|
525
532
|
|
|
526
533
|
|
|
@@ -176,11 +176,22 @@ async function checkForAuthToken(redirectToApiLocation) {
|
|
|
176
176
|
|
|
177
177
|
const sanitizedUrlWithHash = newUrl.toString().replace(/#((code|state|access_token|id_token|authuser|expires_in|hd|prompt|scope|token_type)=[^&]+&?)*$/ig, '');
|
|
178
178
|
history.replaceState({}, undefined, sanitizedUrlWithHash);
|
|
179
|
+
let parsedState;
|
|
180
|
+
|
|
181
|
+
try {
|
|
182
|
+
// If somehow the state contains a question mark, just remove it, a ? is not a valid here
|
|
183
|
+
parsedState = JSON.parse(_base64url.default.decode(parameters.state.replace(/\?.*$/, '')));
|
|
184
|
+
} catch (error) {
|
|
185
|
+
// eslint-disable-next-line no-console
|
|
186
|
+
console.error('The state parameter in the OAuth response is invalid', error, parameters.state);
|
|
187
|
+
return;
|
|
188
|
+
}
|
|
189
|
+
|
|
179
190
|
const {
|
|
180
191
|
apiKeyId,
|
|
181
192
|
flowId,
|
|
182
193
|
url
|
|
183
|
-
} =
|
|
194
|
+
} = parsedState;
|
|
184
195
|
|
|
185
196
|
if (redirectToApiLocation && url && !parameters.redirect_auth) {
|
|
186
197
|
const apiExplorerLocation = new URL(url);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "openapi-explorer",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.537",
|
|
4
4
|
"description": "OpenAPI Explorer - API viewer with dynamically generated components, documentation, and interaction console",
|
|
5
5
|
"author": "Rhosys Developers <developers@rhosys.ch>",
|
|
6
6
|
"type": "module",
|