mirror of
https://github.com/casdoor/casdoor.git
synced 2025-09-06 01:30:25 +08:00
feat: add Lark OAuth provider (#3956)
This commit is contained in:
@@ -931,10 +931,12 @@ class ProviderEditPage extends React.Component {
|
||||
)
|
||||
}
|
||||
{
|
||||
this.state.provider.type !== "Google" ? null : (
|
||||
this.state.provider.type !== "Google" && this.state.provider.type !== "Lark" ? null : (
|
||||
<Row style={{marginTop: "20px"}} >
|
||||
<Col style={{marginTop: "5px"}} span={(Setting.isMobile()) ? 22 : 2}>
|
||||
{Setting.getLabel(i18next.t("provider:Get phone number"), i18next.t("provider:Get phone number - Tooltip"))} :
|
||||
{this.state.provider.type === "Google" ?
|
||||
Setting.getLabel(i18next.t("provider:Get phone number"), i18next.t("provider:Get phone number - Tooltip"))
|
||||
: Setting.getLabel(i18next.t("provider:Use global endpoint"), i18next.t("provider:Use global endpoint - Tooltip"))} :
|
||||
</Col>
|
||||
<Col span={1} >
|
||||
<Switch disabled={!this.state.provider.clientId} checked={this.state.provider.disableSsl} onChange={checked => {
|
||||
|
@@ -68,6 +68,7 @@ const authInfo = {
|
||||
Lark: {
|
||||
// scope: "email",
|
||||
endpoint: "https://open.feishu.cn/open-apis/authen/v1/index",
|
||||
endpoint2: "https://accounts.larksuite.com/open-apis/authen/v1/authorize",
|
||||
},
|
||||
GitLab: {
|
||||
scope: "read_user+profile",
|
||||
@@ -406,6 +407,8 @@ export function getAuthUrl(application, provider, method, code) {
|
||||
if (provider.domain) {
|
||||
endpoint = `${provider.domain}/apps/oauth2/authorize`;
|
||||
}
|
||||
} else if (provider.type === "Lark" && provider.disableSsl) {
|
||||
endpoint = authInfo[provider.type].endpoint2;
|
||||
}
|
||||
|
||||
if (provider.type === "Google" || provider.type === "GitHub" || provider.type === "Facebook"
|
||||
@@ -460,6 +463,9 @@ export function getAuthUrl(application, provider, method, code) {
|
||||
return `https://error:not-supported-provider-sub-type:${provider.subType}`;
|
||||
}
|
||||
} else if (provider.type === "Lark") {
|
||||
if (provider.disableSsl) {
|
||||
redirectUri = encodeURIComponent(redirectUri);
|
||||
}
|
||||
return `${endpoint}?app_id=${provider.clientId}&redirect_uri=${redirectUri}&state=${state}`;
|
||||
} else if (provider.type === "ADFS") {
|
||||
return `${provider.domain}/adfs/oauth2/authorize?client_id=${provider.clientId}&redirect_uri=${redirectUri}&state=${state}&response_type=code&nonce=casdoor&scope=openid`;
|
||||
|
Reference in New Issue
Block a user