@springmicro/auth 0.7.4 → 0.7.6

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.
Files changed (45) hide show
  1. package/README.md +60 -60
  2. package/package.json +2 -2
  3. package/src/components/forms/AgreementModal.tsx +88 -88
  4. package/src/components/forms/CaptchaController.tsx +94 -94
  5. package/src/components/forms/CaptchaModal.jsx +171 -171
  6. package/src/components/forms/CaptchaWidget.jsx +146 -146
  7. package/src/components/forms/PasswordChecker.ts +88 -88
  8. package/src/components/forms/util/auth-api.ts +198 -198
  9. package/src/components/forms/util/auth-util.tsx +346 -346
  10. package/src/components/forms/util/core.ts +493 -493
  11. package/src/components/forms/util/invitation-api.ts +132 -132
  12. package/src/components/forms/util/provider.tsx +603 -603
  13. package/src/components/provider/AdfsLoginButton.jsx +38 -38
  14. package/src/components/provider/AlipayLoginButton.jsx +38 -38
  15. package/src/components/provider/AppleLoginButton.jsx +38 -38
  16. package/src/components/provider/AzureADB2CLoginButton.jsx +38 -38
  17. package/src/components/provider/AzureADLoginButton.jsx +38 -38
  18. package/src/components/provider/BaiduLoginButton.jsx +38 -38
  19. package/src/components/provider/BilibiliLoginButton.jsx +37 -37
  20. package/src/components/provider/CasdoorLoginButton.jsx +38 -38
  21. package/src/components/provider/DingTalkLoginButton.jsx +37 -37
  22. package/src/components/provider/DouyinLoginButton.jsx +38 -38
  23. package/src/components/provider/FacebookLoginButton.jsx +37 -37
  24. package/src/components/provider/GitHubLoginButton.jsx +37 -37
  25. package/src/components/provider/GitLabLoginButton.jsx +38 -38
  26. package/src/components/provider/GiteeLoginButton.jsx +34 -34
  27. package/src/components/provider/GoogleLoginButton.jsx +68 -68
  28. package/src/components/provider/InfoflowLoginButton.jsx +38 -38
  29. package/src/components/provider/LarkLoginButton.jsx +38 -38
  30. package/src/components/provider/LinkedInLoginButton.jsx +37 -37
  31. package/src/components/provider/LoginButton.jsx +33 -33
  32. package/src/components/provider/OktaLoginButton.jsx +38 -38
  33. package/src/components/provider/Provider.jsx +3 -3
  34. package/src/components/provider/ProviderButton.jsx +327 -327
  35. package/src/components/provider/QqLoginButton.jsx +31 -31
  36. package/src/components/provider/SelfLoginButton.jsx +47 -47
  37. package/src/components/provider/SlackLoginButton.jsx +38 -38
  38. package/src/components/provider/SteamLoginButton.jsx +38 -38
  39. package/src/components/provider/WeComLoginButton.jsx +34 -34
  40. package/src/components/provider/Web3Auth.jsx +365 -365
  41. package/src/components/provider/WechatLoginButton.jsx +37 -37
  42. package/src/components/provider/WeiboLoginButton.jsx +34 -34
  43. package/src/i18n/en/signup.json +48 -48
  44. package/src/i18n/index.ts +17 -17
  45. package/vite.config.ts +33 -33
