Fix OIDC delegated auth account url check (#12242)
* Fix OIDC delegated auth account url check Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Iterate Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Update tests Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --------- Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
parent
5f8a390f2e
commit
36c07be889
5 changed files with 9 additions and 4 deletions
|
@ -37,7 +37,9 @@ export class OidcClientStore {
|
|||
if (this.authenticatedIssuer) {
|
||||
this.getOidcClient();
|
||||
} else {
|
||||
this._accountManagementEndpoint = getDelegatedAuthAccountUrl(matrixClient);
|
||||
matrixClient.waitForClientWellKnown().then((wellKnown) => {
|
||||
this._accountManagementEndpoint = getDelegatedAuthAccountUrl(wellKnown);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -38,6 +38,7 @@ import {
|
|||
filterConsole,
|
||||
flushPromises,
|
||||
getMockClientWithEventEmitter,
|
||||
mockClientMethodsServer,
|
||||
mockClientMethodsUser,
|
||||
MockClientWithEventEmitter,
|
||||
mockPlatformPeg,
|
||||
|
@ -73,6 +74,7 @@ describe("<MatrixChat />", () => {
|
|||
// reused in createClient mock below
|
||||
const getMockClientMethods = () => ({
|
||||
...mockClientMethodsUser(userId),
|
||||
...mockClientMethodsServer(),
|
||||
getVersions: jest.fn().mockResolvedValue({ versions: SERVER_SUPPORTED_MATRIX_VERSIONS }),
|
||||
startClient: jest.fn(),
|
||||
stopClient: jest.fn(),
|
||||
|
|
|
@ -42,6 +42,7 @@ import {
|
|||
flushPromises,
|
||||
getMockClientWithEventEmitter,
|
||||
mkPusher,
|
||||
mockClientMethodsServer,
|
||||
mockClientMethodsUser,
|
||||
mockPlatformPeg,
|
||||
} from "../../../../../test-utils";
|
||||
|
@ -167,6 +168,7 @@ describe("<SessionManagerTab />", () => {
|
|||
beforeEach(async () => {
|
||||
mockClient = getMockClientWithEventEmitter({
|
||||
...mockClientMethodsUser(aliceId),
|
||||
...mockClientMethodsServer(),
|
||||
getCrypto: jest.fn().mockReturnValue(mockCrypto),
|
||||
getDevices: jest.fn(),
|
||||
getStoredDevice: jest.fn(),
|
||||
|
@ -180,9 +182,6 @@ describe("<SessionManagerTab />", () => {
|
|||
getPushers: jest.fn(),
|
||||
setPusher: jest.fn(),
|
||||
setLocalNotificationSettings: jest.fn(),
|
||||
getVersions: jest.fn().mockResolvedValue({}),
|
||||
getCapabilities: jest.fn().mockResolvedValue({}),
|
||||
getClientWellKnown: jest.fn().mockReturnValue({}),
|
||||
});
|
||||
jest.clearAllMocks();
|
||||
jest.spyOn(logger, "error").mockRestore();
|
||||
|
|
|
@ -130,6 +130,7 @@ export const mockClientMethodsServer = (): Partial<Record<MethodLikeKeys<MatrixC
|
|||
getHomeserverUrl: jest.fn(),
|
||||
getCapabilities: jest.fn().mockReturnValue({}),
|
||||
getClientWellKnown: jest.fn().mockReturnValue({}),
|
||||
waitForClientWellKnown: jest.fn().mockResolvedValue({}),
|
||||
doesServerSupportUnstableFeature: jest.fn().mockResolvedValue(false),
|
||||
isVersionSupported: jest.fn().mockResolvedValue(false),
|
||||
getVersions: jest.fn().mockResolvedValue({}),
|
||||
|
|
|
@ -160,6 +160,7 @@ export function createTestClient(): MatrixClient {
|
|||
getProfileInfo: jest.fn().mockResolvedValue({}),
|
||||
getThirdpartyProtocols: jest.fn().mockResolvedValue({}),
|
||||
getClientWellKnown: jest.fn().mockReturnValue(null),
|
||||
waitForClientWellKnown: jest.fn().mockResolvedValue({}),
|
||||
supportsVoip: jest.fn().mockReturnValue(true),
|
||||
getTurnServers: jest.fn().mockReturnValue([]),
|
||||
getTurnServersExpiry: jest.fn().mockReturnValue(2 ^ 32),
|
||||
|
|
Loading…
Reference in a new issue