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>pull/28788/head^2
parent
5f8a390f2e
commit
36c07be889
|
@ -37,7 +37,9 @@ export class OidcClientStore {
|
||||||
if (this.authenticatedIssuer) {
|
if (this.authenticatedIssuer) {
|
||||||
this.getOidcClient();
|
this.getOidcClient();
|
||||||
} else {
|
} else {
|
||||||
this._accountManagementEndpoint = getDelegatedAuthAccountUrl(matrixClient);
|
matrixClient.waitForClientWellKnown().then((wellKnown) => {
|
||||||
|
this._accountManagementEndpoint = getDelegatedAuthAccountUrl(wellKnown);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -38,6 +38,7 @@ import {
|
||||||
filterConsole,
|
filterConsole,
|
||||||
flushPromises,
|
flushPromises,
|
||||||
getMockClientWithEventEmitter,
|
getMockClientWithEventEmitter,
|
||||||
|
mockClientMethodsServer,
|
||||||
mockClientMethodsUser,
|
mockClientMethodsUser,
|
||||||
MockClientWithEventEmitter,
|
MockClientWithEventEmitter,
|
||||||
mockPlatformPeg,
|
mockPlatformPeg,
|
||||||
|
@ -73,6 +74,7 @@ describe("<MatrixChat />", () => {
|
||||||
// reused in createClient mock below
|
// reused in createClient mock below
|
||||||
const getMockClientMethods = () => ({
|
const getMockClientMethods = () => ({
|
||||||
...mockClientMethodsUser(userId),
|
...mockClientMethodsUser(userId),
|
||||||
|
...mockClientMethodsServer(),
|
||||||
getVersions: jest.fn().mockResolvedValue({ versions: SERVER_SUPPORTED_MATRIX_VERSIONS }),
|
getVersions: jest.fn().mockResolvedValue({ versions: SERVER_SUPPORTED_MATRIX_VERSIONS }),
|
||||||
startClient: jest.fn(),
|
startClient: jest.fn(),
|
||||||
stopClient: jest.fn(),
|
stopClient: jest.fn(),
|
||||||
|
|
|
@ -42,6 +42,7 @@ import {
|
||||||
flushPromises,
|
flushPromises,
|
||||||
getMockClientWithEventEmitter,
|
getMockClientWithEventEmitter,
|
||||||
mkPusher,
|
mkPusher,
|
||||||
|
mockClientMethodsServer,
|
||||||
mockClientMethodsUser,
|
mockClientMethodsUser,
|
||||||
mockPlatformPeg,
|
mockPlatformPeg,
|
||||||
} from "../../../../../test-utils";
|
} from "../../../../../test-utils";
|
||||||
|
@ -167,6 +168,7 @@ describe("<SessionManagerTab />", () => {
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
mockClient = getMockClientWithEventEmitter({
|
mockClient = getMockClientWithEventEmitter({
|
||||||
...mockClientMethodsUser(aliceId),
|
...mockClientMethodsUser(aliceId),
|
||||||
|
...mockClientMethodsServer(),
|
||||||
getCrypto: jest.fn().mockReturnValue(mockCrypto),
|
getCrypto: jest.fn().mockReturnValue(mockCrypto),
|
||||||
getDevices: jest.fn(),
|
getDevices: jest.fn(),
|
||||||
getStoredDevice: jest.fn(),
|
getStoredDevice: jest.fn(),
|
||||||
|
@ -180,9 +182,6 @@ describe("<SessionManagerTab />", () => {
|
||||||
getPushers: jest.fn(),
|
getPushers: jest.fn(),
|
||||||
setPusher: jest.fn(),
|
setPusher: jest.fn(),
|
||||||
setLocalNotificationSettings: jest.fn(),
|
setLocalNotificationSettings: jest.fn(),
|
||||||
getVersions: jest.fn().mockResolvedValue({}),
|
|
||||||
getCapabilities: jest.fn().mockResolvedValue({}),
|
|
||||||
getClientWellKnown: jest.fn().mockReturnValue({}),
|
|
||||||
});
|
});
|
||||||
jest.clearAllMocks();
|
jest.clearAllMocks();
|
||||||
jest.spyOn(logger, "error").mockRestore();
|
jest.spyOn(logger, "error").mockRestore();
|
||||||
|
|
|
@ -130,6 +130,7 @@ export const mockClientMethodsServer = (): Partial<Record<MethodLikeKeys<MatrixC
|
||||||
getHomeserverUrl: jest.fn(),
|
getHomeserverUrl: jest.fn(),
|
||||||
getCapabilities: jest.fn().mockReturnValue({}),
|
getCapabilities: jest.fn().mockReturnValue({}),
|
||||||
getClientWellKnown: jest.fn().mockReturnValue({}),
|
getClientWellKnown: jest.fn().mockReturnValue({}),
|
||||||
|
waitForClientWellKnown: jest.fn().mockResolvedValue({}),
|
||||||
doesServerSupportUnstableFeature: jest.fn().mockResolvedValue(false),
|
doesServerSupportUnstableFeature: jest.fn().mockResolvedValue(false),
|
||||||
isVersionSupported: jest.fn().mockResolvedValue(false),
|
isVersionSupported: jest.fn().mockResolvedValue(false),
|
||||||
getVersions: jest.fn().mockResolvedValue({}),
|
getVersions: jest.fn().mockResolvedValue({}),
|
||||||
|
|
|
@ -160,6 +160,7 @@ export function createTestClient(): MatrixClient {
|
||||||
getProfileInfo: jest.fn().mockResolvedValue({}),
|
getProfileInfo: jest.fn().mockResolvedValue({}),
|
||||||
getThirdpartyProtocols: jest.fn().mockResolvedValue({}),
|
getThirdpartyProtocols: jest.fn().mockResolvedValue({}),
|
||||||
getClientWellKnown: jest.fn().mockReturnValue(null),
|
getClientWellKnown: jest.fn().mockReturnValue(null),
|
||||||
|
waitForClientWellKnown: jest.fn().mockResolvedValue({}),
|
||||||
supportsVoip: jest.fn().mockReturnValue(true),
|
supportsVoip: jest.fn().mockReturnValue(true),
|
||||||
getTurnServers: jest.fn().mockReturnValue([]),
|
getTurnServers: jest.fn().mockReturnValue([]),
|
||||||
getTurnServersExpiry: jest.fn().mockReturnValue(2 ^ 32),
|
getTurnServersExpiry: jest.fn().mockReturnValue(2 ^ 32),
|
||||||
|
|
Loading…
Reference in New Issue