OIDC: Persist details in session storage, create store (#11302)
* utils to persist clientId and issuer after oidc authentication * add dep oidc-client-ts * persist issuer and clientId after successful oidc auth * add OidcClientStore * comments and tidy * format
This commit is contained in:
parent
882c85a028
commit
0b0d77cbcc
11 changed files with 446 additions and 2 deletions
|
@ -887,6 +887,15 @@ describe("<MatrixChat />", () => {
|
|||
|
||||
expect(loginClient.clearStores).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("should not store clientId or issuer", async () => {
|
||||
getComponent({ realQueryParams });
|
||||
|
||||
await flushPromises();
|
||||
|
||||
expect(sessionStorageSetSpy).not.toHaveBeenCalledWith("mx_oidc_client_id", clientId);
|
||||
expect(sessionStorageSetSpy).not.toHaveBeenCalledWith("mx_oidc_token_issuer", issuer);
|
||||
});
|
||||
});
|
||||
|
||||
describe("when login succeeds", () => {
|
||||
|
@ -911,6 +920,15 @@ describe("<MatrixChat />", () => {
|
|||
expect(localStorageSetSpy).toHaveBeenCalledWith("mx_device_id", deviceId);
|
||||
});
|
||||
|
||||
it("should store clientId and issuer in session storage", async () => {
|
||||
getComponent({ realQueryParams });
|
||||
|
||||
await flushPromises();
|
||||
|
||||
expect(sessionStorageSetSpy).toHaveBeenCalledWith("mx_oidc_client_id", clientId);
|
||||
expect(sessionStorageSetSpy).toHaveBeenCalledWith("mx_oidc_token_issuer", issuer);
|
||||
});
|
||||
|
||||
it("should set logged in and start MatrixClient", async () => {
|
||||
getComponent({ realQueryParams });
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue