diff --git a/package-lock.json b/package-lock.json index 589dfa2..7d4144a 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.4", + "@inrupt/solid-client-authn-node": "^2.2.4", "@inrupt/solid-client-vc": "^1.0.0", "@popperjs/core": "^2.11.8", "@rdfjs/types": "^1.1.0", @@ -2177,14 +2177,26 @@ } }, "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.4", + "resolved": "https://registry.npmjs.org/@inrupt/oidc-client-ext/-/oidc-client-ext-2.2.4.tgz", + "integrity": "sha512-jQw7WgZdNC1xJxtMCN5sCLhf1//YWUNvylsNuOrrbTHTiY4dFq2A24k84eRXPYXQLoJ5i3cs3B5qlRdXBxy2MQ==", "dependencies": { "@inrupt/oidc-client": "^1.11.6", - "@inrupt/solid-client-authn-core": "^2.0.0", + "@inrupt/solid-client-authn-core": "^2.2.4", "jose": "^5.1.3", - "uuid": "^9.0.1" + "uuid": "^10.0.0" + } + }, + "node_modules/@inrupt/oidc-client-ext/node_modules/uuid": { + "version": "10.0.0", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-10.0.0.tgz", + "integrity": "sha512-8XkAphELsDnEGrDxUOHB3RGvXz6TeuYSGEZBOjtTtPm2lwhGBjLgOzLHB63IUWfBpNucQjND6d3AOudO+H3RWQ==", + "funding": [ + "https://github.com/sponsors/broofa", + "https://github.com/sponsors/ctavan" + ], + "bin": { + "uuid": "dist/bin/uuid" } }, "node_modules/@inrupt/solid-client": { @@ -2249,44 +2261,80 @@ } }, "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.4", + "resolved": "https://registry.npmjs.org/@inrupt/solid-client-authn-browser/-/solid-client-authn-browser-2.2.4.tgz", + "integrity": "sha512-MByDT1KpiWI7BSnlTdKQnideO93IDuIOfz0C/GNJmiKpqwZ58rTu1+kr6AzcIpjI5HfqPfwQRCM6rgKM/5rOJg==", "dependencies": { - "@inrupt/oidc-client-ext": "^2.0.0", - "@inrupt/solid-client-authn-core": "^2.0.0", + "@inrupt/oidc-client-ext": "^2.2.4", + "@inrupt/solid-client-authn-core": "^2.2.4", "events": "^3.3.0", "jose": "^5.1.3", - "uuid": "^9.0.1" + "uuid": "^10.0.0" + } + }, + "node_modules/@inrupt/solid-client-authn-browser/node_modules/uuid": { + "version": "10.0.0", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-10.0.0.tgz", + "integrity": "sha512-8XkAphELsDnEGrDxUOHB3RGvXz6TeuYSGEZBOjtTtPm2lwhGBjLgOzLHB63IUWfBpNucQjND6d3AOudO+H3RWQ==", + "funding": [ + "https://github.com/sponsors/broofa", + "https://github.com/sponsors/ctavan" + ], + "bin": { + "uuid": "dist/bin/uuid" } }, "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.4", + "resolved": "https://registry.npmjs.org/@inrupt/solid-client-authn-core/-/solid-client-authn-core-2.2.4.tgz", + "integrity": "sha512-PpH6ftxdhFvbSs4Mo/YJ9RrTF5xg/g1DX4AAoZHWoEkrGmnMAfgkG2kpq9+5tvLG9N52ja+CGbUNy3lHfpt6vw==", "dependencies": { "events": "^3.3.0", "jose": "^5.1.3", - "uuid": "^9.0.1" + "uuid": "^10.0.0" }, "engines": { "node": "^18.0.0 || ^20.0.0" } }, + "node_modules/@inrupt/solid-client-authn-core/node_modules/uuid": { + "version": "10.0.0", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-10.0.0.tgz", + "integrity": "sha512-8XkAphELsDnEGrDxUOHB3RGvXz6TeuYSGEZBOjtTtPm2lwhGBjLgOzLHB63IUWfBpNucQjND6d3AOudO+H3RWQ==", + "funding": [ + "https://github.com/sponsors/broofa", + "https://github.com/sponsors/ctavan" + ], + "bin": { + "uuid": "dist/bin/uuid" + } + }, "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.4", + "resolved": "https://registry.npmjs.org/@inrupt/solid-client-authn-node/-/solid-client-authn-node-2.2.4.tgz", + "integrity": "sha512-8rpvdXxfKx+FNFhCYCmNW9mqGuRmOPwA8PRJDhYNMjTf03jBge9baxx1andtyeXKhwZHWNcmmIg2a/GHTYe05w==", "dependencies": { - "@inrupt/solid-client-authn-core": "^2.0.0", + "@inrupt/solid-client-authn-core": "^2.2.4", "jose": "^5.1.3", - "openid-client": "~5.6.1", - "uuid": "^9.0.1" + "openid-client": "^5.6.5", + "uuid": "^10.0.0" }, "engines": { "node": "^18.0.0 || ^20.0.0" } }, + "node_modules/@inrupt/solid-client-authn-node/node_modules/uuid": { + "version": "10.0.0", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-10.0.0.tgz", + "integrity": "sha512-8XkAphELsDnEGrDxUOHB3RGvXz6TeuYSGEZBOjtTtPm2lwhGBjLgOzLHB63IUWfBpNucQjND6d3AOudO+H3RWQ==", + "funding": [ + "https://github.com/sponsors/broofa", + "https://github.com/sponsors/ctavan" + ], + "bin": { + "uuid": "dist/bin/uuid" + } + }, "node_modules/@inrupt/solid-client-vc": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/@inrupt/solid-client-vc/-/solid-client-vc-1.0.2.tgz", @@ -5436,9 +5484,9 @@ } }, "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", @@ -9751,11 +9799,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" @@ -9765,9 +9813,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 c2069fa..ee8dce3 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.4", + "@inrupt/solid-client-authn-node": "^2.2.4", "@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 8448707..afb457d 100644 --- a/src/components/Header/Header.tsx +++ b/src/components/Header/Header.tsx @@ -34,6 +34,41 @@ 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. + * + * For those OPs supporting Solid-OIDC Client Identifiers, the logout will log users out of their OP by + * redirecting them away from the application. For users to be redirected back, a post-logout URL must + * be included. This is handled by the IDP logout. + * For OPs that are not Solid-OIDC enabled, the log out will just clear any session data from the browser: + * it does not log the users out of their OP nor redirect them away. This is handled by the app logout. + * + * If the session client ID is a URL, the OP is Solid-OIDC enabled; otherwise, it is not. + */ + const handleLogout = async () => { + if ( + session.info.clientAppId !== undefined && + isUrl(session.info.clientAppId) + ) { + await logout({ + logoutType: "idp", + postLogoutUrl: new URL(window.origin).href, + }); + } else { + await logout({ logoutType: "app" }); + } + }; + return (
@@ -44,12 +79,7 @@ export default function Header({