@@ -1,327 +1,327 @@
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 i18next from "i18next";
17
- import * as Provider from "./Provider";
18
- import { getProviderLogoURL } from "../forms/util/core";
19
- import {
20
- GithubLoginButton,
21
- GoogleLoginButton,
22
- } from "react-social-login-buttons";
23
- import QqLoginButton from "./QqLoginButton";
24
- import FacebookLoginButton from "./FacebookLoginButton";
25
- import WeiboLoginButton from "./WeiboLoginButton";
26
- import GiteeLoginButton from "./GiteeLoginButton";
27
- import WechatLoginButton from "./WechatLoginButton";
28
- import DingTalkLoginButton from "./DingTalkLoginButton";
29
- import LinkedInLoginButton from "./LinkedInLoginButton";
30
- import WeComLoginButton from "./WeComLoginButton";
31
- import LarkLoginButton from "./LarkLoginButton";
32
- import GitLabLoginButton from "./GitLabLoginButton";
33
- import AdfsLoginButton from "./AdfsLoginButton";
34
- import CasdoorLoginButton from "./CasdoorLoginButton";
35
- import BaiduLoginButton from "./BaiduLoginButton";
36
- import AlipayLoginButton from "./AlipayLoginButton";
37
- import InfoflowLoginButton from "./InfoflowLoginButton";
38
- import AppleLoginButton from "./AppleLoginButton";
39
- import AzureADLoginButton from "./AzureADLoginButton";
40
- import AzureADB2CLoginButton from "./AzureADB2CLoginButton";
41
- import SlackLoginButton from "./SlackLoginButton";
42
- import SteamLoginButton from "./SteamLoginButton";
43
- import BilibiliLoginButton from "./BilibiliLoginButton";
44
- import OktaLoginButton from "./OktaLoginButton";
45
- import DouyinLoginButton from "./DouyinLoginButton";
46
- import LoginButton from "./LoginButton";
47
- import * as AuthBackend from "../forms/util/auth-api";
48
- import { WechatOfficialAccountModal } from "../forms/util/auth-util";
49
-
50
- function getSigninButton(provider) {
51
- const text = i18next
52
- .t("login:Sign in with {type}")
53
- .replace(
54
- "{type}",
55
- provider.displayName !== "" ? provider.displayName : provider.type
56
- );
57
- if (provider.type === "GitHub") {
58
- return <GithubLoginButton text={text} align={"center"} />;
59
- } else if (provider.type === "Google") {
60
- return <GoogleLoginButton text={text} align={"center"} />;
61
- } else if (provider.type === "QQ") {
62
- return <QqLoginButton text={text} align={"center"} />;
63
- } else if (provider.type === "Facebook") {
64
- return <FacebookLoginButton text={text} align={"center"} />;
65
- } else if (provider.type === "Weibo") {
66
- return <WeiboLoginButton text={text} align={"center"} />;
67
- } else if (provider.type === "Gitee") {
68
- return <GiteeLoginButton text={text} align={"center"} />;
69
- } else if (provider.type === "WeChat") {
70
- return <WechatLoginButton text={text} align={"center"} />;
71
- } else if (provider.type === "DingTalk") {
72
- return <DingTalkLoginButton text={text} align={"center"} />;
73
- } else if (provider.type === "LinkedIn") {
74
- return <LinkedInLoginButton text={text} align={"center"} />;
75
- } else if (provider.type === "WeCom") {
76
- return <WeComLoginButton text={text} align={"center"} />;
77
- } else if (provider.type === "Lark") {
78
- return <LarkLoginButton text={text} align={"center"} />;
79
- } else if (provider.type === "GitLab") {
80
- return <GitLabLoginButton text={text} align={"center"} />;
81
- } else if (provider.type === "ADFS") {
82
- return <AdfsLoginButton text={text} align={"center"} />;
83
- } else if (provider.type === "Casdoor") {
84
- return <CasdoorLoginButton text={text} align={"center"} />;
85
- } else if (provider.type === "Baidu") {
86
- return <BaiduLoginButton text={text} align={"center"} />;
87
- } else if (provider.type === "Alipay") {
88
- return <AlipayLoginButton text={text} align={"center"} />;
89
- } else if (provider.type === "Infoflow") {
90
- return <InfoflowLoginButton text={text} align={"center"} />;
91
- } else if (provider.type === "Apple") {
92
- return <AppleLoginButton text={text} align={"center"} />;
93
- } else if (provider.type === "AzureAD") {
94
- return <AzureADLoginButton text={text} align={"center"} />;
95
- } else if (provider.type === "AzureADB2C") {
96
- return <AzureADB2CLoginButton text={text} align={"center"} />;
97
- } else if (provider.type === "Slack") {
98
- return <SlackLoginButton text={text} align={"center"} />;
99
- } else if (provider.type === "Steam") {
100
- return <SteamLoginButton text={text} align={"center"} />;
101
- } else if (provider.type === "Bilibili") {
102
- return <BilibiliLoginButton text={text} align={"center"} />;
103
- } else if (provider.type === "Okta") {
104
- return <OktaLoginButton text={text} align={"center"} />;
105
- } else if (provider.type === "Douyin") {
106
- return <DouyinLoginButton text={text} align={"center"} />;
107
- } else {
108
- return (
109
- <LoginButton
110
- key={provider.type}
111
- type={provider.type}
112
- logoUrl={getProviderLogoURL(provider)}
113
- />
114
- );
115
- }
116
- }
117
-
118
- function goToSamlUrl(provider, location) {
119
- const params = new URLSearchParams(location.search);
120
- const clientId = params.get("client_id") ?? "";
121
- const state = params.get("state");
122
- const realRedirectUri = params.get("redirect_uri");
123
- const redirectUri = `${window.location.origin}/callback/saml`;
124
- const providerName = provider.name;
125
-
126
- const relayState = `${clientId}&${state}&${providerName}&${realRedirectUri}&${redirectUri}`;
127
- AuthBackend.getSamlLogin(
128
- `${provider.owner}/${providerName}`,
129
- btoa(relayState)
130
- ).then((res) => {
131
- if (res.data2 === "POST") {
132
- document.write(res.data);
133
- } else {
134
- window.location.href = res.data;
135
- }
136
- });
137
- }
138
-
139
- export function goToWeb3Url(application, provider, method) {
140
- if (provider.type === "MetaMask") {
141
- import("./Web3Auth").then((module) => {
142
- const authViaMetaMask = module.authViaMetaMask;
143
- authViaMetaMask(application, provider, method);
144
- });
145
- } else if (provider.type === "Web3Onboard") {
146
- import("./Web3Auth").then((module) => {
147
- const authViaWeb3Onboard = module.authViaWeb3Onboard;
148
- authViaWeb3Onboard(application, provider, method);
149
- });
150
- }
151
- }
152
-
153
- export function renderProviderLogo(
154
- provider,
155
- application,
156
- width,
157
- margin,
158
- size,
159
- location
160
- ) {
161
- if (size === "small") {
162
- if (provider.category === "OAuth") {
163
- if (
164
- provider.type === "WeChat" &&
165
- provider.clientId2 !== "" &&
166
- provider.clientSecret2 !== "" &&
167
- provider.disableSsl === true &&
168
- !navigator.userAgent.includes("MicroMessenger")
169
- ) {
170
- return (
171
- <a key={provider.displayName}>
172
- <img
173
- width={width}
174
- height={width}
175
- src={getProviderLogoURL(provider)}
176
- alt={provider.displayName}
177
- className="provider-img"
178
- style={{ margin: margin }}
179
- onClick={() => {
180
- WechatOfficialAccountModal(application, provider, "signup");
181
- }}
182
- />
183
- </a>
184
- );
185
- } else {
186
- return (
187
- <a
188
- key={provider.displayName}
189
- href={Provider.getAuthUrl(application, provider, "signup")}
190
- >
191
- <img
192
- width={width}
193
- height={width}
194
- src={getProviderLogoURL(provider)}
195
- alt={provider.displayName}
196
- className="provider-img"
197
- style={{ margin: margin }}
198
- />
199
- </a>
200
- );
201
- }
202
- } else if (provider.category === "SAML") {
203
- return (
204
- <a
205
- key={provider.displayName}
206
- onClick={() => goToSamlUrl(provider, location)}
207
- >
208
- <img
209
- width={width}
210
- height={width}
211
- src={getProviderLogoURL(provider)}
212
- alt={provider.displayName}
213
- className="provider-img"
214
- style={{ margin: margin }}
215
- />
216
- </a>
217
- );
218
- } else if (provider.category === "Web3") {
219
- return (
220
- <a
221
- key={provider.displayName}
222
- onClick={() => goToWeb3Url(application, provider, "signup")}
223
- >
224
- <img
225
- width={width}
226
- height={width}
227
- src={getProviderLogoURL(provider)}
228
- alt={provider.displayName}
229
- className="provider-img"
230
- style={{ margin: margin }}
231
- />
232
- </a>
233
- );
234
- }
235
- } else if (provider.type === "Custom") {
236
- // style definition
237
- const text = i18next
238
- .t("login:Sign in with {type}")
239
- .replace("{type}", provider.displayName);
240
- const customAStyle = { display: "block", height: "55px", color: "#000" };
241
- const customButtonStyle = {
242
- display: "flex",
243
- alignItems: "center",
244
- width: "calc(100% - 10px)",
245
- height: "50px",
246
- margin: "5px",
247
- padding: "0 10px",
248
- backgroundColor: "transparent",
249
- boxShadow: "0px 1px 3px rgba(0,0,0,0.5)",
250
- border: "0px",
251
- borderRadius: "3px",
252
- cursor: "pointer",
253
- };
254
- const customImgStyle = { justfyContent: "space-between" };
255
- const customSpanStyle = {
256
- textAlign: "center",
257
- width: "100%",
258
- fontSize: "19px",
259
- };
260
- if (provider.category === "OAuth") {
261
- return (
262
- <a
263
- key={provider.displayName}
264
- href={Provider.getAuthUrl(application, provider, "signup")}
265
- style={customAStyle}
266
- >
267
- <div style={customButtonStyle}>
268
- <img
269
- width={26}
270
- src={getProviderLogoURL(provider)}
271
- alt={provider.displayName}
272
- className="provider-img"
273
- style={customImgStyle}
274
- />
275
- <span style={customSpanStyle}>{text}</span>
276
- </div>
277
- </a>
278
- );
279
- } else if (provider.category === "SAML") {
280
- return (
281
- <a
282
- key={provider.displayName}
283
- onClick={() => goToSamlUrl(provider, location)}
284
- style={customAStyle}
285
- >
286
- <div style={customButtonStyle}>
287
- <img
288
- width={26}
289
- src={getProviderLogoURL(provider)}
290
- alt={provider.displayName}
291
- className="provider-img"
292
- style={customImgStyle}
293
- />
294
- <span style={customSpanStyle}>{text}</span>
295
- </div>
296
- </a>
297
- );
298
- }
299
- } else {
300
- // big button, for disable password signin
301
- if (provider.category === "SAML") {
302
- return (
303
- <div key={provider.displayName} className="provider-big-img">
304
- <a onClick={() => goToSamlUrl(provider, location)}>
305
- {getSigninButton(provider)}
306
- </a>
307
- </div>
308
- );
309
- } else if (provider.category === "Web3") {
310
- return (
311
- <div key={provider.displayName} className="provider-big-img">
312
- <a onClick={() => goToWeb3Url(application, provider, "signup")}>
313
- {getSigninButton(provider)}
314
- </a>
315
- </div>
316
- );
317
- } else {
318
- return (
319
- <div key={provider.displayName} className="provider-big-img">
320
- <a href={Provider.getAuthUrl(application, provider, "signup")}>
321
- {getSigninButton(provider)}
322
- </a>
323
- </div>
324
- );
325
- }
326
- }
327
- }
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 i18next from "i18next";
17
+ import * as Provider from "./Provider";
18
+ import { getProviderLogoURL } from "../forms/util/core";
19
+ import {
20
+ GithubLoginButton,
21
+ GoogleLoginButton,
22
+ } from "react-social-login-buttons";
23
+ import QqLoginButton from "./QqLoginButton";
24
+ import FacebookLoginButton from "./FacebookLoginButton";
25
+ import WeiboLoginButton from "./WeiboLoginButton";
26
+ import GiteeLoginButton from "./GiteeLoginButton";
27
+ import WechatLoginButton from "./WechatLoginButton";
28
+ import DingTalkLoginButton from "./DingTalkLoginButton";
29
+ import LinkedInLoginButton from "./LinkedInLoginButton";
30
+ import WeComLoginButton from "./WeComLoginButton";
31
+ import LarkLoginButton from "./LarkLoginButton";
32
+ import GitLabLoginButton from "./GitLabLoginButton";
33
+ import AdfsLoginButton from "./AdfsLoginButton";
34
+ import CasdoorLoginButton from "./CasdoorLoginButton";
35
+ import BaiduLoginButton from "./BaiduLoginButton";
36
+ import AlipayLoginButton from "./AlipayLoginButton";
37
+ import InfoflowLoginButton from "./InfoflowLoginButton";
38
+ import AppleLoginButton from "./AppleLoginButton";
39
+ import AzureADLoginButton from "./AzureADLoginButton";
40
+ import AzureADB2CLoginButton from "./AzureADB2CLoginButton";
41
+ import SlackLoginButton from "./SlackLoginButton";
42
+ import SteamLoginButton from "./SteamLoginButton";
43
+ import BilibiliLoginButton from "./BilibiliLoginButton";
44
+ import OktaLoginButton from "./OktaLoginButton";
45
+ import DouyinLoginButton from "./DouyinLoginButton";
46
+ import LoginButton from "./LoginButton";
47
+ import * as AuthBackend from "../forms/util/auth-api";
48
+ import { WechatOfficialAccountModal } from "../forms/util/auth-util";
49
+
50
+ function getSigninButton(provider) {
51
+ const text = i18next
52
+ .t("login:Sign in with {type}")
53
+ .replace(
54
+ "{type}",
55
+ provider.displayName !== "" ? provider.displayName : provider.type
56
+ );
57
+ if (provider.type === "GitHub") {
58
+ return <GithubLoginButton text={text} align={"center"} />;
59
+ } else if (provider.type === "Google") {
60
+ return <GoogleLoginButton text={text} align={"center"} />;
61
+ } else if (provider.type === "QQ") {
62
+ return <QqLoginButton text={text} align={"center"} />;
63
+ } else if (provider.type === "Facebook") {
64
+ return <FacebookLoginButton text={text} align={"center"} />;
65
+ } else if (provider.type === "Weibo") {
66
+ return <WeiboLoginButton text={text} align={"center"} />;
67
+ } else if (provider.type === "Gitee") {
68
+ return <GiteeLoginButton text={text} align={"center"} />;
69
+ } else if (provider.type === "WeChat") {
70
+ return <WechatLoginButton text={text} align={"center"} />;
71
+ } else if (provider.type === "DingTalk") {
72
+ return <DingTalkLoginButton text={text} align={"center"} />;
73
+ } else if (provider.type === "LinkedIn") {
74
+ return <LinkedInLoginButton text={text} align={"center"} />;
75
+ } else if (provider.type === "WeCom") {
76
+ return <WeComLoginButton text={text} align={"center"} />;
77
+ } else if (provider.type === "Lark") {
78
+ return <LarkLoginButton text={text} align={"center"} />;
79
+ } else if (provider.type === "GitLab") {
80
+ return <GitLabLoginButton text={text} align={"center"} />;
81
+ } else if (provider.type === "ADFS") {
82
+ return <AdfsLoginButton text={text} align={"center"} />;
83
+ } else if (provider.type === "Casdoor") {
84
+ return <CasdoorLoginButton text={text} align={"center"} />;
85
+ } else if (provider.type === "Baidu") {
86
+ return <BaiduLoginButton text={text} align={"center"} />;
87
+ } else if (provider.type === "Alipay") {
88
+ return <AlipayLoginButton text={text} align={"center"} />;
89
+ } else if (provider.type === "Infoflow") {
90
+ return <InfoflowLoginButton text={text} align={"center"} />;
91
+ } else if (provider.type === "Apple") {
92
+ return <AppleLoginButton text={text} align={"center"} />;
93
+ } else if (provider.type === "AzureAD") {
94
+ return <AzureADLoginButton text={text} align={"center"} />;
95
+ } else if (provider.type === "AzureADB2C") {
96
+ return <AzureADB2CLoginButton text={text} align={"center"} />;
97
+ } else if (provider.type === "Slack") {
98
+ return <SlackLoginButton text={text} align={"center"} />;
99
+ } else if (provider.type === "Steam") {
100
+ return <SteamLoginButton text={text} align={"center"} />;
101
+ } else if (provider.type === "Bilibili") {
102
+ return <BilibiliLoginButton text={text} align={"center"} />;
103
+ } else if (provider.type === "Okta") {
104
+ return <OktaLoginButton text={text} align={"center"} />;
105
+ } else if (provider.type === "Douyin") {
106
+ return <DouyinLoginButton text={text} align={"center"} />;
107
+ } else {
108
+ return (
109
+ <LoginButton
110
+ key={provider.type}
111
+ type={provider.type}
112
+ logoUrl={getProviderLogoURL(provider)}
113
+ />
114
+ );
115
+ }
116
+ }
117
+
118
+ function goToSamlUrl(provider, location) {
119
+ const params = new URLSearchParams(location.search);
120
+ const clientId = params.get("client_id") ?? "";
121
+ const state = params.get("state");
122
+ const realRedirectUri = params.get("redirect_uri");
123
+ const redirectUri = `${window.location.origin}/callback/saml`;
124
+ const providerName = provider.name;
125
+
126
+ const relayState = `${clientId}&${state}&${providerName}&${realRedirectUri}&${redirectUri}`;
127
+ AuthBackend.getSamlLogin(
128
+ `${provider.owner}/${providerName}`,
129
+ btoa(relayState)
130
+ ).then((res) => {
131
+ if (res.data2 === "POST") {
132
+ document.write(res.data);
133
+ } else {
134
+ window.location.href = res.data;
135
+ }
136
+ });
137
+ }
138
+
139
+ export function goToWeb3Url(application, provider, method) {
140
+ if (provider.type === "MetaMask") {
141
+ import("./Web3Auth").then((module) => {
142
+ const authViaMetaMask = module.authViaMetaMask;
143
+ authViaMetaMask(application, provider, method);
144
+ });
145
+ } else if (provider.type === "Web3Onboard") {
146
+ import("./Web3Auth").then((module) => {
147
+ const authViaWeb3Onboard = module.authViaWeb3Onboard;
148
+ authViaWeb3Onboard(application, provider, method);
149
+ });
150
+ }
151
+ }
152
+
153
+ export function renderProviderLogo(
154
+ provider,
155
+ application,
156
+ width,
157
+ margin,
158
+ size,
159
+ location
160
+ ) {
161
+ if (size === "small") {
162
+ if (provider.category === "OAuth") {
163
+ if (
164
+ provider.type === "WeChat" &&
165
+ provider.clientId2 !== "" &&
166
+ provider.clientSecret2 !== "" &&
167
+ provider.disableSsl === true &&
168
+ !navigator.userAgent.includes("MicroMessenger")
169
+ ) {
170
+ return (
171
+ <a key={provider.displayName}>
172
+ <img
173
+ width={width}
174
+ height={width}
175
+ src={getProviderLogoURL(provider)}
176
+ alt={provider.displayName}
177
+ className="provider-img"
178
+ style={{ margin: margin }}
179
+ onClick={() => {
180
+ WechatOfficialAccountModal(application, provider, "signup");
181
+ }}
182
+ />
183
+ </a>
184
+ );
185
+ } else {
186
+ return (
187
+ <a
188
+ key={provider.displayName}
189
+ href={Provider.getAuthUrl(application, provider, "signup")}
190
+ >
191
+ <img
192
+ width={width}
193
+ height={width}
194
+ src={getProviderLogoURL(provider)}
195
+ alt={provider.displayName}
196
+ className="provider-img"
197
+ style={{ margin: margin }}
198
+ />
199
+ </a>
200
+ );
201
+ }
202
+ } else if (provider.category === "SAML") {
203
+ return (
204
+ <a
205
+ key={provider.displayName}
206
+ onClick={() => goToSamlUrl(provider, location)}
207
+ >
208
+ <img
209
+ width={width}
210
+ height={width}
211
+ src={getProviderLogoURL(provider)}
212
+ alt={provider.displayName}
213
+ className="provider-img"
214
+ style={{ margin: margin }}
215
+ />
216
+ </a>
217
+ );
218
+ } else if (provider.category === "Web3") {
219
+ return (
220
+ <a
221
+ key={provider.displayName}
222
+ onClick={() => goToWeb3Url(application, provider, "signup")}
223
+ >
224
+ <img
225
+ width={width}
226
+ height={width}
227
+ src={getProviderLogoURL(provider)}
228
+ alt={provider.displayName}
229
+ className="provider-img"
230
+ style={{ margin: margin }}
231
+ />
232
+ </a>
233
+ );
234
+ }
235
+ } else if (provider.type === "Custom") {
236
+ // style definition
237
+ const text = i18next
238
+ .t("login:Sign in with {type}")
239
+ .replace("{type}", provider.displayName);
240
+ const customAStyle = { display: "block", height: "55px", color: "#000" };
241
+ const customButtonStyle = {
242
+ display: "flex",
243
+ alignItems: "center",
244
+ width: "calc(100% - 10px)",
245
+ height: "50px",
246
+ margin: "5px",
247
+ padding: "0 10px",
248
+ backgroundColor: "transparent",
249
+ boxShadow: "0px 1px 3px rgba(0,0,0,0.5)",
250
+ border: "0px",
251
+ borderRadius: "3px",
252
+ cursor: "pointer",
253
+ };
254
+ const customImgStyle = { justfyContent: "space-between" };
255
+ const customSpanStyle = {
256
+ textAlign: "center",
257
+ width: "100%",
258
+ fontSize: "19px",
259
+ };
260
+ if (provider.category === "OAuth") {
261
+ return (
262
+ <a
263
+ key={provider.displayName}
264
+ href={Provider.getAuthUrl(application, provider, "signup")}
265
+ style={customAStyle}
266
+ >
267
+ <div style={customButtonStyle}>
268
+ <img
269
+ width={26}
270
+ src={getProviderLogoURL(provider)}
271
+ alt={provider.displayName}
272
+ className="provider-img"
273
+ style={customImgStyle}
274
+ />
275
+ <span style={customSpanStyle}>{text}</span>
276
+ </div>
277
+ </a>
278
+ );
279
+ } else if (provider.category === "SAML") {
280
+ return (
281
+ <a
282
+ key={provider.displayName}
283
+ onClick={() => goToSamlUrl(provider, location)}
284
+ style={customAStyle}
285
+ >
286
+ <div style={customButtonStyle}>
287
+ <img
288
+ width={26}
289
+ src={getProviderLogoURL(provider)}
290
+ alt={provider.displayName}
291
+ className="provider-img"
292
+ style={customImgStyle}
293
+ />
294
+ <span style={customSpanStyle}>{text}</span>
295
+ </div>
296
+ </a>
297
+ );
298
+ }
299
+ } else {
300
+ // big button, for disable password signin
301
+ if (provider.category === "SAML") {
302
+ return (
303
+ <div key={provider.displayName} className="provider-big-img">
304
+ <a onClick={() => goToSamlUrl(provider, location)}>
305
+ {getSigninButton(provider)}
306
+ </a>
307
+ </div>
308
+ );
309
+ } else if (provider.category === "Web3") {
310
+ return (
311
+ <div key={provider.displayName} className="provider-big-img">
312
+ <a onClick={() => goToWeb3Url(application, provider, "signup")}>
313
+ {getSigninButton(provider)}
314
+ </a>
315
+ </div>
316
+ );
317
+ } else {
318
+ return (
319
+ <div key={provider.displayName} className="provider-big-img">
320
+ <a href={Provider.getAuthUrl(application, provider, "signup")}>
321
+ {getSigninButton(provider)}
322
+ </a>
323
+ </div>
324
+ );
325
+ }
326
+ }
327
+ }