From 74227770cb2f980baeae09685b261c89b922d361 Mon Sep 17 00:00:00 2001 From: garciafdezpatricia Date: Thu, 20 Jun 2024 15:57:23 +0200 Subject: [PATCH] updated libs, changed e2e and URL.canParse - Updated @inrupt/solid-client-authn-browser and @inrupt/solid-client-authn-node to last version, with the bug fix for the parsing of clientAppId. - Added a workaround for URL.canParse as lint was complaining about it. - Updated index e2e test as it was before to check if it still needs the change. --- e2e/index.playwright.ts | 11 +++--- package-lock.json | 58 ++++++++++++++++---------------- package.json | 4 +-- src/components/Header/Header.tsx | 12 ++++++- 4 files changed, 48 insertions(+), 37 deletions(-) diff --git a/e2e/index.playwright.ts b/e2e/index.playwright.ts index e76c6b3..7f23162 100644 --- a/e2e/index.playwright.ts +++ b/e2e/index.playwright.ts @@ -54,13 +54,14 @@ test("user can login into the application", async ({ await setup(); await login(); - // As we now distinguish between idp and app logouts, this logout won't - // cause a redirection through the idp logout page anymore, as, locally, - // the AMC does not have a Solid-OIDc client ID, and hence the logout will - // be treated as an app logout. + const endpointRequest = page.waitForRequest((request) => + request.url().startsWith(endSessionEndpoint) + ); await page.getByTestId("logout-button").click(); + // Redirect through the idp logout page + await endpointRequest; - await page.waitForURL(new URL("login", AMI_URL).href); + await page.waitForURL(new URL("login?returnTo=%2F", AMI_URL).href); // Land back at the applications login page await login(); diff --git a/package-lock.json b/package-lock.json index 6a286a0..8e0794e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14,8 +14,8 @@ "@comunica/core": "^2.8.1", "@inrupt/solid-client": "^1.23.3", "@inrupt/solid-client-access-grants": "^3.0.4", - "@inrupt/solid-client-authn-browser": "^2.0.0", - "@inrupt/solid-client-authn-node": "^2.0.0", + "@inrupt/solid-client-authn-browser": "^2.2.3", + "@inrupt/solid-client-authn-node": "^2.2.3", "@inrupt/solid-client-vc": "^1.0.0", "@popperjs/core": "^2.11.8", "@rdfjs/types": "^1.1.0", @@ -2163,12 +2163,12 @@ } }, "node_modules/@inrupt/oidc-client-ext": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/@inrupt/oidc-client-ext/-/oidc-client-ext-2.0.0.tgz", - "integrity": "sha512-SYkesE26mXXIyNInq1XwEZd97yfk0nj3xXbreEmPX8pqbOi6fHhACKrg33KHTVTMuZIe1D+xJs5QA0GhxLf+eg==", + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/@inrupt/oidc-client-ext/-/oidc-client-ext-2.2.3.tgz", + "integrity": "sha512-Sh6TSN4t+Aka6p7gL/Q0RDVLKYCmlO5AGOqJg4QQEJ3mwX4aKMVZJDx1dnx6RXRCW2QbGdh1eu/5/YxrPg+l7g==", "dependencies": { "@inrupt/oidc-client": "^1.11.6", - "@inrupt/solid-client-authn-core": "^2.0.0", + "@inrupt/solid-client-authn-core": "^2.2.3", "jose": "^5.1.3", "uuid": "^9.0.1" } @@ -2235,21 +2235,21 @@ } }, "node_modules/@inrupt/solid-client-authn-browser": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/@inrupt/solid-client-authn-browser/-/solid-client-authn-browser-2.0.0.tgz", - "integrity": "sha512-Y+BczY8T2Xpfp2Obd3IAvlF91UCEgQMed2+9LM6FCBkVkk03CqbFL80ebO7mYd6woVVlIeC+8IB2UrRlNHqlkA==", + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/@inrupt/solid-client-authn-browser/-/solid-client-authn-browser-2.2.3.tgz", + "integrity": "sha512-kIucVLK16qKqpitj96iX6yTVFopiPt4AXAHt2aVoPB/5BX/sVY3BBPqe6RWQMI6X4ODLST+P2gXO5knV7pMc2g==", "dependencies": { - "@inrupt/oidc-client-ext": "^2.0.0", - "@inrupt/solid-client-authn-core": "^2.0.0", + "@inrupt/oidc-client-ext": "^2.2.3", + "@inrupt/solid-client-authn-core": "^2.2.3", "events": "^3.3.0", "jose": "^5.1.3", "uuid": "^9.0.1" } }, "node_modules/@inrupt/solid-client-authn-core": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/@inrupt/solid-client-authn-core/-/solid-client-authn-core-2.0.0.tgz", - "integrity": "sha512-qM+E9I5u2DFlsfyoXossx8w0vKv8p+rXH98K9RUauJImpygQ3I3Ra6hSB2bwA1PdPQd5ttNg236oKe1sTT6Hqw==", + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/@inrupt/solid-client-authn-core/-/solid-client-authn-core-2.2.3.tgz", + "integrity": "sha512-fn9ngy5mcgXH59s6cyDVZeG5N40WNOU6EfHMKS5ky6Hdk3izuFGcVPn01dS6TePk/wfXTPyreA+gvAi+1E5UWA==", "dependencies": { "events": "^3.3.0", "jose": "^5.1.3", @@ -2260,13 +2260,13 @@ } }, "node_modules/@inrupt/solid-client-authn-node": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/@inrupt/solid-client-authn-node/-/solid-client-authn-node-2.0.0.tgz", - "integrity": "sha512-S1vGRodX0MSAKR3B6tm4qUvMhGv0sMcFjYyhVil7isoRI/7ei5QTpm+081RTWe6/cv4WI6UiHER3YIG15uwhhg==", + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/@inrupt/solid-client-authn-node/-/solid-client-authn-node-2.2.3.tgz", + "integrity": "sha512-Ds57MFZ8XMyJqhCPpuj3cOfbudPbp0tZ/x187kmJsB2Ir4qLB6/O8Od+DN7SXzcnJjM/TrwZ34THklVxzXid8A==", "dependencies": { - "@inrupt/solid-client-authn-core": "^2.0.0", + "@inrupt/solid-client-authn-core": "^2.2.3", "jose": "^5.1.3", - "openid-client": "~5.6.1", + "openid-client": "^5.6.5", "uuid": "^9.0.1" }, "engines": { @@ -5724,9 +5724,9 @@ "dev": true }, "node_modules/core-js": { - "version": "3.35.0", - "resolved": "https://registry.npmjs.org/core-js/-/core-js-3.35.0.tgz", - "integrity": "sha512-ntakECeqg81KqMueeGJ79Q5ZgQNR+6eaE8sxGCx62zMbAIj65q+uYvatToew3m6eAGdU4gNZwpZ34NMe4GYswg==", + "version": "3.37.1", + "resolved": "https://registry.npmjs.org/core-js/-/core-js-3.37.1.tgz", + "integrity": "sha512-Xn6qmxrQZyB0FFY8E3bgRXei3lWDJHhvI+u0q9TKIYM49G8pAr0FgnnrFRAmsbptZL1yxRADVXn+x5AGsbBfyw==", "hasInstallScript": true, "funding": { "type": "opencollective", @@ -10443,11 +10443,11 @@ } }, "node_modules/openid-client": { - "version": "5.6.4", - "resolved": "https://registry.npmjs.org/openid-client/-/openid-client-5.6.4.tgz", - "integrity": "sha512-T1h3B10BRPKfcObdBklX639tVz+xh34O7GjofqrqiAQdm7eHsQ00ih18x6wuJ/E6FxdtS2u3FmUGPDeEcMwzNA==", + "version": "5.6.5", + "resolved": "https://registry.npmjs.org/openid-client/-/openid-client-5.6.5.tgz", + "integrity": "sha512-5P4qO9nGJzB5PI0LFlhj4Dzg3m4odt0qsJTfyEtZyOlkgpILwEioOhVVJOrS1iVH494S4Ee5OCjjg6Bf5WOj3w==", "dependencies": { - "jose": "^4.15.4", + "jose": "^4.15.5", "lru-cache": "^6.0.0", "object-hash": "^2.2.0", "oidc-token-hash": "^5.0.3" @@ -10457,9 +10457,9 @@ } }, "node_modules/openid-client/node_modules/jose": { - "version": "4.15.5", - "resolved": "https://registry.npmjs.org/jose/-/jose-4.15.5.tgz", - "integrity": "sha512-jc7BFxgKPKi94uOvEmzlSWFFe2+vASyXaKUpdQKatWAESU2MWjDfFf0fdfc83CDKcA5QecabZeNLyfhe3yKNkg==", + "version": "4.15.7", + "resolved": "https://registry.npmjs.org/jose/-/jose-4.15.7.tgz", + "integrity": "sha512-L7ioP+JAuZe8v+T5+zVI9Tx8LtU8BL7NxkyDFVMv+Qr3JW0jSoYDedLtodaXwfqMpeCyx4WXFNyu9tJt4WvC1A==", "funding": { "url": "https://github.com/sponsors/panva" } diff --git a/package.json b/package.json index dc8d3b5..d55c26f 100644 --- a/package.json +++ b/package.json @@ -30,8 +30,8 @@ "@comunica/core": "^2.8.1", "@inrupt/solid-client": "^1.23.3", "@inrupt/solid-client-access-grants": "^3.0.4", - "@inrupt/solid-client-authn-browser": "^2.0.0", - "@inrupt/solid-client-authn-node": "^2.0.0", + "@inrupt/solid-client-authn-browser": "^2.2.3", + "@inrupt/solid-client-authn-node": "^2.2.3", "@inrupt/solid-client-vc": "^1.0.0", "@popperjs/core": "^2.11.8", "@rdfjs/types": "^1.1.0", diff --git a/src/components/Header/Header.tsx b/src/components/Header/Header.tsx index 001e36c..afb457d 100644 --- a/src/components/Header/Header.tsx +++ b/src/components/Header/Header.tsx @@ -34,6 +34,16 @@ export default function Header({ }) { const { logout, session } = useContext(SessionContext); + const isUrl = (candidateUrl: string | URL) => { + try { + // If url is not URL-shaped, this will throw + new URL(candidateUrl); + return true; + } catch (_e) { + return false; + } + }; + /** * Handles the logout process of the application, which can be of two types: app logout and idp logout. * @@ -48,7 +58,7 @@ export default function Header({ const handleLogout = async () => { if ( session.info.clientAppId !== undefined && - URL.canParse(session.info.clientAppId) + isUrl(session.info.clientAppId) ) { await logout({ logoutType: "idp",