-
Notifications
You must be signed in to change notification settings - Fork 119
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5093 from gooddata/pb-deauth-returnurl
feat: support returnTo with deauthenticate
- Loading branch information
Showing
10 changed files
with
72 additions
and
17 deletions.
There are no files selected for viewing
10 changes: 10 additions & 0 deletions
10
common/changes/@gooddata/sdk-ui-all/pb-deauth-returnurl_2024-07-02-12-13.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"changes": [ | ||
{ | ||
"packageName": "@gooddata/sdk-ui-all", | ||
"comment": "Allow specifying returnTo parameter with backend deauthenticate", | ||
"type": "none" | ||
} | ||
], | ||
"packageName": "@gooddata/sdk-ui-all" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// (C) 2020-2024 GoodData Corporation | ||
import { ContextDeferredAuthProvider } from "../auth.js"; | ||
import { TigerBackend } from "../backend/index.js"; | ||
import { describe, expect, it, vi, beforeEach, afterEach } from "vitest"; | ||
|
||
describe("ContextDeferredAuthProvider", () => { | ||
describe("deauthenticate", () => { | ||
const hostname = "https://domain.gooddata.com"; | ||
let originalWindow; | ||
beforeEach(() => { | ||
originalWindow = global.window; | ||
}); | ||
|
||
afterEach(() => { | ||
global.window = originalWindow; | ||
}); | ||
|
||
it.each([ | ||
[undefined, `${hostname}/logout`], | ||
["https://redirect.gooddata.com", `${hostname}/logout?returnTo=https://redirect.gooddata.com`], | ||
])('should set deauthenticate for returnTo="%s" to be "%s"', async (returnTo, expectedLogoutUrl) => { | ||
const assign = vi.fn(); | ||
global.window = { | ||
location: { | ||
assign, | ||
}, | ||
} as any; | ||
const provider = new ContextDeferredAuthProvider(); | ||
const backend = new TigerBackend({ hostname }); | ||
const context = { | ||
backend, | ||
client: null, | ||
}; | ||
await provider.deauthenticate(context, returnTo); | ||
expect(assign).toHaveBeenCalledWith(expectedLogoutUrl); | ||
}); | ||
}); | ||
}); |