From 76eb60633583acb068b9fd4890628a19a09ec9aa Mon Sep 17 00:00:00 2001 From: Gucheng Wang Date: Thu, 23 Mar 2023 22:37:53 +0800 Subject: [PATCH] Support AAD tenant auth URL --- web/src/ProviderEditPage.js | 2 +- web/src/auth/Provider.js | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/web/src/ProviderEditPage.js b/web/src/ProviderEditPage.js index a657dcd0..0b5446fb 100644 --- a/web/src/ProviderEditPage.js +++ b/web/src/ProviderEditPage.js @@ -484,7 +484,7 @@ class ProviderEditPage extends React.Component { ) } { - this.state.provider.type !== "Adfs" && this.state.provider.type !== "Casdoor" && this.state.provider.type !== "Okta" ? null : ( + this.state.provider.type !== "Adfs" && this.state.provider.type !== "AzureAD" && this.state.provider.type !== "Casdoor" && this.state.provider.type !== "Okta" ? null : ( {Setting.getLabel(i18next.t("provider:Domain"), i18next.t("provider:Domain - Tooltip"))} : diff --git a/web/src/auth/Provider.js b/web/src/auth/Provider.js index 0b7ec59f..b1d84ba2 100644 --- a/web/src/auth/Provider.js +++ b/web/src/auth/Provider.js @@ -378,6 +378,12 @@ export function getAuthUrl(application, provider, method) { const state = Util.getStateFromQueryParams(application.name, provider.name, method, isShortState); const codeChallenge = "P3S-a7dr8bgM4bF6vOyiKkKETDl16rcAzao9F8UIL1Y"; // SHA256(Base64-URL-encode("casdoor-verifier")) + if (provider.type === "AzureAD") { + if (provider.domain !== "") { + endpoint = endpoint.replace("common", provider.domain); + } + } + if (provider.type === "Google" || provider.type === "GitHub" || provider.type === "QQ" || provider.type === "Facebook" || provider.type === "Weibo" || provider.type === "Gitee" || provider.type === "LinkedIn" || provider.type === "GitLab" || provider.type === "AzureAD" || provider.type === "Slack" || provider.type === "Line" || provider.type === "Amazon" || provider.type === "Auth0" || provider.type === "BattleNet"