mirror of
https://github.com/Termix-SSH/Termix.git
synced 2026-10-29 14:45:24 +00:00
feat: move sso and ldap logins into plugins (C2)
This commit is contained in:
1 parent
5c18435105
commit
925da4a661
223 files changed
+25778
-6820
No files matched your search
@@ -21,7 +21,6 @@ const mainAxios = vi.hoisted(() => ({
|
||||
initiatePasswordReset: vi.fn(),
|
||||
verifyPasswordResetCode: vi.fn(),
|
||||
completePasswordReset: vi.fn(),
|
||||
getOIDCAuthorizeUrl: vi.fn(),
|
||||
isElectron: vi.fn(),
|
||||
getCurrentToken: vi.fn(),
|
||||
getOidcSilentLoginDefault: vi.fn(),
|
||||
@@ -29,13 +28,7 @@ const mainAxios = vi.hoisted(() => ({
|
||||
requestTrustedProxyLogin: vi.fn(),
|
||||
}));
|
||||
|
||||
const ssoProviderApi = vi.hoisted(() => ({
|
||||
getSSOProviders: vi.fn(),
|
||||
ldapLogin: vi.fn(),
|
||||
}));
|
||||
|
||||
vi.mock("@/main-axios", () => mainAxios);
|
||||
vi.mock("@/api/sso-provider-api", () => ssoProviderApi);
|
||||
vi.mock("@/i18n/i18n", () => ({
|
||||
changeAppLanguage: vi.fn(async (code: string) => code),
|
||||
normalizeLanguageCode: vi.fn((code: string | null) => code || "en"),
|
||||
@@ -102,7 +95,6 @@ beforeEach(() => {
|
||||
enabled: false,
|
||||
success: false,
|
||||
});
|
||||
ssoProviderApi.getSSOProviders.mockResolvedValue([]);
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
|
||||
@@ -31,16 +31,10 @@ vi.mock("@/main-axios", () => ({
|
||||
initiatePasswordReset: vi.fn(),
|
||||
verifyPasswordResetCode: vi.fn(),
|
||||
completePasswordReset: vi.fn(),
|
||||
getOIDCAuthorizeUrl: vi.fn(),
|
||||
getCurrentToken: vi.fn().mockReturnValue(null),
|
||||
requestTrustedProxyLogin: vi.fn(),
|
||||
}));
|
||||
|
||||
vi.mock("@/api/sso-provider-api", () => ({
|
||||
getSSOProviders: vi.fn().mockResolvedValue([]),
|
||||
ldapLogin: vi.fn(),
|
||||
}));
|
||||
|
||||
import { Auth } from "@/auth/Auth";
|
||||
|
||||
function setEmbeddedServerStatus(failure: unknown) {
|
||||
|
||||
@@ -116,9 +116,9 @@ beforeEach(() => {
|
||||
},
|
||||
{
|
||||
id: "oidc",
|
||||
pluginId: "core",
|
||||
pluginId: "sso",
|
||||
kind: "redirect",
|
||||
labelKey: "auth.loginWithSso",
|
||||
labelKey: "loginWithSso",
|
||||
instances: [{ id: "3", label: "Keycloak" }],
|
||||
},
|
||||
{
|
||||
@@ -149,10 +149,10 @@ async function openExternalTab() {
|
||||
}
|
||||
|
||||
describe("login methods on the login screen", () => {
|
||||
it("lists every enabled method, core and plugin", async () => {
|
||||
it("lists every enabled method", async () => {
|
||||
await openExternalTab();
|
||||
// A redirect method whose plugin UI is not loaded gets a plain button.
|
||||
expect(screen.getByText("auth.loginWithProvider:Keycloak")).toBeTruthy();
|
||||
// A plugin redirect method with no UI of its own gets a plain button.
|
||||
expect(screen.getByText("auth.loginWithProvider:Corp")).toBeTruthy();
|
||||
});
|
||||
|
||||
|
||||
Reference in new issue
Block a user