Skip to content

The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:

Move builtin auth plugin registration into the auth module (#79798)

Romeo Van Snick7d228d6fbe56
diff --git a/frontend/src/metabase/app.tsx b/frontend/src/metabase/app.tsx
index 4b6ebd755a1..ca863928fcd 100644
--- a/frontend/src/metabase/app.tsx
+++ b/frontend/src/metabase/app.tsx
@@ -16,7 +16,7 @@ import "metabase/utils/i18n";
import "metabase/ui/colors";
// NOTE: this loads all builtin plugins
-import "metabase/plugins/builtin";
+import "metabase/auth/plugins";
// This is conditionally aliased in the webpack config.
// If EE isn't enabled, it loads an empty file.
diff --git a/frontend/src/metabase/auth/components/Login/tests/common.unit.spec.tsx b/frontend/src/metabase/auth/components/Login/tests/common.unit.spec.tsx
index 64274bcc2e7..d7298315ad5 100644
--- a/frontend/src/metabase/auth/components/Login/tests/common.unit.spec.tsx
+++ b/frontend/src/metabase/auth/components/Login/tests/common.unit.spec.tsx
@@ -1,4 +1,4 @@
-import "metabase/plugins/builtin";
+import "metabase/auth/plugins";
import { screen } from "__support__/ui";
import { setup } from "./setup";
diff --git a/frontend/src/metabase/auth/components/Login/tests/enterprise.unit.spec.tsx b/frontend/src/metabase/auth/components/Login/tests/enterprise.unit.spec.tsx
index 14fc8a005ae..1b7692068cd 100644
--- a/frontend/src/metabase/auth/components/Login/tests/enterprise.unit.spec.tsx
+++ b/frontend/src/metabase/auth/components/Login/tests/enterprise.unit.spec.tsx
@@ -1,4 +1,4 @@
-import "metabase/plugins/builtin";
+import "metabase/auth/plugins";
import { screen } from "__support__/ui";
import { setup } from "./setup";
diff --git a/frontend/src/metabase/auth/components/PasswordPanel/PasswordPanel.unit.spec.tsx b/frontend/src/metabase/auth/components/PasswordPanel/PasswordPanel.unit.spec.tsx
index c1ff26ff457..7c5113f405a 100644
--- a/frontend/src/metabase/auth/components/PasswordPanel/PasswordPanel.unit.spec.tsx
+++ b/frontend/src/metabase/auth/components/PasswordPanel/PasswordPanel.unit.spec.tsx
@@ -1,4 +1,4 @@
-import "metabase/plugins/builtin";
+import "metabase/auth/plugins";
import userEvent from "@testing-library/user-event";
import fetchMock from "fetch-mock";
diff --git a/frontend/src/metabase/plugins/builtin/auth/google.ts b/frontend/src/metabase/auth/plugins/google.ts
similarity index 71%
rename from frontend/src/metabase/plugins/builtin/auth/google.ts
rename to frontend/src/metabase/auth/plugins/google.ts
index e5d50895e73..a3e725d9998 100644
--- a/frontend/src/metabase/plugins/builtin/auth/google.ts
+++ b/frontend/src/metabase/auth/plugins/google.ts
@@ -1,3 +1,4 @@
+import { GoogleButton } from "metabase/auth/components/GoogleButton";
import {
PLUGIN_AUTH_PROVIDERS,
PLUGIN_IS_PASSWORD_USER,
@@ -7,9 +8,7 @@ import MetabaseSettings from "metabase/utils/settings";
PLUGIN_AUTH_PROVIDERS.providers.push((providers) => {
const googleProvider = {
name: "google",
- // circular dependencies
- // eslint-disable-next-line @typescript-eslint/no-require-imports
- Button: require("metabase/auth/components/GoogleButton").GoogleButton,
+ Button: GoogleButton,
};
return MetabaseSettings.isGoogleAuthEnabled()
diff --git a/frontend/src/metabase/auth/plugins/index.ts b/frontend/src/metabase/auth/plugins/index.ts
new file mode 100644
index 00000000000..825bcdf9e89
--- /dev/null
+++ b/frontend/src/metabase/auth/plugins/index.ts
@@ -0,0 +1,5 @@
+import "./password";
+import "./google";
+import "./ldap";
+import "./jwt";
+import "./saml";
diff --git a/frontend/src/metabase/plugins/builtin/auth/jwt.ts b/frontend/src/metabase/auth/plugins/jwt.ts
similarity index 100%
rename from frontend/src/metabase/plugins/builtin/auth/jwt.ts
rename to frontend/src/metabase/auth/plugins/jwt.ts
diff --git a/frontend/src/metabase/plugins/builtin/auth/ldap.ts b/frontend/src/metabase/auth/plugins/ldap.ts
similarity index 100%
rename from frontend/src/metabase/plugins/builtin/auth/ldap.ts
rename to frontend/src/metabase/auth/plugins/ldap.ts
diff --git a/frontend/src/metabase/auth/plugins/password.ts b/frontend/src/metabase/auth/plugins/password.ts
new file mode 100644
index 00000000000..f7da5f89eae
--- /dev/null
+++ b/frontend/src/metabase/auth/plugins/password.ts
@@ -0,0 +1,13 @@
+import { PasswordButton } from "metabase/auth/components/PasswordButton";
+import { PasswordPanel } from "metabase/auth/components/PasswordPanel";
+import { PLUGIN_AUTH_PROVIDERS } from "metabase/plugins";
+
+PLUGIN_AUTH_PROVIDERS.providers.push((providers) => {
+ const passwordProvider = {
+ name: "password",
+ Button: PasswordButton,
+ Panel: PasswordPanel,
+ };
+
+ return [...providers, passwordProvider];
+});
diff --git a/frontend/src/metabase/plugins/builtin/auth/saml.ts b/frontend/src/metabase/auth/plugins/saml.ts
similarity index 100%
rename from frontend/src/metabase/plugins/builtin/auth/saml.ts
rename to frontend/src/metabase/auth/plugins/saml.ts
diff --git a/frontend/src/metabase/plugins/builtin.ts b/frontend/src/metabase/plugins/builtin.ts
deleted file mode 100644
index eada13c207c..00000000000
--- a/frontend/src/metabase/plugins/builtin.ts
+++ /dev/null
@@ -1,5 +0,0 @@
-import "metabase/plugins/builtin/auth/password";
-import "metabase/plugins/builtin/auth/google";
-import "metabase/plugins/builtin/auth/ldap";
-import "metabase/plugins/builtin/auth/jwt";
-import "metabase/plugins/builtin/auth/saml";
diff --git a/frontend/src/metabase/plugins/builtin/auth/password.ts b/frontend/src/metabase/plugins/builtin/auth/password.ts
deleted file mode 100644
index 793508bcac4..00000000000
--- a/frontend/src/metabase/plugins/builtin/auth/password.ts
+++ /dev/null
@@ -1,14 +0,0 @@
-import { PLUGIN_AUTH_PROVIDERS } from "metabase/plugins";
-
-PLUGIN_AUTH_PROVIDERS.providers.push((providers) => {
- const passwordProvider = {
- name: "password",
- // circular dependencies
- // eslint-disable-next-line @typescript-eslint/no-require-imports
- Button: require("metabase/auth/components/PasswordButton").PasswordButton,
- // eslint-disable-next-line @typescript-eslint/no-require-imports
- Panel: require("metabase/auth/components/PasswordPanel").PasswordPanel,
- };
-
- return [...providers, passwordProvider];
-});