diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index c6e18272..c4976ff4 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -31,6 +31,7 @@ jobs:
release:
name: Release
runs-on: ubuntu-latest
+ if: github.repository == 'casbin/casdoor' && github.event_name == 'push'
needs: [ frontend, backend ]
steps:
- name: Checkout
diff --git a/object/provider.go b/object/provider.go
index b37943dd..905f14fb 100644
--- a/object/provider.go
+++ b/object/provider.go
@@ -29,6 +29,7 @@ type Provider struct {
DisplayName string `xorm:"varchar(100)" json:"displayName"`
Category string `xorm:"varchar(100)" json:"category"`
Type string `xorm:"varchar(100)" json:"type"`
+ Method string `xorm:"varchar(100)" json:"method"`
ClientId string `xorm:"varchar(100)" json:"clientId"`
ClientSecret string `xorm:"varchar(100)" json:"clientSecret"`
@@ -57,6 +58,7 @@ func getMaskedProvider(provider *Provider) *Provider {
DisplayName: provider.DisplayName,
Category: provider.Category,
Type: provider.Type,
+ Method: provider.Method,
ClientId: provider.ClientId,
}
return p
diff --git a/web/src/ProviderEditPage.js b/web/src/ProviderEditPage.js
index 34c19875..02b2b706 100644
--- a/web/src/ProviderEditPage.js
+++ b/web/src/ProviderEditPage.js
@@ -231,6 +231,22 @@ class ProviderEditPage extends React.Component {
+ {this.state.provider.type === "WeCom" ? (
+
+
+ {Setting.getLabel(i18next.t("provider:Method"), i18next.t("provider:Method - Tooltip"))} :
+
+
+
+
+
+ ) : null}
{this.getClientIdLabel()}
diff --git a/web/src/ProviderListPage.js b/web/src/ProviderListPage.js
index fc921b7b..4d8f1864 100644
--- a/web/src/ProviderListPage.js
+++ b/web/src/ProviderListPage.js
@@ -51,6 +51,7 @@ class ProviderListPage extends React.Component {
displayName: `New Provider - ${this.state.providers.length}`,
category: "OAuth",
type: "GitHub",
+ method: "Normal",
clientId: "",
clientSecret: "",
enableSignUp: true,
diff --git a/web/src/auth/Provider.js b/web/src/auth/Provider.js
index cd1956aa..cce96609 100644
--- a/web/src/auth/Provider.js
+++ b/web/src/auth/Provider.js
@@ -51,8 +51,9 @@ const LinkedInAuthScope = "r_liteprofile%20r_emailaddress";
const LinkedInAuthUri = "https://www.linkedin.com/oauth/v2/authorization";
const LinkedInAuthLogo = `${StaticBaseUrl}/img/social_linkedin.png`;
-// const WeComAuthScope = "";
+const WeComSilentAuthScope = "snsapi_userinfo";
const WeComAuthUri = "https://open.work.weixin.qq.com/wwopen/sso/3rd_qrConnect";
+const WeComSilentAuthUrl = "https://open.weixin.qq.com/connect/oauth2/authorize";
const WeComAuthLogo = `${StaticBaseUrl}/img/social_wecom.png`;
// const LarkAuthScope = "";
@@ -115,12 +116,18 @@ export function getAuthUrl(application, provider, method) {
} else if (provider.type === "Gitee") {
return `${GiteeAuthUri}?client_id=${provider.clientId}&redirect_uri=${redirectUri}&scope=${GiteeAuthScope}&response_type=code&state=${state}`;
} else if (provider.type === "LinkedIn") {
- return `${LinkedInAuthUri}?client_id=${provider.clientId}&redirect_uri=${redirectUri}&scope=${LinkedInAuthScope}&response_type=code&state=${state}`
+ return `${LinkedInAuthUri}?client_id=${provider.clientId}&redirect_uri=${redirectUri}&scope=${LinkedInAuthScope}&response_type=code&state=${state}`;
} else if (provider.type === "WeCom") {
- return `${WeComAuthUri}?appid=${provider.clientId}&redirect_uri=${redirectUri}&state=${state}&usertype=member`
+ if (provider.method === "Silent") {
+ return `${WeComSilentAuthUrl}?appid=${provider.clientId}&redirect_uri=${redirectUri}&state=${state}&scope=${WeComSilentAuthScope}&response_type=code#wechat_redirect`;
+ } else if (provider.method === "Normal") {
+ return `${WeComAuthUri}?appid=${provider.clientId}&redirect_uri=${redirectUri}&state=${state}&usertype=member`;
+ } else {
+ return `https://error:not-supported-provider-method:${provider.method}`;
+ }
} else if (provider.type === "Lark") {
- return `${LarkAuthUri}?app_id=${provider.clientId}&redirect_uri=${redirectUri}&state=${state}`
+ return `${LarkAuthUri}?app_id=${provider.clientId}&redirect_uri=${redirectUri}&state=${state}`;
} else if (provider.type === "GitLab") {
- return `${GitLabAuthUri}?client_id=${provider.clientId}&redirect_uri=${redirectUri}&state=${state}&response_type=code&scope=${GitLabAuthScope}`
+ return `${GitLabAuthUri}?client_id=${provider.clientId}&redirect_uri=${redirectUri}&state=${state}&response_type=code&scope=${GitLabAuthScope}`;
}
}
diff --git a/web/src/locales/en/data.json b/web/src/locales/en/data.json
index 37a3458a..a4170dab 100644
--- a/web/src/locales/en/data.json
+++ b/web/src/locales/en/data.json
@@ -171,6 +171,8 @@
"Category - Tooltip": "Unique string-style identifier",
"Type": "Type",
"Type - Tooltip": "Unique string-style identifier",
+ "Method": "Method",
+ "Method - Tooltip": "Login behaviors, QR code or silent authorization",
"Client ID": "Client ID",
"Client ID - Tooltip": "Unique string-style identifier",
"Client secret": "Client secret",