Skip to content

Commit

Permalink
updated libs, changed e2e and URL.canParse
Browse files Browse the repository at this point in the history
- 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.
  • Loading branch information
garciafdezpatricia committed Jun 20, 2024
1 parent 316569c commit 7422777
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 37 deletions.
11 changes: 6 additions & 5 deletions e2e/index.playwright.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
58 changes: 29 additions & 29 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
12 changes: 11 additions & 1 deletion src/components/Header/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand All @@ -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",
Expand Down

0 comments on commit 7422777

Please sign in to comment.