@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,198 +1,198 @@
|
|
|
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 { getAcceptLanguage, ROOT_URLS } from "./core";
|
|
16
|
-
|
|
17
|
-
export function getAccount(query = "") {
|
|
18
|
-
return fetch(`${ROOT_URLS.casdoor}/api/get-account${query}`, {
|
|
19
|
-
method: "GET",
|
|
20
|
-
credentials: "include",
|
|
21
|
-
headers: {
|
|
22
|
-
"Accept-Language": getAcceptLanguage(),
|
|
23
|
-
},
|
|
24
|
-
}).then((res) => res.json());
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* {"application":"app-sm-api","organization":"org-hosting","username":"db","name":"David Buckley","password":"password","confirm":"password","email":"me@example.com","emailCode":"433910","countryCode":"US","agreement":true,"plan":null,"pricing":null}
|
|
29
|
-
* @param {*} values
|
|
30
|
-
* @returns
|
|
31
|
-
*/
|
|
32
|
-
export function signup(values) {
|
|
33
|
-
let url = `${ROOT_URLS.casdoor}/api/signup`;
|
|
34
|
-
if (ROOT_URLS.springmicro) {
|
|
35
|
-
url = `${ROOT_URLS.springmicro}/api/accounts/users/register`;
|
|
36
|
-
}
|
|
37
|
-
return fetch(url, {
|
|
38
|
-
method: "POST",
|
|
39
|
-
credentials: "include",
|
|
40
|
-
body: JSON.stringify(values),
|
|
41
|
-
headers: {
|
|
42
|
-
"Accept-Language": getAcceptLanguage(),
|
|
43
|
-
"Content-Type": "application/json",
|
|
44
|
-
},
|
|
45
|
-
}).then((res) => res.json());
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
export function getEmailAndPhone(organization, username) {
|
|
49
|
-
return fetch(
|
|
50
|
-
`${ROOT_URLS.casdoor}/api/get-email-and-phone?organization=${organization}&username=${username}`,
|
|
51
|
-
{
|
|
52
|
-
method: "GET",
|
|
53
|
-
credentials: "include",
|
|
54
|
-
headers: {
|
|
55
|
-
"Accept-Language": getAcceptLanguage(),
|
|
56
|
-
},
|
|
57
|
-
}
|
|
58
|
-
).then((res) => res.json());
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
export function casLoginParamsToQuery(casParams) {
|
|
62
|
-
return `?type=${casParams?.type}&id=${casParams?.id}&redirectUri=${casParams?.service}`;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
export function oAuthParamsToQuery(oAuthParams) {
|
|
66
|
-
// login
|
|
67
|
-
if (oAuthParams === null || oAuthParams === undefined) {
|
|
68
|
-
return "";
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
// code
|
|
72
|
-
return `?clientId=${oAuthParams.clientId}&responseType=${
|
|
73
|
-
oAuthParams.responseType
|
|
74
|
-
}&redirectUri=${encodeURIComponent(oAuthParams.redirectUri)}&type=${
|
|
75
|
-
oAuthParams.type
|
|
76
|
-
}&scope=${oAuthParams.scope}&state=${oAuthParams.state}&nonce=${
|
|
77
|
-
oAuthParams.nonce
|
|
78
|
-
}&code_challenge_method=${oAuthParams.challengeMethod}&code_challenge=${
|
|
79
|
-
oAuthParams.codeChallenge
|
|
80
|
-
}`;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
export function getApplicationLogin(params) {
|
|
84
|
-
const queryParams =
|
|
85
|
-
params?.type === "cas"
|
|
86
|
-
? casLoginParamsToQuery(params)
|
|
87
|
-
: oAuthParamsToQuery(params);
|
|
88
|
-
return fetch(`${ROOT_URLS.casdoor}/api/get-app-login${queryParams}`, {
|
|
89
|
-
method: "GET",
|
|
90
|
-
credentials: "include",
|
|
91
|
-
headers: {
|
|
92
|
-
"Accept-Language": getAcceptLanguage(),
|
|
93
|
-
},
|
|
94
|
-
}).then((res) => res.json());
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
export function login(values, oAuthParams) {
|
|
98
|
-
return fetch(
|
|
99
|
-
`${ROOT_URLS.casdoor}/api/login${oAuthParamsToQuery(oAuthParams)}`,
|
|
100
|
-
{
|
|
101
|
-
method: "POST",
|
|
102
|
-
credentials: "include",
|
|
103
|
-
body: JSON.stringify(values),
|
|
104
|
-
headers: {
|
|
105
|
-
"Accept-Language": getAcceptLanguage(),
|
|
106
|
-
},
|
|
107
|
-
}
|
|
108
|
-
).then((res) => res.json());
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
export function loginCas(values, params) {
|
|
112
|
-
return fetch(`${ROOT_URLS.casdoor}/api/login?service=${params.service}`, {
|
|
113
|
-
method: "POST",
|
|
114
|
-
credentials: "include",
|
|
115
|
-
body: JSON.stringify(values),
|
|
116
|
-
headers: {
|
|
117
|
-
"Accept-Language": getAcceptLanguage(),
|
|
118
|
-
},
|
|
119
|
-
}).then((res) => res.json());
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
export function logout() {
|
|
123
|
-
return fetch(`${ROOT_URLS.casdoor}/api/logout`, {
|
|
124
|
-
method: "POST",
|
|
125
|
-
credentials: "include",
|
|
126
|
-
headers: {
|
|
127
|
-
"Accept-Language": getAcceptLanguage(),
|
|
128
|
-
},
|
|
129
|
-
}).then((res) => res.json());
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
export function unlink(values) {
|
|
133
|
-
return fetch(`${ROOT_URLS.casdoor}/api/unlink`, {
|
|
134
|
-
method: "POST",
|
|
135
|
-
credentials: "include",
|
|
136
|
-
body: JSON.stringify(values),
|
|
137
|
-
headers: {
|
|
138
|
-
"Accept-Language": getAcceptLanguage(),
|
|
139
|
-
},
|
|
140
|
-
}).then((res) => res.json());
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
export function getSamlLogin(providerId, relayState) {
|
|
144
|
-
return fetch(
|
|
145
|
-
`${ROOT_URLS.casdoor}/api/get-saml-login?id=${providerId}&relayState=${relayState}`,
|
|
146
|
-
{
|
|
147
|
-
method: "GET",
|
|
148
|
-
credentials: "include",
|
|
149
|
-
headers: {
|
|
150
|
-
"Accept-Language": getAcceptLanguage(),
|
|
151
|
-
},
|
|
152
|
-
}
|
|
153
|
-
).then((res) => res.json());
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
export function loginWithSaml(values, param) {
|
|
157
|
-
return fetch(`${ROOT_URLS.casdoor}/api/login${param}`, {
|
|
158
|
-
method: "POST",
|
|
159
|
-
credentials: "include",
|
|
160
|
-
body: JSON.stringify(values),
|
|
161
|
-
headers: {
|
|
162
|
-
"Accept-Language": getAcceptLanguage(),
|
|
163
|
-
},
|
|
164
|
-
}).then((res) => res.json());
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
export function getWechatMessageEvent(ticket) {
|
|
168
|
-
return fetch(`${ROOT_URLS.casdoor}/api/get-webhook-event?ticket=${ticket}`, {
|
|
169
|
-
method: "GET",
|
|
170
|
-
credentials: "include",
|
|
171
|
-
headers: {
|
|
172
|
-
"Accept-Language": getAcceptLanguage(),
|
|
173
|
-
},
|
|
174
|
-
}).then((res) => res.json());
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
export function getWechatQRCode(providerId) {
|
|
178
|
-
return fetch(`${ROOT_URLS.casdoor}/api/get-qrcode?id=${providerId}`, {
|
|
179
|
-
method: "GET",
|
|
180
|
-
credentials: "include",
|
|
181
|
-
headers: {
|
|
182
|
-
"Accept-Language": getAcceptLanguage(),
|
|
183
|
-
},
|
|
184
|
-
}).then((res) => res.json());
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
export function getCaptchaStatus(values) {
|
|
188
|
-
return fetch(
|
|
189
|
-
`${ROOT_URLS.casdoor}/api/get-captcha-status?organization=${values["organization"]}&userId=${values["username"]}`,
|
|
190
|
-
{
|
|
191
|
-
method: "GET",
|
|
192
|
-
credentials: "include",
|
|
193
|
-
headers: {
|
|
194
|
-
"Accept-Language": getAcceptLanguage(),
|
|
195
|
-
},
|
|
196
|
-
}
|
|
197
|
-
).then((res) => res.json());
|
|
198
|
-
}
|
|
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 { getAcceptLanguage, ROOT_URLS } from "./core";
|
|
16
|
+
|
|
17
|
+
export function getAccount(query = "") {
|
|
18
|
+
return fetch(`${ROOT_URLS.casdoor}/api/get-account${query}`, {
|
|
19
|
+
method: "GET",
|
|
20
|
+
credentials: "include",
|
|
21
|
+
headers: {
|
|
22
|
+
"Accept-Language": getAcceptLanguage(),
|
|
23
|
+
},
|
|
24
|
+
}).then((res) => res.json());
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* {"application":"app-sm-api","organization":"org-hosting","username":"db","name":"David Buckley","password":"password","confirm":"password","email":"me@example.com","emailCode":"433910","countryCode":"US","agreement":true,"plan":null,"pricing":null}
|
|
29
|
+
* @param {*} values
|
|
30
|
+
* @returns
|
|
31
|
+
*/
|
|
32
|
+
export function signup(values) {
|
|
33
|
+
let url = `${ROOT_URLS.casdoor}/api/signup`;
|
|
34
|
+
if (ROOT_URLS.springmicro) {
|
|
35
|
+
url = `${ROOT_URLS.springmicro}/api/accounts/users/register`;
|
|
36
|
+
}
|
|
37
|
+
return fetch(url, {
|
|
38
|
+
method: "POST",
|
|
39
|
+
credentials: "include",
|
|
40
|
+
body: JSON.stringify(values),
|
|
41
|
+
headers: {
|
|
42
|
+
"Accept-Language": getAcceptLanguage(),
|
|
43
|
+
"Content-Type": "application/json",
|
|
44
|
+
},
|
|
45
|
+
}).then((res) => res.json());
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export function getEmailAndPhone(organization, username) {
|
|
49
|
+
return fetch(
|
|
50
|
+
`${ROOT_URLS.casdoor}/api/get-email-and-phone?organization=${organization}&username=${username}`,
|
|
51
|
+
{
|
|
52
|
+
method: "GET",
|
|
53
|
+
credentials: "include",
|
|
54
|
+
headers: {
|
|
55
|
+
"Accept-Language": getAcceptLanguage(),
|
|
56
|
+
},
|
|
57
|
+
}
|
|
58
|
+
).then((res) => res.json());
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export function casLoginParamsToQuery(casParams) {
|
|
62
|
+
return `?type=${casParams?.type}&id=${casParams?.id}&redirectUri=${casParams?.service}`;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export function oAuthParamsToQuery(oAuthParams) {
|
|
66
|
+
// login
|
|
67
|
+
if (oAuthParams === null || oAuthParams === undefined) {
|
|
68
|
+
return "";
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// code
|
|
72
|
+
return `?clientId=${oAuthParams.clientId}&responseType=${
|
|
73
|
+
oAuthParams.responseType
|
|
74
|
+
}&redirectUri=${encodeURIComponent(oAuthParams.redirectUri)}&type=${
|
|
75
|
+
oAuthParams.type
|
|
76
|
+
}&scope=${oAuthParams.scope}&state=${oAuthParams.state}&nonce=${
|
|
77
|
+
oAuthParams.nonce
|
|
78
|
+
}&code_challenge_method=${oAuthParams.challengeMethod}&code_challenge=${
|
|
79
|
+
oAuthParams.codeChallenge
|
|
80
|
+
}`;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export function getApplicationLogin(params) {
|
|
84
|
+
const queryParams =
|
|
85
|
+
params?.type === "cas"
|
|
86
|
+
? casLoginParamsToQuery(params)
|
|
87
|
+
: oAuthParamsToQuery(params);
|
|
88
|
+
return fetch(`${ROOT_URLS.casdoor}/api/get-app-login${queryParams}`, {
|
|
89
|
+
method: "GET",
|
|
90
|
+
credentials: "include",
|
|
91
|
+
headers: {
|
|
92
|
+
"Accept-Language": getAcceptLanguage(),
|
|
93
|
+
},
|
|
94
|
+
}).then((res) => res.json());
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export function login(values, oAuthParams) {
|
|
98
|
+
return fetch(
|
|
99
|
+
`${ROOT_URLS.casdoor}/api/login${oAuthParamsToQuery(oAuthParams)}`,
|
|
100
|
+
{
|
|
101
|
+
method: "POST",
|
|
102
|
+
credentials: "include",
|
|
103
|
+
body: JSON.stringify(values),
|
|
104
|
+
headers: {
|
|
105
|
+
"Accept-Language": getAcceptLanguage(),
|
|
106
|
+
},
|
|
107
|
+
}
|
|
108
|
+
).then((res) => res.json());
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
export function loginCas(values, params) {
|
|
112
|
+
return fetch(`${ROOT_URLS.casdoor}/api/login?service=${params.service}`, {
|
|
113
|
+
method: "POST",
|
|
114
|
+
credentials: "include",
|
|
115
|
+
body: JSON.stringify(values),
|
|
116
|
+
headers: {
|
|
117
|
+
"Accept-Language": getAcceptLanguage(),
|
|
118
|
+
},
|
|
119
|
+
}).then((res) => res.json());
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
export function logout() {
|
|
123
|
+
return fetch(`${ROOT_URLS.casdoor}/api/logout`, {
|
|
124
|
+
method: "POST",
|
|
125
|
+
credentials: "include",
|
|
126
|
+
headers: {
|
|
127
|
+
"Accept-Language": getAcceptLanguage(),
|
|
128
|
+
},
|
|
129
|
+
}).then((res) => res.json());
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
export function unlink(values) {
|
|
133
|
+
return fetch(`${ROOT_URLS.casdoor}/api/unlink`, {
|
|
134
|
+
method: "POST",
|
|
135
|
+
credentials: "include",
|
|
136
|
+
body: JSON.stringify(values),
|
|
137
|
+
headers: {
|
|
138
|
+
"Accept-Language": getAcceptLanguage(),
|
|
139
|
+
},
|
|
140
|
+
}).then((res) => res.json());
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
export function getSamlLogin(providerId, relayState) {
|
|
144
|
+
return fetch(
|
|
145
|
+
`${ROOT_URLS.casdoor}/api/get-saml-login?id=${providerId}&relayState=${relayState}`,
|
|
146
|
+
{
|
|
147
|
+
method: "GET",
|
|
148
|
+
credentials: "include",
|
|
149
|
+
headers: {
|
|
150
|
+
"Accept-Language": getAcceptLanguage(),
|
|
151
|
+
},
|
|
152
|
+
}
|
|
153
|
+
).then((res) => res.json());
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
export function loginWithSaml(values, param) {
|
|
157
|
+
return fetch(`${ROOT_URLS.casdoor}/api/login${param}`, {
|
|
158
|
+
method: "POST",
|
|
159
|
+
credentials: "include",
|
|
160
|
+
body: JSON.stringify(values),
|
|
161
|
+
headers: {
|
|
162
|
+
"Accept-Language": getAcceptLanguage(),
|
|
163
|
+
},
|
|
164
|
+
}).then((res) => res.json());
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
export function getWechatMessageEvent(ticket) {
|
|
168
|
+
return fetch(`${ROOT_URLS.casdoor}/api/get-webhook-event?ticket=${ticket}`, {
|
|
169
|
+
method: "GET",
|
|
170
|
+
credentials: "include",
|
|
171
|
+
headers: {
|
|
172
|
+
"Accept-Language": getAcceptLanguage(),
|
|
173
|
+
},
|
|
174
|
+
}).then((res) => res.json());
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
export function getWechatQRCode(providerId) {
|
|
178
|
+
return fetch(`${ROOT_URLS.casdoor}/api/get-qrcode?id=${providerId}`, {
|
|
179
|
+
method: "GET",
|
|
180
|
+
credentials: "include",
|
|
181
|
+
headers: {
|
|
182
|
+
"Accept-Language": getAcceptLanguage(),
|
|
183
|
+
},
|
|
184
|
+
}).then((res) => res.json());
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
export function getCaptchaStatus(values) {
|
|
188
|
+
return fetch(
|
|
189
|
+
`${ROOT_URLS.casdoor}/api/get-captcha-status?organization=${values["organization"]}&userId=${values["username"]}`,
|
|
190
|
+
{
|
|
191
|
+
method: "GET",
|
|
192
|
+
credentials: "include",
|
|
193
|
+
headers: {
|
|
194
|
+
"Accept-Language": getAcceptLanguage(),
|
|
195
|
+
},
|
|
196
|
+
}
|
|
197
|
+
).then((res) => res.json());
|
|
198
|
+
}
|