@springmicro/auth 0.7.0 → 0.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.cjs +18 -18
- package/README.md +60 -60
- package/dist/Index-64ac63ff-ChMmeIY7.js +0 -0
- package/dist/Index-6c094240-hn_S7Xeg.js +0 -0
- package/dist/Web3Auth-CGD96zai.js +0 -0
- package/dist/alphawallet-B7eovdf-.js +0 -0
- package/dist/apexwallet-ysP20G9D.js +0 -0
- package/dist/atoken-BBnNTzcz.js +0 -0
- package/dist/bifrostwallet-CNNBO92h.js +0 -0
- package/dist/binance-DvPgAzCw.js +0 -0
- package/dist/bitget-DZOUrwgy.js +0 -0
- package/dist/bitpie-C_uxmEzw.js +0 -0
- package/dist/bitski-DpzkHNkv.js +0 -0
- package/dist/blockwallet-BL69cqkA.js +0 -0
- package/dist/brave-DnRzMQYW.js +0 -0
- package/dist/ccip-c78d2f16-DLcRlwod.js +0 -0
- package/dist/coin98wallet-CkFdOvXt.js +0 -0
- package/dist/coinbase-CaGNx5if.js +0 -0
- package/dist/core-9rK8tWud.js +0 -0
- package/dist/defiwallet-0AsgJBSy.js +0 -0
- package/dist/detected-CX_JZaUk.js +0 -0
- package/dist/echooo-CmaetT_Z.js +0 -0
- package/dist/enkrypt-BibtwvK7.js +0 -0
- package/dist/exodus-BxzkDWWP.js +0 -0
- package/dist/fordefi-CvKyVwhI.js +0 -0
- package/dist/foxwallet-D7c_LDTf.js +0 -0
- package/dist/frame-CDfNmjUy.js +0 -0
- package/dist/frontier-DqKNSj2z.js +0 -0
- package/dist/hashMessage-Bdgmx0rg.js +0 -0
- package/dist/huobiwallet-CxSwqa5L.js +0 -0
- package/dist/hyperpay-nmHE3WqM.js +0 -0
- package/dist/icon-2Zqy7pqQ.js +0 -0
- package/dist/icon-CGWI1Ies.js +0 -0
- package/dist/icon-C_O4nprO.js +0 -0
- package/dist/icon-DbgmZCnU.js +0 -0
- package/dist/icon-Dbjb6jc5.js +0 -0
- package/dist/icon-cAd7RhSC.js +0 -0
- package/dist/imtoken-yENtOTS3.js +0 -0
- package/dist/index-021f6a62-Zz543EDB.js +0 -0
- package/dist/index-40a497ea-Bn2mC0r7.js +0 -0
- package/dist/index-62liFLUM.js +0 -0
- package/dist/index-BBx_mvyX.js +0 -0
- package/dist/index-C6leUA25.js +0 -0
- package/dist/index-CAVvArYp.js +0 -0
- package/dist/index-Ct7cFdFm.js +0 -0
- package/dist/index-DA32_Pfh.js +0 -0
- package/dist/index-Dna0rycp.js +0 -0
- package/dist/index.d.ts +0 -0
- package/dist/index.js +0 -0
- package/dist/index.umd.cjs +0 -0
- package/dist/infinitywallet-C8J4FUYw.js +0 -0
- package/dist/kayros-AIrUK1za.js +0 -0
- package/dist/keplr-CyLTca9B.js +0 -0
- package/dist/lif3wallet-C5D6r8pg.js +0 -0
- package/dist/liquality-nbCtErVq.js +0 -0
- package/dist/mathwallet-CWkivCXo.js +0 -0
- package/dist/meetone-kKmvI8md.js +0 -0
- package/dist/metamask-BN7yiDV1.js +0 -0
- package/dist/mykey-CQZ6UcLH.js +0 -0
- package/dist/native-FDN9oNjc.js +0 -0
- package/dist/number-C-98SESp.js +0 -0
- package/dist/okxwallet-CJLVogh2.js +0 -0
- package/dist/oneInch-CciyZ4Pz.js +0 -0
- package/dist/onekey-Dal8kYjU.js +0 -0
- package/dist/opera-DnKg-TJU.js +0 -0
- package/dist/ownbit-BshJUVuW.js +0 -0
- package/dist/phantom-CJ8dIcov.js +0 -0
- package/dist/rabby-D4thTcd6.js +0 -0
- package/dist/rainbow-mXld6yWV.js +0 -0
- package/dist/roninwallet-ZyYrd-D1.js +0 -0
- package/dist/safeheron-Eg1Jb29V.js +0 -0
- package/dist/safepal-DVIKy94N.js +0 -0
- package/dist/sequence-BS2IbtDg.js +0 -0
- package/dist/stablewallet-jyB079Wb.js +0 -0
- package/dist/status-FrAvQjfn.js +0 -0
- package/dist/subwallet-DMvFqKyY.js +0 -0
- package/dist/talisman-Bp8zUXqB.js +0 -0
- package/dist/tallywallet-B4OS9nIr.js +0 -0
- package/dist/tokenary-C7jjcbQa.js +0 -0
- package/dist/tokenpocket-9ZRPmAFA.js +0 -0
- package/dist/tp-V2em5bdl.js +0 -0
- package/dist/transactionRequest-be6a8ea9-CUKWo5mx.js +0 -0
- package/dist/trust-SgHubMq7.js +0 -0
- package/dist/xdefi-COVIyGz4.js +0 -0
- package/dist/zeal-DxHbDqm0.js +0 -0
- package/dist/zerion-BfW0UElc.js +0 -0
- package/dist/zodiacpilot-CrId6F4w.js +0 -0
- package/index.html +13 -13
- package/package.json +2 -2
- package/springmicro-auth-0.6.1.tgz +0 -0
- package/src/auth/config.ts +0 -0
- package/src/components/SignUp.tsx +0 -0
- package/src/components/forms/AgreementModal.tsx +88 -88
- package/src/components/forms/CaptchaController.tsx +94 -94
- package/src/components/forms/CaptchaModal.jsx +171 -171
- package/src/components/forms/CaptchaWidget.jsx +146 -146
- package/src/components/forms/PasswordChecker.ts +88 -88
- package/src/components/forms/SendCodeInput.tsx +0 -0
- package/src/components/forms/SignUpFormItem.tsx +0 -0
- package/src/components/forms/util/application-api.ts +0 -0
- package/src/components/forms/util/auth-api.ts +198 -198
- package/src/components/forms/util/auth-util.tsx +346 -346
- package/src/components/forms/util/core.ts +493 -493
- package/src/components/forms/util/invitation-api.ts +132 -132
- package/src/components/forms/util/provider.tsx +603 -603
- package/src/components/forms/util/user-api.ts +0 -0
- package/src/components/provider/AdfsLoginButton.jsx +38 -38
- package/src/components/provider/AlipayLoginButton.jsx +38 -38
- package/src/components/provider/AppleLoginButton.jsx +38 -38
- package/src/components/provider/AzureADB2CLoginButton.jsx +38 -38
- package/src/components/provider/AzureADLoginButton.jsx +38 -38
- package/src/components/provider/BaiduLoginButton.jsx +38 -38
- package/src/components/provider/BilibiliLoginButton.jsx +37 -37
- package/src/components/provider/CasdoorLoginButton.jsx +38 -38
- package/src/components/provider/DingTalkLoginButton.jsx +37 -37
- package/src/components/provider/DouyinLoginButton.jsx +38 -38
- package/src/components/provider/FacebookLoginButton.jsx +37 -37
- package/src/components/provider/GitHubLoginButton.jsx +37 -37
- package/src/components/provider/GitLabLoginButton.jsx +38 -38
- package/src/components/provider/GiteeLoginButton.jsx +34 -34
- package/src/components/provider/GoogleLoginButton.jsx +68 -68
- package/src/components/provider/InfoflowLoginButton.jsx +38 -38
- package/src/components/provider/LarkLoginButton.jsx +38 -38
- package/src/components/provider/LinkedInLoginButton.jsx +37 -37
- package/src/components/provider/LoginButton.jsx +33 -33
- package/src/components/provider/OktaLoginButton.jsx +38 -38
- package/src/components/provider/Provider.jsx +3 -3
- package/src/components/provider/ProviderButton.jsx +327 -327
- package/src/components/provider/QqLoginButton.jsx +31 -31
- package/src/components/provider/SelfLoginButton.jsx +47 -47
- package/src/components/provider/SlackLoginButton.jsx +38 -38
- package/src/components/provider/SteamLoginButton.jsx +38 -38
- package/src/components/provider/WeComLoginButton.jsx +34 -34
- package/src/components/provider/Web3Auth.jsx +365 -365
- package/src/components/provider/WechatLoginButton.jsx +37 -37
- package/src/components/provider/WeiboLoginButton.jsx +34 -34
- package/src/components/util.tsx +0 -0
- package/src/i18n/en/signup.json +48 -48
- package/src/i18n/index.ts +17 -17
- package/src/index.tsx +0 -0
- package/src/vite-env.d.ts +1 -1
- package/tsconfig.json +23 -23
- package/tsconfig.node.json +10 -10
- package/vite.config.ts +33 -33
|
@@ -1,603 +1,603 @@
|
|
|
1
|
-
// Copyright 2021 The Casdoor Authors. All Rights Reserved.
|
|
2
|
-
//
|
|
3
|
-
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
-
// you may not use this file except in compliance with the License.
|
|
5
|
-
// You may obtain a copy of the License at
|
|
6
|
-
//
|
|
7
|
-
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
-
//
|
|
9
|
-
// Unless required by applicable law or agreed to in writing, software
|
|
10
|
-
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
-
// See the License for the specific language governing permissions and
|
|
13
|
-
// limitations under the License.
|
|
14
|
-
|
|
15
|
-
import React from "react";
|
|
16
|
-
import * as Util from "./auth-util";
|
|
17
|
-
import * as Setting from "./core";
|
|
18
|
-
|
|
19
|
-
const authInfo: Record<string, any> = {
|
|
20
|
-
Google: {
|
|
21
|
-
scope: "profile+email",
|
|
22
|
-
endpoint: "https://accounts.google.com/signin/oauth",
|
|
23
|
-
},
|
|
24
|
-
GitHub: {
|
|
25
|
-
scope: "user:email+read:user",
|
|
26
|
-
endpoint: "https://github.com/login/oauth/authorize",
|
|
27
|
-
},
|
|
28
|
-
QQ: {
|
|
29
|
-
scope: "get_user_info",
|
|
30
|
-
endpoint: "https://graph.qq.com/oauth2.0/authorize",
|
|
31
|
-
},
|
|
32
|
-
WeChat: {
|
|
33
|
-
scope: "snsapi_login",
|
|
34
|
-
endpoint: "https://open.weixin.qq.com/connect/qrconnect",
|
|
35
|
-
mpScope: "snsapi_userinfo",
|
|
36
|
-
mpEndpoint: "https://open.weixin.qq.com/connect/oauth2/authorize",
|
|
37
|
-
},
|
|
38
|
-
WeChatMiniProgram: {
|
|
39
|
-
endpoint: "https://mp.weixin.qq.com/",
|
|
40
|
-
},
|
|
41
|
-
Facebook: {
|
|
42
|
-
scope: "email,public_profile",
|
|
43
|
-
endpoint: "https://www.facebook.com/dialog/oauth",
|
|
44
|
-
},
|
|
45
|
-
DingTalk: {
|
|
46
|
-
scope: "openid",
|
|
47
|
-
endpoint: "https://login.dingtalk.com/oauth2/auth",
|
|
48
|
-
},
|
|
49
|
-
Weibo: {
|
|
50
|
-
scope: "email",
|
|
51
|
-
endpoint: "https://api.weibo.com/oauth2/authorize",
|
|
52
|
-
},
|
|
53
|
-
Gitee: {
|
|
54
|
-
scope: "user_info%20emails",
|
|
55
|
-
endpoint: "https://gitee.com/oauth/authorize",
|
|
56
|
-
},
|
|
57
|
-
LinkedIn: {
|
|
58
|
-
scope: "r_liteprofile%20r_emailaddress",
|
|
59
|
-
endpoint: "https://www.linkedin.com/oauth/v2/authorization",
|
|
60
|
-
},
|
|
61
|
-
WeCom: {
|
|
62
|
-
scope: "snsapi_userinfo",
|
|
63
|
-
endpoint: "https://open.work.weixin.qq.com/wwopen/sso/3rd_qrConnect",
|
|
64
|
-
silentEndpoint: "https://open.weixin.qq.com/connect/oauth2/authorize",
|
|
65
|
-
internalEndpoint: "https://open.work.weixin.qq.com/wwopen/sso/qrConnect",
|
|
66
|
-
},
|
|
67
|
-
Lark: {
|
|
68
|
-
// scope: "email",
|
|
69
|
-
endpoint: "https://open.feishu.cn/open-apis/authen/v1/index",
|
|
70
|
-
},
|
|
71
|
-
GitLab: {
|
|
72
|
-
scope: "read_user+profile",
|
|
73
|
-
endpoint: "https://gitlab.com/oauth/authorize",
|
|
74
|
-
},
|
|
75
|
-
ADFS: {
|
|
76
|
-
scope: "openid",
|
|
77
|
-
endpoint: "http://example.com",
|
|
78
|
-
},
|
|
79
|
-
Baidu: {
|
|
80
|
-
scope: "basic",
|
|
81
|
-
endpoint: "http://openapi.baidu.com/oauth/2.0/authorize",
|
|
82
|
-
},
|
|
83
|
-
Alipay: {
|
|
84
|
-
scope: "basic",
|
|
85
|
-
endpoint: "https://openauth.alipay.com/oauth2/publicAppAuthorize.htm",
|
|
86
|
-
},
|
|
87
|
-
Casdoor: {
|
|
88
|
-
scope: "openid%20profile%20email",
|
|
89
|
-
endpoint: "http://example.com",
|
|
90
|
-
},
|
|
91
|
-
Infoflow: {
|
|
92
|
-
endpoint: "https://xpc.im.baidu.com/oauth2/authorize",
|
|
93
|
-
},
|
|
94
|
-
Apple: {
|
|
95
|
-
scope: "name%20email",
|
|
96
|
-
endpoint: "https://appleid.apple.com/auth/authorize",
|
|
97
|
-
},
|
|
98
|
-
AzureAD: {
|
|
99
|
-
scope: "user.read",
|
|
100
|
-
endpoint: "https://login.microsoftonline.com/common/oauth2/v2.0/authorize",
|
|
101
|
-
},
|
|
102
|
-
AzureADB2C: {
|
|
103
|
-
scope: "openid",
|
|
104
|
-
endpoint:
|
|
105
|
-
"https://tenant.b2clogin.com/tenant.onmicrosoft.com/userflow/oauth2/v2.0/authorize",
|
|
106
|
-
},
|
|
107
|
-
Slack: {
|
|
108
|
-
scope: "users:read",
|
|
109
|
-
endpoint: "https://slack.com/oauth/authorize",
|
|
110
|
-
},
|
|
111
|
-
Steam: {
|
|
112
|
-
endpoint: "https://steamcommunity.com/openid/login",
|
|
113
|
-
},
|
|
114
|
-
Okta: {
|
|
115
|
-
scope: "openid%20profile%20email",
|
|
116
|
-
endpoint: "http://example.com",
|
|
117
|
-
},
|
|
118
|
-
Douyin: {
|
|
119
|
-
scope: "user_info",
|
|
120
|
-
endpoint: "https://open.douyin.com/platform/oauth/connect",
|
|
121
|
-
},
|
|
122
|
-
Custom: {
|
|
123
|
-
endpoint: "https://example.com/",
|
|
124
|
-
},
|
|
125
|
-
Bilibili: {
|
|
126
|
-
endpoint: "https://passport.bilibili.com/register/pc_oauth2.html",
|
|
127
|
-
},
|
|
128
|
-
Line: {
|
|
129
|
-
scope: "profile%20openid%20email",
|
|
130
|
-
endpoint: "https://access.line.me/oauth2/v2.1/authorize",
|
|
131
|
-
},
|
|
132
|
-
Amazon: {
|
|
133
|
-
scope: "profile",
|
|
134
|
-
endpoint: "https://www.amazon.com/ap/oa",
|
|
135
|
-
},
|
|
136
|
-
Auth0: {
|
|
137
|
-
scope: "openid%20profile%20email",
|
|
138
|
-
endpoint: "http://auth0.com/authorize",
|
|
139
|
-
},
|
|
140
|
-
BattleNet: {
|
|
141
|
-
scope: "openid",
|
|
142
|
-
endpoint: "https://oauth.battlenet.com.cn/authorize",
|
|
143
|
-
},
|
|
144
|
-
Bitbucket: {
|
|
145
|
-
scope: "account",
|
|
146
|
-
endpoint: "https://bitbucket.org/site/oauth2/authorize",
|
|
147
|
-
},
|
|
148
|
-
Box: {
|
|
149
|
-
scope: "root_readwrite",
|
|
150
|
-
endpoint: "https://account.box.com/api/oauth2/authorize",
|
|
151
|
-
},
|
|
152
|
-
CloudFoundry: {
|
|
153
|
-
scope: "cloud_controller.read",
|
|
154
|
-
endpoint: "https://login.cloudfoundry.org/oauth/authorize",
|
|
155
|
-
},
|
|
156
|
-
Dailymotion: {
|
|
157
|
-
scope: "userinfo",
|
|
158
|
-
endpoint: "https://api.dailymotion.com/oauth/authorize",
|
|
159
|
-
},
|
|
160
|
-
Deezer: {
|
|
161
|
-
scope: "basic_access",
|
|
162
|
-
endpoint: "https://connect.deezer.com/oauth/auth.php",
|
|
163
|
-
},
|
|
164
|
-
DigitalOcean: {
|
|
165
|
-
scope: "read",
|
|
166
|
-
endpoint: "https://cloud.digitalocean.com/v1/oauth/authorize",
|
|
167
|
-
},
|
|
168
|
-
Discord: {
|
|
169
|
-
scope: "identify%20email",
|
|
170
|
-
endpoint: "https://discord.com/api/oauth2/authorize",
|
|
171
|
-
},
|
|
172
|
-
Dropbox: {
|
|
173
|
-
scope: "account_info.read",
|
|
174
|
-
endpoint: "https://www.dropbox.com/oauth2/authorize",
|
|
175
|
-
},
|
|
176
|
-
EveOnline: {
|
|
177
|
-
scope: "publicData",
|
|
178
|
-
endpoint: "https://login.eveonline.com/oauth/authorize",
|
|
179
|
-
},
|
|
180
|
-
Fitbit: {
|
|
181
|
-
scope:
|
|
182
|
-
"activity%20heartrate%20location%20nutrition%20profile%20settings%20sleep%20social%20weight",
|
|
183
|
-
endpoint: "https://www.fitbit.com/oauth2/authorize",
|
|
184
|
-
},
|
|
185
|
-
Gitea: {
|
|
186
|
-
scope: "user:email",
|
|
187
|
-
endpoint: "https://gitea.com/login/oauth/authorize",
|
|
188
|
-
},
|
|
189
|
-
Heroku: {
|
|
190
|
-
scope: "global",
|
|
191
|
-
endpoint: "https://id.heroku.com/oauth/authorize",
|
|
192
|
-
},
|
|
193
|
-
InfluxCloud: {
|
|
194
|
-
scope: "read:org",
|
|
195
|
-
endpoint: "https://cloud2.influxdata.com/oauth/authorize",
|
|
196
|
-
},
|
|
197
|
-
Instagram: {
|
|
198
|
-
scope: "user_profile",
|
|
199
|
-
endpoint: "https://api.instagram.com/oauth/authorize",
|
|
200
|
-
},
|
|
201
|
-
Intercom: {
|
|
202
|
-
scope: "user.read",
|
|
203
|
-
endpoint: "https://app.intercom.com/oauth",
|
|
204
|
-
},
|
|
205
|
-
Kakao: {
|
|
206
|
-
scope: "account_email",
|
|
207
|
-
endpoint: "https://kauth.kakao.com/oauth/authorize",
|
|
208
|
-
},
|
|
209
|
-
Lastfm: {
|
|
210
|
-
scope: "user_read",
|
|
211
|
-
endpoint: "https://www.last.fm/api/auth",
|
|
212
|
-
},
|
|
213
|
-
Mailru: {
|
|
214
|
-
scope: "userinfo",
|
|
215
|
-
endpoint: "https://oauth.mail.ru/login",
|
|
216
|
-
},
|
|
217
|
-
Meetup: {
|
|
218
|
-
scope: "basic",
|
|
219
|
-
endpoint: "https://secure.meetup.com/oauth2/authorize",
|
|
220
|
-
},
|
|
221
|
-
MicrosoftOnline: {
|
|
222
|
-
scope: "openid%20profile%20email",
|
|
223
|
-
endpoint: "https://login.microsoftonline.com/common/oauth2/v2.0/authorize",
|
|
224
|
-
},
|
|
225
|
-
Naver: {
|
|
226
|
-
scope: "profile",
|
|
227
|
-
endpoint: "https://nid.naver.com/oauth2.0/authorize",
|
|
228
|
-
},
|
|
229
|
-
Nextcloud: {
|
|
230
|
-
scope: "openid%20profile%20email",
|
|
231
|
-
endpoint: "https://cloud.example.org/apps/oauth2/authorize",
|
|
232
|
-
},
|
|
233
|
-
OneDrive: {
|
|
234
|
-
scope: "offline_access%20onedrive.readonly",
|
|
235
|
-
endpoint: "https://login.live.com/oauth20_authorize.srf",
|
|
236
|
-
},
|
|
237
|
-
Oura: {
|
|
238
|
-
scope: "personal",
|
|
239
|
-
endpoint: "https://cloud.ouraring.com/oauth/authorize",
|
|
240
|
-
},
|
|
241
|
-
Patreon: {
|
|
242
|
-
scope: "identity",
|
|
243
|
-
endpoint: "https://www.patreon.com/oauth2/authorize",
|
|
244
|
-
},
|
|
245
|
-
PayPal: {
|
|
246
|
-
scope: "openid%20profile%20email",
|
|
247
|
-
endpoint: "https://www.sandbox.paypal.com/connect",
|
|
248
|
-
},
|
|
249
|
-
SalesForce: {
|
|
250
|
-
scope: "openid%20profile%20email",
|
|
251
|
-
endpoint: "https://login.salesforce.com/services/oauth2/authorize",
|
|
252
|
-
},
|
|
253
|
-
Shopify: {
|
|
254
|
-
scope: "read_products",
|
|
255
|
-
endpoint: "https://myshopify.com/admin/oauth/authorize",
|
|
256
|
-
},
|
|
257
|
-
Soundcloud: {
|
|
258
|
-
scope: "non-expiring",
|
|
259
|
-
endpoint: "https://api.soundcloud.com/connect",
|
|
260
|
-
},
|
|
261
|
-
Spotify: {
|
|
262
|
-
scope: "user-read-email",
|
|
263
|
-
endpoint: "https://accounts.spotify.com/authorize",
|
|
264
|
-
},
|
|
265
|
-
Strava: {
|
|
266
|
-
scope: "read",
|
|
267
|
-
endpoint: "https://www.strava.com/oauth/authorize",
|
|
268
|
-
},
|
|
269
|
-
Stripe: {
|
|
270
|
-
scope: "read_only",
|
|
271
|
-
endpoint: "https://connect.stripe.com/oauth/authorize",
|
|
272
|
-
},
|
|
273
|
-
TikTok: {
|
|
274
|
-
scope: "user.info.basic",
|
|
275
|
-
endpoint: "https://www.tiktok.com/auth/authorize/",
|
|
276
|
-
},
|
|
277
|
-
Tumblr: {
|
|
278
|
-
scope: "email",
|
|
279
|
-
endpoint: "https://www.tumblr.com/oauth2/authorize",
|
|
280
|
-
},
|
|
281
|
-
Twitch: {
|
|
282
|
-
scope: "user_read",
|
|
283
|
-
endpoint: "https://id.twitch.tv/oauth2/authorize",
|
|
284
|
-
},
|
|
285
|
-
Twitter: {
|
|
286
|
-
scope: "users.read%20tweet.read",
|
|
287
|
-
endpoint: "https://twitter.com/i/oauth2/authorize",
|
|
288
|
-
},
|
|
289
|
-
Typetalk: {
|
|
290
|
-
scope: "my",
|
|
291
|
-
endpoint: "https://typetalk.com/oauth2/authorize",
|
|
292
|
-
},
|
|
293
|
-
Uber: {
|
|
294
|
-
scope: "profile",
|
|
295
|
-
endpoint: "https://login.uber.com/oauth/v2/authorize",
|
|
296
|
-
},
|
|
297
|
-
VK: {
|
|
298
|
-
scope: "email",
|
|
299
|
-
endpoint: "https://oauth.vk.com/authorize",
|
|
300
|
-
},
|
|
301
|
-
Wepay: {
|
|
302
|
-
scope: "manage_accounts%20view_user",
|
|
303
|
-
endpoint: "https://www.wepay.com/v2/oauth2/authorize",
|
|
304
|
-
},
|
|
305
|
-
Xero: {
|
|
306
|
-
scope: "openid%20profile%20email",
|
|
307
|
-
endpoint: "https://login.xero.com/identity/connect/authorize",
|
|
308
|
-
},
|
|
309
|
-
Yahoo: {
|
|
310
|
-
scope: "openid%20profile%20email",
|
|
311
|
-
endpoint: "https://api.login.yahoo.com/oauth2/request_auth",
|
|
312
|
-
},
|
|
313
|
-
Yammer: {
|
|
314
|
-
scope: "user",
|
|
315
|
-
endpoint: "https://www.yammer.com/oauth2/authorize",
|
|
316
|
-
},
|
|
317
|
-
Yandex: {
|
|
318
|
-
scope: "login:email",
|
|
319
|
-
endpoint: "https://oauth.yandex.com/authorize",
|
|
320
|
-
},
|
|
321
|
-
Zoom: {
|
|
322
|
-
scope: "user:read",
|
|
323
|
-
endpoint: "https://zoom.us/oauth/authorize",
|
|
324
|
-
},
|
|
325
|
-
MetaMask: {
|
|
326
|
-
scope: "",
|
|
327
|
-
endpoint: "",
|
|
328
|
-
},
|
|
329
|
-
Web3Onboard: {
|
|
330
|
-
scope: "",
|
|
331
|
-
endpoint: "",
|
|
332
|
-
},
|
|
333
|
-
};
|
|
334
|
-
|
|
335
|
-
export type Provider = {
|
|
336
|
-
type: string;
|
|
337
|
-
category: string;
|
|
338
|
-
displayName: string;
|
|
339
|
-
owner: string;
|
|
340
|
-
name: string;
|
|
341
|
-
domain: string;
|
|
342
|
-
clientId: string;
|
|
343
|
-
appId: string;
|
|
344
|
-
clientId2: string;
|
|
345
|
-
disableSsl: boolean;
|
|
346
|
-
signName: string;
|
|
347
|
-
subType: string;
|
|
348
|
-
method: string;
|
|
349
|
-
customAuthUrl: string;
|
|
350
|
-
customLogo: string;
|
|
351
|
-
scopes: string;
|
|
352
|
-
};
|
|
353
|
-
|
|
354
|
-
export type Application = {
|
|
355
|
-
name: string;
|
|
356
|
-
owner: string;
|
|
357
|
-
organization: string;
|
|
358
|
-
organizationObj: any;
|
|
359
|
-
providers?: Array<any>;
|
|
360
|
-
signupItems?: Array<any>;
|
|
361
|
-
signinMethods: Array<any>;
|
|
362
|
-
termsOfUse: string;
|
|
363
|
-
};
|
|
364
|
-
|
|
365
|
-
export function getProviderUrl(provider: Provider) {
|
|
366
|
-
if (provider.category === "OAuth") {
|
|
367
|
-
const endpoint = authInfo[provider.type as keyof typeof authInfo].endpoint;
|
|
368
|
-
const urlObj = new URL(endpoint);
|
|
369
|
-
|
|
370
|
-
let host = urlObj.host;
|
|
371
|
-
let tokens = host.split(".");
|
|
372
|
-
if (tokens.length > 2) {
|
|
373
|
-
tokens = tokens.slice(1);
|
|
374
|
-
}
|
|
375
|
-
host = tokens.join(".");
|
|
376
|
-
|
|
377
|
-
return `${urlObj.protocol}//${host}`;
|
|
378
|
-
} else {
|
|
379
|
-
const info: { logo: string; url: string } =
|
|
380
|
-
Setting.OtherProviderInfo[provider.category as Setting.OPIKey][
|
|
381
|
-
provider.type as Setting.OPITypeKey
|
|
382
|
-
];
|
|
383
|
-
// avoid crash when provider is not found
|
|
384
|
-
if (info) {
|
|
385
|
-
return info.url;
|
|
386
|
-
}
|
|
387
|
-
return "";
|
|
388
|
-
}
|
|
389
|
-
}
|
|
390
|
-
|
|
391
|
-
export function getProviderLogoWidget(provider?: Provider) {
|
|
392
|
-
if (provider === undefined) {
|
|
393
|
-
return null;
|
|
394
|
-
}
|
|
395
|
-
|
|
396
|
-
const url = getProviderUrl(provider);
|
|
397
|
-
if (url !== "") {
|
|
398
|
-
return (
|
|
399
|
-
<div className="tooltip" data-tip={provider.type}>
|
|
400
|
-
<a target="_blank" rel="noreferrer" href={getProviderUrl(provider)}>
|
|
401
|
-
<img
|
|
402
|
-
width={36}
|
|
403
|
-
height={36}
|
|
404
|
-
src={Setting.getProviderLogoURL(provider)}
|
|
405
|
-
alt={provider.displayName}
|
|
406
|
-
/>
|
|
407
|
-
</a>
|
|
408
|
-
</div>
|
|
409
|
-
);
|
|
410
|
-
} else {
|
|
411
|
-
return (
|
|
412
|
-
<div className="tooltip" data-tip={provider.type}>
|
|
413
|
-
<img
|
|
414
|
-
width={36}
|
|
415
|
-
height={36}
|
|
416
|
-
src={Setting.getProviderLogoURL(provider)}
|
|
417
|
-
alt={provider.displayName}
|
|
418
|
-
/>
|
|
419
|
-
</div>
|
|
420
|
-
);
|
|
421
|
-
}
|
|
422
|
-
}
|
|
423
|
-
|
|
424
|
-
export function getAuthUrl(
|
|
425
|
-
application: Application | null,
|
|
426
|
-
provider: Provider | null,
|
|
427
|
-
method: string,
|
|
428
|
-
code: string
|
|
429
|
-
) {
|
|
430
|
-
if (application === null || provider === null) {
|
|
431
|
-
return "";
|
|
432
|
-
}
|
|
433
|
-
|
|
434
|
-
let endpoint = authInfo[provider.type as keyof typeof authInfo].endpoint;
|
|
435
|
-
let redirectUri = `${window.location.origin}/callback`;
|
|
436
|
-
const scope = authInfo[provider.type as keyof typeof authInfo].scope;
|
|
437
|
-
|
|
438
|
-
const isShortState =
|
|
439
|
-
(provider.type === "WeChat" &&
|
|
440
|
-
navigator.userAgent.includes("MicroMessenger")) ||
|
|
441
|
-
provider.type === "Twitter";
|
|
442
|
-
const state = Util.getStateFromQueryParams(
|
|
443
|
-
application.name,
|
|
444
|
-
provider.name,
|
|
445
|
-
method,
|
|
446
|
-
isShortState
|
|
447
|
-
);
|
|
448
|
-
const codeChallenge = "P3S-a7dr8bgM4bF6vOyiKkKETDl16rcAzao9F8UIL1Y"; // SHA256(Base64-URL-encode("casdoor-verifier"))
|
|
449
|
-
|
|
450
|
-
if (provider.type === "AzureAD") {
|
|
451
|
-
if (provider.domain !== "") {
|
|
452
|
-
endpoint = endpoint.replace("common", provider.domain);
|
|
453
|
-
}
|
|
454
|
-
} else if (provider.type === "Apple") {
|
|
455
|
-
redirectUri = `${window.location.origin}/api/callback`;
|
|
456
|
-
}
|
|
457
|
-
|
|
458
|
-
if (
|
|
459
|
-
provider.type === "Google" ||
|
|
460
|
-
provider.type === "GitHub" ||
|
|
461
|
-
provider.type === "QQ" ||
|
|
462
|
-
provider.type === "Facebook" ||
|
|
463
|
-
provider.type === "Weibo" ||
|
|
464
|
-
provider.type === "Gitee" ||
|
|
465
|
-
provider.type === "LinkedIn" ||
|
|
466
|
-
provider.type === "GitLab" ||
|
|
467
|
-
provider.type === "AzureAD" ||
|
|
468
|
-
provider.type === "Slack" ||
|
|
469
|
-
provider.type === "Line" ||
|
|
470
|
-
provider.type === "Amazon" ||
|
|
471
|
-
provider.type === "Auth0" ||
|
|
472
|
-
provider.type === "BattleNet" ||
|
|
473
|
-
provider.type === "Bitbucket" ||
|
|
474
|
-
provider.type === "Box" ||
|
|
475
|
-
provider.type === "CloudFoundry" ||
|
|
476
|
-
provider.type === "Dailymotion" ||
|
|
477
|
-
provider.type === "DigitalOcean" ||
|
|
478
|
-
provider.type === "Discord" ||
|
|
479
|
-
provider.type === "Dropbox" ||
|
|
480
|
-
provider.type === "EveOnline" ||
|
|
481
|
-
provider.type === "Gitea" ||
|
|
482
|
-
provider.type === "Heroku" ||
|
|
483
|
-
provider.type === "InfluxCloud" ||
|
|
484
|
-
provider.type === "Instagram" ||
|
|
485
|
-
provider.type === "Intercom" ||
|
|
486
|
-
provider.type === "Kakao" ||
|
|
487
|
-
provider.type === "MailRu" ||
|
|
488
|
-
provider.type === "Meetup" ||
|
|
489
|
-
provider.type === "MicrosoftOnline" ||
|
|
490
|
-
provider.type === "Naver" ||
|
|
491
|
-
provider.type === "Nextcloud" ||
|
|
492
|
-
provider.type === "OneDrive" ||
|
|
493
|
-
provider.type === "Oura" ||
|
|
494
|
-
provider.type === "Patreon" ||
|
|
495
|
-
provider.type === "PayPal" ||
|
|
496
|
-
provider.type === "SalesForce" ||
|
|
497
|
-
provider.type === "SoundCloud" ||
|
|
498
|
-
provider.type === "Spotify" ||
|
|
499
|
-
provider.type === "Strava" ||
|
|
500
|
-
provider.type === "Stripe" ||
|
|
501
|
-
provider.type === "Tumblr" ||
|
|
502
|
-
provider.type === "Twitch" ||
|
|
503
|
-
provider.type === "Typetalk" ||
|
|
504
|
-
provider.type === "Uber" ||
|
|
505
|
-
provider.type === "VK" ||
|
|
506
|
-
provider.type === "Wepay" ||
|
|
507
|
-
provider.type === "Xero" ||
|
|
508
|
-
provider.type === "Yahoo" ||
|
|
509
|
-
provider.type === "Yammer" ||
|
|
510
|
-
provider.type === "Yandex" ||
|
|
511
|
-
provider.type === "Zoom"
|
|
512
|
-
) {
|
|
513
|
-
return `${endpoint}?client_id=${provider.clientId}&redirect_uri=${redirectUri}&scope=${scope}&response_type=code&state=${state}`;
|
|
514
|
-
} else if (provider.type === "AzureADB2C") {
|
|
515
|
-
return `https://${provider.domain}.b2clogin.com/${
|
|
516
|
-
provider.domain
|
|
517
|
-
}.onmicrosoft.com/${provider.appId}/oauth2/v2.0/authorize?client_id=${
|
|
518
|
-
provider.clientId
|
|
519
|
-
}&nonce=defaultNonce&redirect_uri=${encodeURIComponent(
|
|
520
|
-
redirectUri
|
|
521
|
-
)}&scope=${scope}&response_type=code&state=${state}&prompt=login`;
|
|
522
|
-
} else if (provider.type === "DingTalk") {
|
|
523
|
-
return `${endpoint}?client_id=${provider.clientId}&redirect_uri=${redirectUri}&scope=${scope}&response_type=code&prompt=consent&state=${state}`;
|
|
524
|
-
} else if (provider.type === "WeChat") {
|
|
525
|
-
if (navigator.userAgent.includes("MicroMessenger")) {
|
|
526
|
-
return `${authInfo[provider.type].mpEndpoint}?appid=${
|
|
527
|
-
provider.clientId2
|
|
528
|
-
}&redirect_uri=${redirectUri}&state=${state}&scope=${
|
|
529
|
-
authInfo[provider.type].mpScope
|
|
530
|
-
}&response_type=code#wechat_redirect`;
|
|
531
|
-
} else {
|
|
532
|
-
if (
|
|
533
|
-
provider.clientId2 &&
|
|
534
|
-
provider?.disableSsl &&
|
|
535
|
-
provider?.signName === "media"
|
|
536
|
-
) {
|
|
537
|
-
return `${window.location.origin}/callback?state=${state}&code=${
|
|
538
|
-
"wechat_oa:" + code
|
|
539
|
-
}`;
|
|
540
|
-
}
|
|
541
|
-
return `${endpoint}?appid=${provider.clientId}&redirect_uri=${redirectUri}&scope=${scope}&response_type=code&state=${state}#wechat_redirect`;
|
|
542
|
-
}
|
|
543
|
-
} else if (provider.type === "WeCom") {
|
|
544
|
-
if (provider.subType === "Internal") {
|
|
545
|
-
if (provider.method === "Silent") {
|
|
546
|
-
endpoint = authInfo[provider.type].silentEndpoint;
|
|
547
|
-
return `${endpoint}?appid=${provider.clientId}&redirect_uri=${redirectUri}&state=${state}&scope=${scope}&response_type=code#wechat_redirect`;
|
|
548
|
-
} else if (provider.method === "Normal") {
|
|
549
|
-
endpoint = authInfo[provider.type].internalEndpoint;
|
|
550
|
-
return `${endpoint}?appid=${provider.clientId}&agentid=${provider.appId}&redirect_uri=${redirectUri}&state=${state}&usertype=member`;
|
|
551
|
-
} else {
|
|
552
|
-
return `https://error:not-supported-provider-method:${provider.method}`;
|
|
553
|
-
}
|
|
554
|
-
} else if (provider.subType === "Third-party") {
|
|
555
|
-
if (provider.method === "Silent") {
|
|
556
|
-
endpoint = authInfo[provider.type].silentEndpoint;
|
|
557
|
-
return `${endpoint}?appid=${provider.clientId}&redirect_uri=${redirectUri}&state=${state}&scope=${scope}&response_type=code#wechat_redirect`;
|
|
558
|
-
} else if (provider.method === "Normal") {
|
|
559
|
-
return `${endpoint}?appid=${provider.clientId}&redirect_uri=${redirectUri}&state=${state}&usertype=member`;
|
|
560
|
-
} else {
|
|
561
|
-
return `https://error:not-supported-provider-method:${provider.method}`;
|
|
562
|
-
}
|
|
563
|
-
} else {
|
|
564
|
-
return `https://error:not-supported-provider-sub-type:${provider.subType}`;
|
|
565
|
-
}
|
|
566
|
-
} else if (provider.type === "Lark") {
|
|
567
|
-
return `${endpoint}?app_id=${provider.clientId}&redirect_uri=${redirectUri}&state=${state}`;
|
|
568
|
-
} else if (provider.type === "ADFS") {
|
|
569
|
-
return `${provider.domain}/adfs/oauth2/authorize?client_id=${provider.clientId}&redirect_uri=${redirectUri}&state=${state}&response_type=code&nonce=casdoor&scope=openid`;
|
|
570
|
-
} else if (provider.type === "Baidu") {
|
|
571
|
-
return `${endpoint}?client_id=${provider.clientId}&redirect_uri=${redirectUri}&state=${state}&response_type=code&scope=${scope}&display=popup`;
|
|
572
|
-
} else if (provider.type === "Alipay") {
|
|
573
|
-
return `${endpoint}?app_id=${provider.clientId}&scope=auth_user&redirect_uri=${redirectUri}&state=${state}&response_type=code&scope=${scope}&display=popup`;
|
|
574
|
-
} else if (provider.type === "Casdoor") {
|
|
575
|
-
return `${provider.domain}/login/oauth/authorize?client_id=${provider.clientId}&redirect_uri=${redirectUri}&state=${state}&response_type=code&scope=${scope}`;
|
|
576
|
-
} else if (provider.type === "Infoflow") {
|
|
577
|
-
return `${endpoint}?appid=${provider.clientId}&redirect_uri=${redirectUri}?state=${state}`;
|
|
578
|
-
} else if (provider.type === "Apple") {
|
|
579
|
-
return `${endpoint}?client_id=${provider.clientId}&redirect_uri=${redirectUri}&state=${state}&response_type=code%20id_token&scope=${scope}&response_mode=form_post`;
|
|
580
|
-
} else if (provider.type === "Steam") {
|
|
581
|
-
return `${endpoint}?openid.claimed_id=http://specs.openid.net/auth/2.0/identifier_select&openid.identity=http://specs.openid.net/auth/2.0/identifier_select&openid.mode=checkid_setup&openid.ns=http://specs.openid.net/auth/2.0&openid.realm=${window.location.origin}&openid.return_to=${redirectUri}?state=${state}`;
|
|
582
|
-
} else if (provider.type === "Okta") {
|
|
583
|
-
return `${provider.domain}/v1/authorize?client_id=${provider.clientId}&redirect_uri=${redirectUri}&state=${state}&response_type=code&scope=${scope}`;
|
|
584
|
-
} else if (provider.type === "Douyin" || provider.type === "TikTok") {
|
|
585
|
-
return `${endpoint}?client_key=${provider.clientId}&redirect_uri=${redirectUri}&state=${state}&response_type=code&scope=${scope}`;
|
|
586
|
-
} else if (provider.type === "Custom") {
|
|
587
|
-
return `${provider.customAuthUrl}?client_id=${provider.clientId}&redirect_uri=${redirectUri}&scope=${provider.scopes}&response_type=code&state=${state}`;
|
|
588
|
-
} else if (provider.type === "Bilibili") {
|
|
589
|
-
return `${endpoint}#/?client_id=${provider.clientId}&return_url=${redirectUri}&state=${state}&response_type=code`;
|
|
590
|
-
} else if (provider.type === "Deezer") {
|
|
591
|
-
return `${endpoint}?app_id=${provider.clientId}&redirect_uri=${redirectUri}&perms=${scope}`;
|
|
592
|
-
} else if (provider.type === "Lastfm") {
|
|
593
|
-
return `${endpoint}?api_key=${provider.clientId}&cb=${redirectUri}`;
|
|
594
|
-
} else if (provider.type === "Shopify") {
|
|
595
|
-
return `${endpoint}?client_id=${provider.clientId}&redirect_uri=${redirectUri}&scope=${scope}&state=${state}&grant_options[]=per-user`;
|
|
596
|
-
} else if (provider.type === "Twitter" || provider.type === "Fitbit") {
|
|
597
|
-
return `${endpoint}?client_id=${provider.clientId}&redirect_uri=${redirectUri}&state=${state}&response_type=code&scope=${scope}&code_challenge=${codeChallenge}&code_challenge_method=S256`;
|
|
598
|
-
} else if (provider.type === "MetaMask") {
|
|
599
|
-
return `${redirectUri}?state=${state}`;
|
|
600
|
-
} else if (provider.type === "Web3Onboard") {
|
|
601
|
-
return `${redirectUri}?state=${state}`;
|
|
602
|
-
}
|
|
603
|
-
}
|
|
1
|
+
// Copyright 2021 The Casdoor Authors. All Rights Reserved.
|
|
2
|
+
//
|
|
3
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
// you may not use this file except in compliance with the License.
|
|
5
|
+
// You may obtain a copy of the License at
|
|
6
|
+
//
|
|
7
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
//
|
|
9
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
// See the License for the specific language governing permissions and
|
|
13
|
+
// limitations under the License.
|
|
14
|
+
|
|
15
|
+
import React from "react";
|
|
16
|
+
import * as Util from "./auth-util";
|
|
17
|
+
import * as Setting from "./core";
|
|
18
|
+
|
|
19
|
+
const authInfo: Record<string, any> = {
|
|
20
|
+
Google: {
|
|
21
|
+
scope: "profile+email",
|
|
22
|
+
endpoint: "https://accounts.google.com/signin/oauth",
|
|
23
|
+
},
|
|
24
|
+
GitHub: {
|
|
25
|
+
scope: "user:email+read:user",
|
|
26
|
+
endpoint: "https://github.com/login/oauth/authorize",
|
|
27
|
+
},
|
|
28
|
+
QQ: {
|
|
29
|
+
scope: "get_user_info",
|
|
30
|
+
endpoint: "https://graph.qq.com/oauth2.0/authorize",
|
|
31
|
+
},
|
|
32
|
+
WeChat: {
|
|
33
|
+
scope: "snsapi_login",
|
|
34
|
+
endpoint: "https://open.weixin.qq.com/connect/qrconnect",
|
|
35
|
+
mpScope: "snsapi_userinfo",
|
|
36
|
+
mpEndpoint: "https://open.weixin.qq.com/connect/oauth2/authorize",
|
|
37
|
+
},
|
|
38
|
+
WeChatMiniProgram: {
|
|
39
|
+
endpoint: "https://mp.weixin.qq.com/",
|
|
40
|
+
},
|
|
41
|
+
Facebook: {
|
|
42
|
+
scope: "email,public_profile",
|
|
43
|
+
endpoint: "https://www.facebook.com/dialog/oauth",
|
|
44
|
+
},
|
|
45
|
+
DingTalk: {
|
|
46
|
+
scope: "openid",
|
|
47
|
+
endpoint: "https://login.dingtalk.com/oauth2/auth",
|
|
48
|
+
},
|
|
49
|
+
Weibo: {
|
|
50
|
+
scope: "email",
|
|
51
|
+
endpoint: "https://api.weibo.com/oauth2/authorize",
|
|
52
|
+
},
|
|
53
|
+
Gitee: {
|
|
54
|
+
scope: "user_info%20emails",
|
|
55
|
+
endpoint: "https://gitee.com/oauth/authorize",
|
|
56
|
+
},
|
|
57
|
+
LinkedIn: {
|
|
58
|
+
scope: "r_liteprofile%20r_emailaddress",
|
|
59
|
+
endpoint: "https://www.linkedin.com/oauth/v2/authorization",
|
|
60
|
+
},
|
|
61
|
+
WeCom: {
|
|
62
|
+
scope: "snsapi_userinfo",
|
|
63
|
+
endpoint: "https://open.work.weixin.qq.com/wwopen/sso/3rd_qrConnect",
|
|
64
|
+
silentEndpoint: "https://open.weixin.qq.com/connect/oauth2/authorize",
|
|
65
|
+
internalEndpoint: "https://open.work.weixin.qq.com/wwopen/sso/qrConnect",
|
|
66
|
+
},
|
|
67
|
+
Lark: {
|
|
68
|
+
// scope: "email",
|
|
69
|
+
endpoint: "https://open.feishu.cn/open-apis/authen/v1/index",
|
|
70
|
+
},
|
|
71
|
+
GitLab: {
|
|
72
|
+
scope: "read_user+profile",
|
|
73
|
+
endpoint: "https://gitlab.com/oauth/authorize",
|
|
74
|
+
},
|
|
75
|
+
ADFS: {
|
|
76
|
+
scope: "openid",
|
|
77
|
+
endpoint: "http://example.com",
|
|
78
|
+
},
|
|
79
|
+
Baidu: {
|
|
80
|
+
scope: "basic",
|
|
81
|
+
endpoint: "http://openapi.baidu.com/oauth/2.0/authorize",
|
|
82
|
+
},
|
|
83
|
+
Alipay: {
|
|
84
|
+
scope: "basic",
|
|
85
|
+
endpoint: "https://openauth.alipay.com/oauth2/publicAppAuthorize.htm",
|
|
86
|
+
},
|
|
87
|
+
Casdoor: {
|
|
88
|
+
scope: "openid%20profile%20email",
|
|
89
|
+
endpoint: "http://example.com",
|
|
90
|
+
},
|
|
91
|
+
Infoflow: {
|
|
92
|
+
endpoint: "https://xpc.im.baidu.com/oauth2/authorize",
|
|
93
|
+
},
|
|
94
|
+
Apple: {
|
|
95
|
+
scope: "name%20email",
|
|
96
|
+
endpoint: "https://appleid.apple.com/auth/authorize",
|
|
97
|
+
},
|
|
98
|
+
AzureAD: {
|
|
99
|
+
scope: "user.read",
|
|
100
|
+
endpoint: "https://login.microsoftonline.com/common/oauth2/v2.0/authorize",
|
|
101
|
+
},
|
|
102
|
+
AzureADB2C: {
|
|
103
|
+
scope: "openid",
|
|
104
|
+
endpoint:
|
|
105
|
+
"https://tenant.b2clogin.com/tenant.onmicrosoft.com/userflow/oauth2/v2.0/authorize",
|
|
106
|
+
},
|
|
107
|
+
Slack: {
|
|
108
|
+
scope: "users:read",
|
|
109
|
+
endpoint: "https://slack.com/oauth/authorize",
|
|
110
|
+
},
|
|
111
|
+
Steam: {
|
|
112
|
+
endpoint: "https://steamcommunity.com/openid/login",
|
|
113
|
+
},
|
|
114
|
+
Okta: {
|
|
115
|
+
scope: "openid%20profile%20email",
|
|
116
|
+
endpoint: "http://example.com",
|
|
117
|
+
},
|
|
118
|
+
Douyin: {
|
|
119
|
+
scope: "user_info",
|
|
120
|
+
endpoint: "https://open.douyin.com/platform/oauth/connect",
|
|
121
|
+
},
|
|
122
|
+
Custom: {
|
|
123
|
+
endpoint: "https://example.com/",
|
|
124
|
+
},
|
|
125
|
+
Bilibili: {
|
|
126
|
+
endpoint: "https://passport.bilibili.com/register/pc_oauth2.html",
|
|
127
|
+
},
|
|
128
|
+
Line: {
|
|
129
|
+
scope: "profile%20openid%20email",
|
|
130
|
+
endpoint: "https://access.line.me/oauth2/v2.1/authorize",
|
|
131
|
+
},
|
|
132
|
+
Amazon: {
|
|
133
|
+
scope: "profile",
|
|
134
|
+
endpoint: "https://www.amazon.com/ap/oa",
|
|
135
|
+
},
|
|
136
|
+
Auth0: {
|
|
137
|
+
scope: "openid%20profile%20email",
|
|
138
|
+
endpoint: "http://auth0.com/authorize",
|
|
139
|
+
},
|
|
140
|
+
BattleNet: {
|
|
141
|
+
scope: "openid",
|
|
142
|
+
endpoint: "https://oauth.battlenet.com.cn/authorize",
|
|
143
|
+
},
|
|
144
|
+
Bitbucket: {
|
|
145
|
+
scope: "account",
|
|
146
|
+
endpoint: "https://bitbucket.org/site/oauth2/authorize",
|
|
147
|
+
},
|
|
148
|
+
Box: {
|
|
149
|
+
scope: "root_readwrite",
|
|
150
|
+
endpoint: "https://account.box.com/api/oauth2/authorize",
|
|
151
|
+
},
|
|
152
|
+
CloudFoundry: {
|
|
153
|
+
scope: "cloud_controller.read",
|
|
154
|
+
endpoint: "https://login.cloudfoundry.org/oauth/authorize",
|
|
155
|
+
},
|
|
156
|
+
Dailymotion: {
|
|
157
|
+
scope: "userinfo",
|
|
158
|
+
endpoint: "https://api.dailymotion.com/oauth/authorize",
|
|
159
|
+
},
|
|
160
|
+
Deezer: {
|
|
161
|
+
scope: "basic_access",
|
|
162
|
+
endpoint: "https://connect.deezer.com/oauth/auth.php",
|
|
163
|
+
},
|
|
164
|
+
DigitalOcean: {
|
|
165
|
+
scope: "read",
|
|
166
|
+
endpoint: "https://cloud.digitalocean.com/v1/oauth/authorize",
|
|
167
|
+
},
|
|
168
|
+
Discord: {
|
|
169
|
+
scope: "identify%20email",
|
|
170
|
+
endpoint: "https://discord.com/api/oauth2/authorize",
|
|
171
|
+
},
|
|
172
|
+
Dropbox: {
|
|
173
|
+
scope: "account_info.read",
|
|
174
|
+
endpoint: "https://www.dropbox.com/oauth2/authorize",
|
|
175
|
+
},
|
|
176
|
+
EveOnline: {
|
|
177
|
+
scope: "publicData",
|
|
178
|
+
endpoint: "https://login.eveonline.com/oauth/authorize",
|
|
179
|
+
},
|
|
180
|
+
Fitbit: {
|
|
181
|
+
scope:
|
|
182
|
+
"activity%20heartrate%20location%20nutrition%20profile%20settings%20sleep%20social%20weight",
|
|
183
|
+
endpoint: "https://www.fitbit.com/oauth2/authorize",
|
|
184
|
+
},
|
|
185
|
+
Gitea: {
|
|
186
|
+
scope: "user:email",
|
|
187
|
+
endpoint: "https://gitea.com/login/oauth/authorize",
|
|
188
|
+
},
|
|
189
|
+
Heroku: {
|
|
190
|
+
scope: "global",
|
|
191
|
+
endpoint: "https://id.heroku.com/oauth/authorize",
|
|
192
|
+
},
|
|
193
|
+
InfluxCloud: {
|
|
194
|
+
scope: "read:org",
|
|
195
|
+
endpoint: "https://cloud2.influxdata.com/oauth/authorize",
|
|
196
|
+
},
|
|
197
|
+
Instagram: {
|
|
198
|
+
scope: "user_profile",
|
|
199
|
+
endpoint: "https://api.instagram.com/oauth/authorize",
|
|
200
|
+
},
|
|
201
|
+
Intercom: {
|
|
202
|
+
scope: "user.read",
|
|
203
|
+
endpoint: "https://app.intercom.com/oauth",
|
|
204
|
+
},
|
|
205
|
+
Kakao: {
|
|
206
|
+
scope: "account_email",
|
|
207
|
+
endpoint: "https://kauth.kakao.com/oauth/authorize",
|
|
208
|
+
},
|
|
209
|
+
Lastfm: {
|
|
210
|
+
scope: "user_read",
|
|
211
|
+
endpoint: "https://www.last.fm/api/auth",
|
|
212
|
+
},
|
|
213
|
+
Mailru: {
|
|
214
|
+
scope: "userinfo",
|
|
215
|
+
endpoint: "https://oauth.mail.ru/login",
|
|
216
|
+
},
|
|
217
|
+
Meetup: {
|
|
218
|
+
scope: "basic",
|
|
219
|
+
endpoint: "https://secure.meetup.com/oauth2/authorize",
|
|
220
|
+
},
|
|
221
|
+
MicrosoftOnline: {
|
|
222
|
+
scope: "openid%20profile%20email",
|
|
223
|
+
endpoint: "https://login.microsoftonline.com/common/oauth2/v2.0/authorize",
|
|
224
|
+
},
|
|
225
|
+
Naver: {
|
|
226
|
+
scope: "profile",
|
|
227
|
+
endpoint: "https://nid.naver.com/oauth2.0/authorize",
|
|
228
|
+
},
|
|
229
|
+
Nextcloud: {
|
|
230
|
+
scope: "openid%20profile%20email",
|
|
231
|
+
endpoint: "https://cloud.example.org/apps/oauth2/authorize",
|
|
232
|
+
},
|
|
233
|
+
OneDrive: {
|
|
234
|
+
scope: "offline_access%20onedrive.readonly",
|
|
235
|
+
endpoint: "https://login.live.com/oauth20_authorize.srf",
|
|
236
|
+
},
|
|
237
|
+
Oura: {
|
|
238
|
+
scope: "personal",
|
|
239
|
+
endpoint: "https://cloud.ouraring.com/oauth/authorize",
|
|
240
|
+
},
|
|
241
|
+
Patreon: {
|
|
242
|
+
scope: "identity",
|
|
243
|
+
endpoint: "https://www.patreon.com/oauth2/authorize",
|
|
244
|
+
},
|
|
245
|
+
PayPal: {
|
|
246
|
+
scope: "openid%20profile%20email",
|
|
247
|
+
endpoint: "https://www.sandbox.paypal.com/connect",
|
|
248
|
+
},
|
|
249
|
+
SalesForce: {
|
|
250
|
+
scope: "openid%20profile%20email",
|
|
251
|
+
endpoint: "https://login.salesforce.com/services/oauth2/authorize",
|
|
252
|
+
},
|
|
253
|
+
Shopify: {
|
|
254
|
+
scope: "read_products",
|
|
255
|
+
endpoint: "https://myshopify.com/admin/oauth/authorize",
|
|
256
|
+
},
|
|
257
|
+
Soundcloud: {
|
|
258
|
+
scope: "non-expiring",
|
|
259
|
+
endpoint: "https://api.soundcloud.com/connect",
|
|
260
|
+
},
|
|
261
|
+
Spotify: {
|
|
262
|
+
scope: "user-read-email",
|
|
263
|
+
endpoint: "https://accounts.spotify.com/authorize",
|
|
264
|
+
},
|
|
265
|
+
Strava: {
|
|
266
|
+
scope: "read",
|
|
267
|
+
endpoint: "https://www.strava.com/oauth/authorize",
|
|
268
|
+
},
|
|
269
|
+
Stripe: {
|
|
270
|
+
scope: "read_only",
|
|
271
|
+
endpoint: "https://connect.stripe.com/oauth/authorize",
|
|
272
|
+
},
|
|
273
|
+
TikTok: {
|
|
274
|
+
scope: "user.info.basic",
|
|
275
|
+
endpoint: "https://www.tiktok.com/auth/authorize/",
|
|
276
|
+
},
|
|
277
|
+
Tumblr: {
|
|
278
|
+
scope: "email",
|
|
279
|
+
endpoint: "https://www.tumblr.com/oauth2/authorize",
|
|
280
|
+
},
|
|
281
|
+
Twitch: {
|
|
282
|
+
scope: "user_read",
|
|
283
|
+
endpoint: "https://id.twitch.tv/oauth2/authorize",
|
|
284
|
+
},
|
|
285
|
+
Twitter: {
|
|
286
|
+
scope: "users.read%20tweet.read",
|
|
287
|
+
endpoint: "https://twitter.com/i/oauth2/authorize",
|
|
288
|
+
},
|
|
289
|
+
Typetalk: {
|
|
290
|
+
scope: "my",
|
|
291
|
+
endpoint: "https://typetalk.com/oauth2/authorize",
|
|
292
|
+
},
|
|
293
|
+
Uber: {
|
|
294
|
+
scope: "profile",
|
|
295
|
+
endpoint: "https://login.uber.com/oauth/v2/authorize",
|
|
296
|
+
},
|
|
297
|
+
VK: {
|
|
298
|
+
scope: "email",
|
|
299
|
+
endpoint: "https://oauth.vk.com/authorize",
|
|
300
|
+
},
|
|
301
|
+
Wepay: {
|
|
302
|
+
scope: "manage_accounts%20view_user",
|
|
303
|
+
endpoint: "https://www.wepay.com/v2/oauth2/authorize",
|
|
304
|
+
},
|
|
305
|
+
Xero: {
|
|
306
|
+
scope: "openid%20profile%20email",
|
|
307
|
+
endpoint: "https://login.xero.com/identity/connect/authorize",
|
|
308
|
+
},
|
|
309
|
+
Yahoo: {
|
|
310
|
+
scope: "openid%20profile%20email",
|
|
311
|
+
endpoint: "https://api.login.yahoo.com/oauth2/request_auth",
|
|
312
|
+
},
|
|
313
|
+
Yammer: {
|
|
314
|
+
scope: "user",
|
|
315
|
+
endpoint: "https://www.yammer.com/oauth2/authorize",
|
|
316
|
+
},
|
|
317
|
+
Yandex: {
|
|
318
|
+
scope: "login:email",
|
|
319
|
+
endpoint: "https://oauth.yandex.com/authorize",
|
|
320
|
+
},
|
|
321
|
+
Zoom: {
|
|
322
|
+
scope: "user:read",
|
|
323
|
+
endpoint: "https://zoom.us/oauth/authorize",
|
|
324
|
+
},
|
|
325
|
+
MetaMask: {
|
|
326
|
+
scope: "",
|
|
327
|
+
endpoint: "",
|
|
328
|
+
},
|
|
329
|
+
Web3Onboard: {
|
|
330
|
+
scope: "",
|
|
331
|
+
endpoint: "",
|
|
332
|
+
},
|
|
333
|
+
};
|
|
334
|
+
|
|
335
|
+
export type Provider = {
|
|
336
|
+
type: string;
|
|
337
|
+
category: string;
|
|
338
|
+
displayName: string;
|
|
339
|
+
owner: string;
|
|
340
|
+
name: string;
|
|
341
|
+
domain: string;
|
|
342
|
+
clientId: string;
|
|
343
|
+
appId: string;
|
|
344
|
+
clientId2: string;
|
|
345
|
+
disableSsl: boolean;
|
|
346
|
+
signName: string;
|
|
347
|
+
subType: string;
|
|
348
|
+
method: string;
|
|
349
|
+
customAuthUrl: string;
|
|
350
|
+
customLogo: string;
|
|
351
|
+
scopes: string;
|
|
352
|
+
};
|
|
353
|
+
|
|
354
|
+
export type Application = {
|
|
355
|
+
name: string;
|
|
356
|
+
owner: string;
|
|
357
|
+
organization: string;
|
|
358
|
+
organizationObj: any;
|
|
359
|
+
providers?: Array<any>;
|
|
360
|
+
signupItems?: Array<any>;
|
|
361
|
+
signinMethods: Array<any>;
|
|
362
|
+
termsOfUse: string;
|
|
363
|
+
};
|
|
364
|
+
|
|
365
|
+
export function getProviderUrl(provider: Provider) {
|
|
366
|
+
if (provider.category === "OAuth") {
|
|
367
|
+
const endpoint = authInfo[provider.type as keyof typeof authInfo].endpoint;
|
|
368
|
+
const urlObj = new URL(endpoint);
|
|
369
|
+
|
|
370
|
+
let host = urlObj.host;
|
|
371
|
+
let tokens = host.split(".");
|
|
372
|
+
if (tokens.length > 2) {
|
|
373
|
+
tokens = tokens.slice(1);
|
|
374
|
+
}
|
|
375
|
+
host = tokens.join(".");
|
|
376
|
+
|
|
377
|
+
return `${urlObj.protocol}//${host}`;
|
|
378
|
+
} else {
|
|
379
|
+
const info: { logo: string; url: string } =
|
|
380
|
+
Setting.OtherProviderInfo[provider.category as Setting.OPIKey][
|
|
381
|
+
provider.type as Setting.OPITypeKey
|
|
382
|
+
];
|
|
383
|
+
// avoid crash when provider is not found
|
|
384
|
+
if (info) {
|
|
385
|
+
return info.url;
|
|
386
|
+
}
|
|
387
|
+
return "";
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
export function getProviderLogoWidget(provider?: Provider) {
|
|
392
|
+
if (provider === undefined) {
|
|
393
|
+
return null;
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
const url = getProviderUrl(provider);
|
|
397
|
+
if (url !== "") {
|
|
398
|
+
return (
|
|
399
|
+
<div className="tooltip" data-tip={provider.type}>
|
|
400
|
+
<a target="_blank" rel="noreferrer" href={getProviderUrl(provider)}>
|
|
401
|
+
<img
|
|
402
|
+
width={36}
|
|
403
|
+
height={36}
|
|
404
|
+
src={Setting.getProviderLogoURL(provider)}
|
|
405
|
+
alt={provider.displayName}
|
|
406
|
+
/>
|
|
407
|
+
</a>
|
|
408
|
+
</div>
|
|
409
|
+
);
|
|
410
|
+
} else {
|
|
411
|
+
return (
|
|
412
|
+
<div className="tooltip" data-tip={provider.type}>
|
|
413
|
+
<img
|
|
414
|
+
width={36}
|
|
415
|
+
height={36}
|
|
416
|
+
src={Setting.getProviderLogoURL(provider)}
|
|
417
|
+
alt={provider.displayName}
|
|
418
|
+
/>
|
|
419
|
+
</div>
|
|
420
|
+
);
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
export function getAuthUrl(
|
|
425
|
+
application: Application | null,
|
|
426
|
+
provider: Provider | null,
|
|
427
|
+
method: string,
|
|
428
|
+
code: string
|
|
429
|
+
) {
|
|
430
|
+
if (application === null || provider === null) {
|
|
431
|
+
return "";
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
let endpoint = authInfo[provider.type as keyof typeof authInfo].endpoint;
|
|
435
|
+
let redirectUri = `${window.location.origin}/callback`;
|
|
436
|
+
const scope = authInfo[provider.type as keyof typeof authInfo].scope;
|
|
437
|
+
|
|
438
|
+
const isShortState =
|
|
439
|
+
(provider.type === "WeChat" &&
|
|
440
|
+
navigator.userAgent.includes("MicroMessenger")) ||
|
|
441
|
+
provider.type === "Twitter";
|
|
442
|
+
const state = Util.getStateFromQueryParams(
|
|
443
|
+
application.name,
|
|
444
|
+
provider.name,
|
|
445
|
+
method,
|
|
446
|
+
isShortState
|
|
447
|
+
);
|
|
448
|
+
const codeChallenge = "P3S-a7dr8bgM4bF6vOyiKkKETDl16rcAzao9F8UIL1Y"; // SHA256(Base64-URL-encode("casdoor-verifier"))
|
|
449
|
+
|
|
450
|
+
if (provider.type === "AzureAD") {
|
|
451
|
+
if (provider.domain !== "") {
|
|
452
|
+
endpoint = endpoint.replace("common", provider.domain);
|
|
453
|
+
}
|
|
454
|
+
} else if (provider.type === "Apple") {
|
|
455
|
+
redirectUri = `${window.location.origin}/api/callback`;
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
if (
|
|
459
|
+
provider.type === "Google" ||
|
|
460
|
+
provider.type === "GitHub" ||
|
|
461
|
+
provider.type === "QQ" ||
|
|
462
|
+
provider.type === "Facebook" ||
|
|
463
|
+
provider.type === "Weibo" ||
|
|
464
|
+
provider.type === "Gitee" ||
|
|
465
|
+
provider.type === "LinkedIn" ||
|
|
466
|
+
provider.type === "GitLab" ||
|
|
467
|
+
provider.type === "AzureAD" ||
|
|
468
|
+
provider.type === "Slack" ||
|
|
469
|
+
provider.type === "Line" ||
|
|
470
|
+
provider.type === "Amazon" ||
|
|
471
|
+
provider.type === "Auth0" ||
|
|
472
|
+
provider.type === "BattleNet" ||
|
|
473
|
+
provider.type === "Bitbucket" ||
|
|
474
|
+
provider.type === "Box" ||
|
|
475
|
+
provider.type === "CloudFoundry" ||
|
|
476
|
+
provider.type === "Dailymotion" ||
|
|
477
|
+
provider.type === "DigitalOcean" ||
|
|
478
|
+
provider.type === "Discord" ||
|
|
479
|
+
provider.type === "Dropbox" ||
|
|
480
|
+
provider.type === "EveOnline" ||
|
|
481
|
+
provider.type === "Gitea" ||
|
|
482
|
+
provider.type === "Heroku" ||
|
|
483
|
+
provider.type === "InfluxCloud" ||
|
|
484
|
+
provider.type === "Instagram" ||
|
|
485
|
+
provider.type === "Intercom" ||
|
|
486
|
+
provider.type === "Kakao" ||
|
|
487
|
+
provider.type === "MailRu" ||
|
|
488
|
+
provider.type === "Meetup" ||
|
|
489
|
+
provider.type === "MicrosoftOnline" ||
|
|
490
|
+
provider.type === "Naver" ||
|
|
491
|
+
provider.type === "Nextcloud" ||
|
|
492
|
+
provider.type === "OneDrive" ||
|
|
493
|
+
provider.type === "Oura" ||
|
|
494
|
+
provider.type === "Patreon" ||
|
|
495
|
+
provider.type === "PayPal" ||
|
|
496
|
+
provider.type === "SalesForce" ||
|
|
497
|
+
provider.type === "SoundCloud" ||
|
|
498
|
+
provider.type === "Spotify" ||
|
|
499
|
+
provider.type === "Strava" ||
|
|
500
|
+
provider.type === "Stripe" ||
|
|
501
|
+
provider.type === "Tumblr" ||
|
|
502
|
+
provider.type === "Twitch" ||
|
|
503
|
+
provider.type === "Typetalk" ||
|
|
504
|
+
provider.type === "Uber" ||
|
|
505
|
+
provider.type === "VK" ||
|
|
506
|
+
provider.type === "Wepay" ||
|
|
507
|
+
provider.type === "Xero" ||
|
|
508
|
+
provider.type === "Yahoo" ||
|
|
509
|
+
provider.type === "Yammer" ||
|
|
510
|
+
provider.type === "Yandex" ||
|
|
511
|
+
provider.type === "Zoom"
|
|
512
|
+
) {
|
|
513
|
+
return `${endpoint}?client_id=${provider.clientId}&redirect_uri=${redirectUri}&scope=${scope}&response_type=code&state=${state}`;
|
|
514
|
+
} else if (provider.type === "AzureADB2C") {
|
|
515
|
+
return `https://${provider.domain}.b2clogin.com/${
|
|
516
|
+
provider.domain
|
|
517
|
+
}.onmicrosoft.com/${provider.appId}/oauth2/v2.0/authorize?client_id=${
|
|
518
|
+
provider.clientId
|
|
519
|
+
}&nonce=defaultNonce&redirect_uri=${encodeURIComponent(
|
|
520
|
+
redirectUri
|
|
521
|
+
)}&scope=${scope}&response_type=code&state=${state}&prompt=login`;
|
|
522
|
+
} else if (provider.type === "DingTalk") {
|
|
523
|
+
return `${endpoint}?client_id=${provider.clientId}&redirect_uri=${redirectUri}&scope=${scope}&response_type=code&prompt=consent&state=${state}`;
|
|
524
|
+
} else if (provider.type === "WeChat") {
|
|
525
|
+
if (navigator.userAgent.includes("MicroMessenger")) {
|
|
526
|
+
return `${authInfo[provider.type].mpEndpoint}?appid=${
|
|
527
|
+
provider.clientId2
|
|
528
|
+
}&redirect_uri=${redirectUri}&state=${state}&scope=${
|
|
529
|
+
authInfo[provider.type].mpScope
|
|
530
|
+
}&response_type=code#wechat_redirect`;
|
|
531
|
+
} else {
|
|
532
|
+
if (
|
|
533
|
+
provider.clientId2 &&
|
|
534
|
+
provider?.disableSsl &&
|
|
535
|
+
provider?.signName === "media"
|
|
536
|
+
) {
|
|
537
|
+
return `${window.location.origin}/callback?state=${state}&code=${
|
|
538
|
+
"wechat_oa:" + code
|
|
539
|
+
}`;
|
|
540
|
+
}
|
|
541
|
+
return `${endpoint}?appid=${provider.clientId}&redirect_uri=${redirectUri}&scope=${scope}&response_type=code&state=${state}#wechat_redirect`;
|
|
542
|
+
}
|
|
543
|
+
} else if (provider.type === "WeCom") {
|
|
544
|
+
if (provider.subType === "Internal") {
|
|
545
|
+
if (provider.method === "Silent") {
|
|
546
|
+
endpoint = authInfo[provider.type].silentEndpoint;
|
|
547
|
+
return `${endpoint}?appid=${provider.clientId}&redirect_uri=${redirectUri}&state=${state}&scope=${scope}&response_type=code#wechat_redirect`;
|
|
548
|
+
} else if (provider.method === "Normal") {
|
|
549
|
+
endpoint = authInfo[provider.type].internalEndpoint;
|
|
550
|
+
return `${endpoint}?appid=${provider.clientId}&agentid=${provider.appId}&redirect_uri=${redirectUri}&state=${state}&usertype=member`;
|
|
551
|
+
} else {
|
|
552
|
+
return `https://error:not-supported-provider-method:${provider.method}`;
|
|
553
|
+
}
|
|
554
|
+
} else if (provider.subType === "Third-party") {
|
|
555
|
+
if (provider.method === "Silent") {
|
|
556
|
+
endpoint = authInfo[provider.type].silentEndpoint;
|
|
557
|
+
return `${endpoint}?appid=${provider.clientId}&redirect_uri=${redirectUri}&state=${state}&scope=${scope}&response_type=code#wechat_redirect`;
|
|
558
|
+
} else if (provider.method === "Normal") {
|
|
559
|
+
return `${endpoint}?appid=${provider.clientId}&redirect_uri=${redirectUri}&state=${state}&usertype=member`;
|
|
560
|
+
} else {
|
|
561
|
+
return `https://error:not-supported-provider-method:${provider.method}`;
|
|
562
|
+
}
|
|
563
|
+
} else {
|
|
564
|
+
return `https://error:not-supported-provider-sub-type:${provider.subType}`;
|
|
565
|
+
}
|
|
566
|
+
} else if (provider.type === "Lark") {
|
|
567
|
+
return `${endpoint}?app_id=${provider.clientId}&redirect_uri=${redirectUri}&state=${state}`;
|
|
568
|
+
} else if (provider.type === "ADFS") {
|
|
569
|
+
return `${provider.domain}/adfs/oauth2/authorize?client_id=${provider.clientId}&redirect_uri=${redirectUri}&state=${state}&response_type=code&nonce=casdoor&scope=openid`;
|
|
570
|
+
} else if (provider.type === "Baidu") {
|
|
571
|
+
return `${endpoint}?client_id=${provider.clientId}&redirect_uri=${redirectUri}&state=${state}&response_type=code&scope=${scope}&display=popup`;
|
|
572
|
+
} else if (provider.type === "Alipay") {
|
|
573
|
+
return `${endpoint}?app_id=${provider.clientId}&scope=auth_user&redirect_uri=${redirectUri}&state=${state}&response_type=code&scope=${scope}&display=popup`;
|
|
574
|
+
} else if (provider.type === "Casdoor") {
|
|
575
|
+
return `${provider.domain}/login/oauth/authorize?client_id=${provider.clientId}&redirect_uri=${redirectUri}&state=${state}&response_type=code&scope=${scope}`;
|
|
576
|
+
} else if (provider.type === "Infoflow") {
|
|
577
|
+
return `${endpoint}?appid=${provider.clientId}&redirect_uri=${redirectUri}?state=${state}`;
|
|
578
|
+
} else if (provider.type === "Apple") {
|
|
579
|
+
return `${endpoint}?client_id=${provider.clientId}&redirect_uri=${redirectUri}&state=${state}&response_type=code%20id_token&scope=${scope}&response_mode=form_post`;
|
|
580
|
+
} else if (provider.type === "Steam") {
|
|
581
|
+
return `${endpoint}?openid.claimed_id=http://specs.openid.net/auth/2.0/identifier_select&openid.identity=http://specs.openid.net/auth/2.0/identifier_select&openid.mode=checkid_setup&openid.ns=http://specs.openid.net/auth/2.0&openid.realm=${window.location.origin}&openid.return_to=${redirectUri}?state=${state}`;
|
|
582
|
+
} else if (provider.type === "Okta") {
|
|
583
|
+
return `${provider.domain}/v1/authorize?client_id=${provider.clientId}&redirect_uri=${redirectUri}&state=${state}&response_type=code&scope=${scope}`;
|
|
584
|
+
} else if (provider.type === "Douyin" || provider.type === "TikTok") {
|
|
585
|
+
return `${endpoint}?client_key=${provider.clientId}&redirect_uri=${redirectUri}&state=${state}&response_type=code&scope=${scope}`;
|
|
586
|
+
} else if (provider.type === "Custom") {
|
|
587
|
+
return `${provider.customAuthUrl}?client_id=${provider.clientId}&redirect_uri=${redirectUri}&scope=${provider.scopes}&response_type=code&state=${state}`;
|
|
588
|
+
} else if (provider.type === "Bilibili") {
|
|
589
|
+
return `${endpoint}#/?client_id=${provider.clientId}&return_url=${redirectUri}&state=${state}&response_type=code`;
|
|
590
|
+
} else if (provider.type === "Deezer") {
|
|
591
|
+
return `${endpoint}?app_id=${provider.clientId}&redirect_uri=${redirectUri}&perms=${scope}`;
|
|
592
|
+
} else if (provider.type === "Lastfm") {
|
|
593
|
+
return `${endpoint}?api_key=${provider.clientId}&cb=${redirectUri}`;
|
|
594
|
+
} else if (provider.type === "Shopify") {
|
|
595
|
+
return `${endpoint}?client_id=${provider.clientId}&redirect_uri=${redirectUri}&scope=${scope}&state=${state}&grant_options[]=per-user`;
|
|
596
|
+
} else if (provider.type === "Twitter" || provider.type === "Fitbit") {
|
|
597
|
+
return `${endpoint}?client_id=${provider.clientId}&redirect_uri=${redirectUri}&state=${state}&response_type=code&scope=${scope}&code_challenge=${codeChallenge}&code_challenge_method=S256`;
|
|
598
|
+
} else if (provider.type === "MetaMask") {
|
|
599
|
+
return `${redirectUri}?state=${state}`;
|
|
600
|
+
} else if (provider.type === "Web3Onboard") {
|
|
601
|
+
return `${redirectUri}?state=${state}`;
|
|
602
|
+
}
|
|
603
|
+
}
|