@authing/react-ui-components 2.4.53 → 2.4.55-alpha.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/build/asset-manifest.json +25 -0
- package/build/index.html +1 -0
- package/build/static/css/2.19155096.chunk.css +2 -0
- package/build/static/css/2.19155096.chunk.css.map +1 -0
- package/build/static/css/main.4dd73333.chunk.css +2 -0
- package/build/static/css/main.4dd73333.chunk.css.map +1 -0
- package/build/static/js/2.06cb6b53.chunk.js +3 -0
- package/build/static/js/2.06cb6b53.chunk.js.LICENSE.txt +70 -0
- package/build/static/js/2.06cb6b53.chunk.js.map +1 -0
- package/build/static/js/3.584da164.chunk.js +2 -0
- package/build/static/js/3.584da164.chunk.js.map +1 -0
- package/build/static/js/main.1de9a856.chunk.js +2 -0
- package/build/static/js/main.1de9a856.chunk.js.map +1 -0
- package/build/static/js/runtime-main.6174f3e9.js +2 -0
- package/build/static/js/runtime-main.6174f3e9.js.map +1 -0
- package/lib/index.d.ts +8 -0
- package/lib/index.min.css +1 -1
- package/lib/index.min.js +1 -1
- package/lib/index.min.js.LICENSE.txt +9 -0
- package/package.json +3 -4
- package/src/components/AuthingGuard/Forms/QrCodeLoginForm/index.tsx +3 -1
- package/src/components/AuthingGuard/GuardLayout/index.tsx +9 -0
- package/src/components/AuthingGuard/Header/index.tsx +5 -2
- package/src/components/AuthingGuard/Header/style.less +23 -11
- package/src/components/AuthingGuard/LoginLayout/index.tsx +53 -22
- package/src/components/AuthingGuard/api/appConfig.ts +2 -0
- package/src/components/AuthingGuard/api/http.ts +32 -9
- package/src/components/AuthingGuard/constants.ts +2 -0
- package/src/components/AuthingGuard/index.tsx +8 -0
- package/src/components/AuthingGuard/types/Forms.ts +1 -0
- package/src/components/AuthingGuard/types/GuardConfig.ts +2 -0
- package/src/index.tsx +8 -18
|
@@ -4,6 +4,15 @@
|
|
|
4
4
|
http://jedwatson.github.io/classnames
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
+
/**
|
|
8
|
+
* @license
|
|
9
|
+
* Lodash <https://lodash.com/>
|
|
10
|
+
* Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
|
|
11
|
+
* Released under MIT license <https://lodash.com/license>
|
|
12
|
+
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
|
13
|
+
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
|
14
|
+
*/
|
|
15
|
+
|
|
7
16
|
/** @license React v16.13.1
|
|
8
17
|
* react-is.production.min.js
|
|
9
18
|
*
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@authing/react-ui-components",
|
|
3
|
-
"version": "2.4.
|
|
3
|
+
"version": "2.4.55-alpha.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"main": "lib/index.min.js",
|
|
6
6
|
"typings": "lib/index.d.ts",
|
|
7
7
|
"dependencies": {
|
|
8
8
|
"antd": "^4.8.0",
|
|
9
|
-
"authing-js-sdk": "4.22.
|
|
9
|
+
"authing-js-sdk": "4.22.26-alpha.5",
|
|
10
10
|
"qs": "^6.9.4"
|
|
11
11
|
},
|
|
12
12
|
"peerDependencies": {
|
|
@@ -184,6 +184,5 @@
|
|
|
184
184
|
"webpack-dev-server": "3.11.0",
|
|
185
185
|
"webpack-manifest-plugin": "2.2.0",
|
|
186
186
|
"workbox-webpack-plugin": "5.1.4"
|
|
187
|
-
}
|
|
188
|
-
"gitHead": "9162c7339ae6fdb5189aa14146ec18550f8b37bd"
|
|
187
|
+
}
|
|
189
188
|
}
|
|
@@ -14,6 +14,7 @@ export const QrCodeLoginForm: FC<QrLoginFormProps> = ({
|
|
|
14
14
|
onFail,
|
|
15
15
|
onSuccess,
|
|
16
16
|
type,
|
|
17
|
+
idpId,
|
|
17
18
|
}) => {
|
|
18
19
|
const {
|
|
19
20
|
state: { authClient, config },
|
|
@@ -31,6 +32,7 @@ export const QrCodeLoginForm: FC<QrLoginFormProps> = ({
|
|
|
31
32
|
|
|
32
33
|
useEffect(() => {
|
|
33
34
|
client.startScanning('authingGuardQrcode', {
|
|
35
|
+
extIdpConnId: idpId,
|
|
34
36
|
autoExchangeUserInfo: true,
|
|
35
37
|
...config.qrCodeScanOptions,
|
|
36
38
|
onStart(timer) {
|
|
@@ -46,7 +48,7 @@ export const QrCodeLoginForm: FC<QrLoginFormProps> = ({
|
|
|
46
48
|
},
|
|
47
49
|
})
|
|
48
50
|
return () => clearInterval(timerRef.current)
|
|
49
|
-
}, [client, config.qrCodeScanOptions, onFail, onSuccess])
|
|
51
|
+
}, [client, config.qrCodeScanOptions, idpId, onFail, onSuccess])
|
|
50
52
|
|
|
51
53
|
return (
|
|
52
54
|
<div className="authing-guard-qr-form">
|
|
@@ -165,9 +165,12 @@ const useGuardConfig = () => {
|
|
|
165
165
|
// 默认登录方式
|
|
166
166
|
const defaultLoginMethod =
|
|
167
167
|
userConfig.defaultLoginMethod ||
|
|
168
|
+
appConfig.loginTabs?.defaultV2 ||
|
|
168
169
|
appConfig.loginTabs?.default ||
|
|
169
170
|
defaultGuardConfig.defaultLoginMethod
|
|
170
171
|
|
|
172
|
+
const loginMethodTitleMapping = appConfig.loginTabs?.title
|
|
173
|
+
|
|
171
174
|
// 注册方式
|
|
172
175
|
const registerMethods =
|
|
173
176
|
userConfig.registerMethods ||
|
|
@@ -184,6 +187,8 @@ const useGuardConfig = () => {
|
|
|
184
187
|
? ''
|
|
185
188
|
: userConfig.title ?? appConfig.name ?? defaultGuardConfig.title
|
|
186
189
|
|
|
190
|
+
const description = loading ? '' : appConfig.description ?? ''
|
|
191
|
+
|
|
187
192
|
// 应用 logo
|
|
188
193
|
const logo = loading
|
|
189
194
|
? ''
|
|
@@ -218,6 +223,7 @@ const useGuardConfig = () => {
|
|
|
218
223
|
{
|
|
219
224
|
logo,
|
|
220
225
|
title,
|
|
226
|
+
description,
|
|
221
227
|
autoRegister,
|
|
222
228
|
loginMethods,
|
|
223
229
|
passwordLoginMethods,
|
|
@@ -232,16 +238,19 @@ const useGuardConfig = () => {
|
|
|
232
238
|
publicKey: appConfig.publicKey,
|
|
233
239
|
agreementEnabled: appConfig.agreementEnabled,
|
|
234
240
|
agreements: appConfig.agreements,
|
|
241
|
+
loginMethodTitleMapping: loginMethodTitleMapping,
|
|
235
242
|
}
|
|
236
243
|
)
|
|
237
244
|
}, [
|
|
238
245
|
userConfig,
|
|
239
246
|
appConfig.loginTabs?.list,
|
|
240
247
|
appConfig.loginTabs?.default,
|
|
248
|
+
appConfig.loginTabs?.title,
|
|
241
249
|
appConfig.passwordTabConfig?.enabledLoginMethods,
|
|
242
250
|
appConfig.registerTabs?.list,
|
|
243
251
|
appConfig.registerTabs?.default,
|
|
244
252
|
appConfig.name,
|
|
253
|
+
appConfig.description,
|
|
245
254
|
appConfig.logo,
|
|
246
255
|
appConfig.ssoPageComponentDisplay?.autoRegisterThenLoginHintInfo,
|
|
247
256
|
appConfig.ssoPageComponentDisplay?.registerBtn,
|
|
@@ -10,7 +10,7 @@ export interface HeaderProps extends React.HTMLAttributes<HTMLDivElement> {}
|
|
|
10
10
|
export const GuardHeader: FC<HeaderProps> = (props) => {
|
|
11
11
|
const {
|
|
12
12
|
state: {
|
|
13
|
-
config: { logo, title },
|
|
13
|
+
config: { logo, title, description },
|
|
14
14
|
},
|
|
15
15
|
} = useGuardContext()
|
|
16
16
|
|
|
@@ -19,7 +19,10 @@ export const GuardHeader: FC<HeaderProps> = (props) => {
|
|
|
19
19
|
{Boolean(logo) && (
|
|
20
20
|
<Avatar className="authing-guard-logo" src={logo} size={50}></Avatar>
|
|
21
21
|
)}
|
|
22
|
-
<div className="authing-guard-title">
|
|
22
|
+
<div className="authing-guard-title-container">
|
|
23
|
+
<div className="authing-guard-title">{title}</div>
|
|
24
|
+
<div className="authing-guard-description">{description}</div>
|
|
25
|
+
</div>
|
|
23
26
|
</div>
|
|
24
27
|
)
|
|
25
28
|
}
|
|
@@ -13,23 +13,26 @@
|
|
|
13
13
|
object-fit: contain;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
+
.authing-guard-title-container {
|
|
17
|
+
display: flex;
|
|
18
|
+
justify-content: center;
|
|
19
|
+
flex-direction: column;
|
|
20
|
+
align-items: center;
|
|
21
|
+
}
|
|
22
|
+
|
|
16
23
|
.authing-guard-title {
|
|
17
|
-
color: #
|
|
24
|
+
color: #282d3c;
|
|
18
25
|
font-size: 24px;
|
|
19
|
-
margin-bottom:
|
|
26
|
+
margin-bottom: 4px;
|
|
20
27
|
width: 100%;
|
|
21
28
|
word-break: break-all;
|
|
22
29
|
text-align: center;
|
|
23
30
|
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
// .large .title {
|
|
30
|
-
// color: #333333;
|
|
31
|
-
// font-size: 32px;
|
|
32
|
-
// }
|
|
31
|
+
.authing-guard-description {
|
|
32
|
+
font-size: 16px;
|
|
33
|
+
color: #878a95;
|
|
34
|
+
margin-bottom: 23px;
|
|
35
|
+
}
|
|
33
36
|
|
|
34
37
|
@media only screen and (max-width: 719px) {
|
|
35
38
|
.authing-guard-header {
|
|
@@ -45,8 +48,17 @@
|
|
|
45
48
|
padding-left: 8px;
|
|
46
49
|
color: #333333;
|
|
47
50
|
font-weight: 500;
|
|
51
|
+
text-align: unset;
|
|
48
52
|
}
|
|
49
53
|
.authing-guard-logo {
|
|
50
54
|
margin: 0;
|
|
51
55
|
}
|
|
56
|
+
.authing-guard-title-container {
|
|
57
|
+
flex-direction: column;
|
|
58
|
+
align-items: flex-start;
|
|
59
|
+
}
|
|
60
|
+
.authing-guard-description {
|
|
61
|
+
margin-bottom: 0px;
|
|
62
|
+
padding-left: 8px;
|
|
63
|
+
}
|
|
52
64
|
}
|
|
@@ -75,36 +75,36 @@ const useNormalLoginTabs = ({ onSuccess, onFail }: BaseFormProps) => {
|
|
|
75
75
|
}
|
|
76
76
|
|
|
77
77
|
const LOGIN_FORM_MAP = {
|
|
78
|
-
[LoginMethods.Password]: (
|
|
78
|
+
[LoginMethods.Password]: (props: any) => (
|
|
79
79
|
<PasswordLoginForm
|
|
80
|
-
{...
|
|
80
|
+
{...props}
|
|
81
81
|
ref={(v) => (formRef.current[LoginMethods.Password] = v!)}
|
|
82
82
|
/>
|
|
83
83
|
),
|
|
84
|
-
[LoginMethods.PhoneCode]: (
|
|
84
|
+
[LoginMethods.PhoneCode]: (props: any) => (
|
|
85
85
|
<PhoneCodeLoginForm
|
|
86
|
-
{...
|
|
86
|
+
{...props}
|
|
87
87
|
ref={(v) => (formRef.current[LoginMethods.PhoneCode] = v!)}
|
|
88
88
|
/>
|
|
89
89
|
),
|
|
90
|
-
[LoginMethods.AppQr]: (
|
|
91
|
-
<QrCodeLoginForm type={LoginMethods.AppQr} {...
|
|
90
|
+
[LoginMethods.AppQr]: (props: any) => (
|
|
91
|
+
<QrCodeLoginForm type={LoginMethods.AppQr} {...props} />
|
|
92
92
|
),
|
|
93
|
-
[LoginMethods.WxMinQr]: (
|
|
94
|
-
<QrCodeLoginForm type={LoginMethods.WxMinQr} {...
|
|
93
|
+
[LoginMethods.WxMinQr]: (props: any) => (
|
|
94
|
+
<QrCodeLoginForm type={LoginMethods.WxMinQr} {...props} />
|
|
95
95
|
),
|
|
96
|
-
[LoginMethods.LDAP]: (
|
|
96
|
+
[LoginMethods.LDAP]: (props: any) => (
|
|
97
97
|
<LdapLoginForm
|
|
98
|
-
{...
|
|
98
|
+
{...props}
|
|
99
99
|
ref={(v) => (formRef.current[LoginMethods.LDAP] = v!)}
|
|
100
100
|
/>
|
|
101
101
|
),
|
|
102
|
-
[LoginMethods.WechatMpQrcode]: (
|
|
103
|
-
<QrCodeLoginForm type={LoginMethods.WechatMpQrcode} {...
|
|
102
|
+
[LoginMethods.WechatMpQrcode]: (props: any) => (
|
|
103
|
+
<QrCodeLoginForm type={LoginMethods.WechatMpQrcode} {...props} />
|
|
104
104
|
),
|
|
105
|
-
[LoginMethods.AD]: (
|
|
105
|
+
[LoginMethods.AD]: (props: any) => (
|
|
106
106
|
<ADLoginForm
|
|
107
|
-
{...
|
|
107
|
+
{...props}
|
|
108
108
|
ref={(v) => (formRef.current[LoginMethods.AD] = v!)}
|
|
109
109
|
/>
|
|
110
110
|
),
|
|
@@ -113,13 +113,38 @@ const useNormalLoginTabs = ({ onSuccess, onFail }: BaseFormProps) => {
|
|
|
113
113
|
const {
|
|
114
114
|
state: { config },
|
|
115
115
|
} = useGuardContext()
|
|
116
|
-
const { loginMethods = [] } = config
|
|
117
|
-
|
|
118
|
-
const tabs = loginMethods
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
116
|
+
const { loginMethods = [], loginMethodTitleMapping } = config
|
|
117
|
+
|
|
118
|
+
const tabs = loginMethods
|
|
119
|
+
.map((tab) => {
|
|
120
|
+
if (
|
|
121
|
+
!loginMethods.every(
|
|
122
|
+
(item) => !(item.split(':').length > 1 && item.split(':')[0] === tab)
|
|
123
|
+
)
|
|
124
|
+
)
|
|
125
|
+
return undefined
|
|
126
|
+
|
|
127
|
+
const idpId = tab.split(':').length > 1 ? tab.split(':')[1] : undefined
|
|
128
|
+
|
|
129
|
+
if (idpId) {
|
|
130
|
+
const type = tab.split(':')[0] as LoginMethods
|
|
131
|
+
return {
|
|
132
|
+
key: tab,
|
|
133
|
+
label: loginMethodTitleMapping[tab]!,
|
|
134
|
+
component: LOGIN_FORM_MAP[type]({
|
|
135
|
+
...formProps,
|
|
136
|
+
idpId: idpId,
|
|
137
|
+
}),
|
|
138
|
+
}
|
|
139
|
+
} else {
|
|
140
|
+
return {
|
|
141
|
+
key: tab,
|
|
142
|
+
label: LOGIN_METHODS_MAP()?.[tab]!,
|
|
143
|
+
component: LOGIN_FORM_MAP[tab](formProps),
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
})
|
|
147
|
+
.filter((i) => i !== undefined)
|
|
123
148
|
|
|
124
149
|
return {
|
|
125
150
|
tabs,
|
|
@@ -143,7 +168,13 @@ export const LoginLayout = () => {
|
|
|
143
168
|
return (
|
|
144
169
|
<>
|
|
145
170
|
<AuthingTabs
|
|
146
|
-
tabs={
|
|
171
|
+
tabs={
|
|
172
|
+
tabs as {
|
|
173
|
+
key: LoginMethods
|
|
174
|
+
label: string
|
|
175
|
+
component: JSX.Element
|
|
176
|
+
}[]
|
|
177
|
+
}
|
|
147
178
|
onTabClick={(t) =>
|
|
148
179
|
setValue('activeTabs', {
|
|
149
180
|
...activeTabs,
|
|
@@ -75,6 +75,7 @@ export interface ApplicationConfig {
|
|
|
75
75
|
css: string
|
|
76
76
|
name: string
|
|
77
77
|
logo: string
|
|
78
|
+
description?: string
|
|
78
79
|
redirectUris: string[]
|
|
79
80
|
registerDisabled: boolean
|
|
80
81
|
registerTabs: {
|
|
@@ -85,6 +86,7 @@ export interface ApplicationConfig {
|
|
|
85
86
|
loginTabs: {
|
|
86
87
|
list: string[]
|
|
87
88
|
default: string
|
|
89
|
+
defaultV2?: string
|
|
88
90
|
title: { [x: string]: string }
|
|
89
91
|
}
|
|
90
92
|
socialConnections: SocialConnectionItem[]
|
|
@@ -17,6 +17,15 @@ requestClient.get = async <T>(
|
|
|
17
17
|
query: Record<string, any> = {},
|
|
18
18
|
init?: RequestInit
|
|
19
19
|
): Promise<AuthingResponse<T>> => {
|
|
20
|
+
const headers: Record<string, any> = {
|
|
21
|
+
...init?.headers,
|
|
22
|
+
'Content-Type': 'application/json',
|
|
23
|
+
[requestClient.langHeader]: i18n.language,
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
if (requestClient.tenantId !== '')
|
|
27
|
+
headers[requestClient.tenantHeader] = requestClient.tenantId
|
|
28
|
+
|
|
20
29
|
const res = await fetch(
|
|
21
30
|
`${requestClient.baseUrl}${path}${qs.stringify(query, {
|
|
22
31
|
addQueryPrefix: true,
|
|
@@ -24,10 +33,7 @@ requestClient.get = async <T>(
|
|
|
24
33
|
{
|
|
25
34
|
...init,
|
|
26
35
|
credentials: 'include',
|
|
27
|
-
headers
|
|
28
|
-
...init?.headers,
|
|
29
|
-
[requestClient.langHeader]: i18n.language,
|
|
30
|
-
},
|
|
36
|
+
headers,
|
|
31
37
|
}
|
|
32
38
|
)
|
|
33
39
|
|
|
@@ -41,15 +47,20 @@ requestClient.post = async <T>(
|
|
|
41
47
|
headers: any
|
|
42
48
|
}
|
|
43
49
|
): Promise<AuthingResponse<T>> => {
|
|
50
|
+
const headers: Record<string, any> = {
|
|
51
|
+
...config?.headers,
|
|
52
|
+
'Content-Type': 'application/json',
|
|
53
|
+
[requestClient.langHeader]: i18n.language,
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
if (requestClient.tenantId !== '')
|
|
57
|
+
headers[requestClient.tenantHeader] = requestClient.tenantId
|
|
58
|
+
|
|
44
59
|
const res = await fetch(`${requestClient.baseUrl}${path}`, {
|
|
45
60
|
method: 'POST',
|
|
46
61
|
body: JSON.stringify(data),
|
|
47
62
|
credentials: 'include',
|
|
48
|
-
headers:
|
|
49
|
-
...config?.headers,
|
|
50
|
-
'Content-Type': 'application/json',
|
|
51
|
-
[requestClient.langHeader]: i18n.language,
|
|
52
|
-
},
|
|
63
|
+
headers: headers,
|
|
53
64
|
})
|
|
54
65
|
return res.json()
|
|
55
66
|
}
|
|
@@ -59,7 +70,19 @@ requestClient.setBaseUrl = (base: string) => {
|
|
|
59
70
|
requestClient.baseUrl = base.replace(/\/$/, '')
|
|
60
71
|
}
|
|
61
72
|
const DEFAULT_LANG_HEADER = 'x-authing-lang'
|
|
73
|
+
const DEFAULT_TENANT_HEADER = 'x-authing-app-tenant-idåå'
|
|
62
74
|
requestClient.langHeader = DEFAULT_LANG_HEADER
|
|
75
|
+
requestClient.tenantHeader = DEFAULT_TENANT_HEADER
|
|
76
|
+
requestClient.tenantId = ''
|
|
77
|
+
|
|
63
78
|
requestClient.setLangHeader = (key: string | undefined) => {
|
|
64
79
|
requestClient.langHeader = key || DEFAULT_LANG_HEADER
|
|
65
80
|
}
|
|
81
|
+
|
|
82
|
+
requestClient.setTenantHeader = (key: string | undefined) => {
|
|
83
|
+
requestClient.tenantHeader = key || DEFAULT_LANG_HEADER
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
requestClient.setTenantId = (tenantId: string) => {
|
|
87
|
+
requestClient.tenantId = tenantId
|
|
88
|
+
}
|
|
@@ -95,10 +95,12 @@ export const defaultHeaders: {
|
|
|
95
95
|
'app-id': string
|
|
96
96
|
'sdk-version': string
|
|
97
97
|
'request-from': string
|
|
98
|
+
'tenant-id': string
|
|
98
99
|
lang: string
|
|
99
100
|
} = {
|
|
100
101
|
'userpool-id': 'x-authing-userpool-id',
|
|
101
102
|
'app-id': 'x-authing-app-id',
|
|
103
|
+
'tenant-id': 'x-authing-app-tenant-id',
|
|
102
104
|
'request-from': 'x-authing-request-from',
|
|
103
105
|
'sdk-version': 'x-authing-sdk-version',
|
|
104
106
|
lang: 'x-authing-lang',
|
|
@@ -28,6 +28,7 @@ message.config({
|
|
|
28
28
|
|
|
29
29
|
interface AuthingGuardProps extends GuardEventsHandler {
|
|
30
30
|
appId: string
|
|
31
|
+
tenantId?: string
|
|
31
32
|
config?: UserConfig
|
|
32
33
|
visible?: boolean
|
|
33
34
|
className?: string
|
|
@@ -36,6 +37,7 @@ interface AuthingGuardProps extends GuardEventsHandler {
|
|
|
36
37
|
|
|
37
38
|
export const AuthingGuard: FC<AuthingGuardProps> = ({
|
|
38
39
|
appId,
|
|
40
|
+
tenantId,
|
|
39
41
|
config = {},
|
|
40
42
|
visible,
|
|
41
43
|
className,
|
|
@@ -71,9 +73,15 @@ export const AuthingGuard: FC<AuthingGuardProps> = ({
|
|
|
71
73
|
requestClient.setBaseUrl(realHost)
|
|
72
74
|
requestClient.setLangHeader(headers?.lang)
|
|
73
75
|
|
|
76
|
+
if (tenantId) {
|
|
77
|
+
requestClient.setTenantHeader(headers?.['tenant-id'])
|
|
78
|
+
requestClient.setTenantId(tenantId)
|
|
79
|
+
}
|
|
80
|
+
|
|
74
81
|
const authClient = new AuthenticationClient({
|
|
75
82
|
appHost: realHost!,
|
|
76
83
|
appId,
|
|
84
|
+
tenantId,
|
|
77
85
|
requestFrom: 'ui-components',
|
|
78
86
|
lang: localesConfig.defaultLang ?? lang,
|
|
79
87
|
headers,
|
|
@@ -27,6 +27,7 @@ export interface LdapLoginFormProps extends BaseFormProps {
|
|
|
27
27
|
|
|
28
28
|
export interface QrLoginFormProps extends BaseFormProps {
|
|
29
29
|
type: LoginMethods.AppQr | LoginMethods.WxMinQr | LoginMethods.WechatMpQrcode
|
|
30
|
+
idpId?: string
|
|
30
31
|
}
|
|
31
32
|
|
|
32
33
|
export interface EmailRegisterFormProps extends BaseFormProps {
|
|
@@ -353,6 +353,7 @@ export interface GuardEventsHandler {
|
|
|
353
353
|
export interface UserConfig {
|
|
354
354
|
logo?: string
|
|
355
355
|
title?: string
|
|
356
|
+
description?: string
|
|
356
357
|
zIndex?: number
|
|
357
358
|
isSSO?: boolean
|
|
358
359
|
mode?: GuardMode
|
|
@@ -411,6 +412,7 @@ export interface GuardConfig extends UserConfig {
|
|
|
411
412
|
publicKey: ApplicationConfig['publicKey']
|
|
412
413
|
agreementEnabled: boolean
|
|
413
414
|
agreements: Agreement[]
|
|
415
|
+
loginMethodTitleMapping: Record<string, string>
|
|
414
416
|
}
|
|
415
417
|
|
|
416
418
|
export interface LocalesConfig {
|
package/src/index.tsx
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Button } from 'antd'
|
|
2
2
|
import React, { useState } from 'react'
|
|
3
3
|
import ReactDOM from 'react-dom'
|
|
4
|
-
import {
|
|
4
|
+
import { Lang } from './components'
|
|
5
5
|
import { AuthingGuard } from './components/AuthingGuard'
|
|
6
6
|
|
|
7
7
|
import {
|
|
@@ -20,9 +20,8 @@ const App = () => {
|
|
|
20
20
|
const [title, setTitle] = useState('标题')
|
|
21
21
|
|
|
22
22
|
const config: UserConfig = {
|
|
23
|
-
title,
|
|
24
23
|
mode: GuardMode.Modal,
|
|
25
|
-
|
|
24
|
+
appHost: 'https://core.dev2.authing-inc.co',
|
|
26
25
|
// apiHost: 'http://console.authing.localhost:3000',
|
|
27
26
|
// apiHost: 'http://192.168.50.57:3000',
|
|
28
27
|
// loginMethods: Object.values(LoginMethods),
|
|
@@ -55,16 +54,6 @@ const App = () => {
|
|
|
55
54
|
// `,
|
|
56
55
|
// // autoRegister: true,
|
|
57
56
|
// socialConnections: [SocialConnections.AppleWeb],
|
|
58
|
-
passwordLoginMethods: ['username-password'],
|
|
59
|
-
localesConfig: {
|
|
60
|
-
defaultLang: 'en-US',
|
|
61
|
-
isShowChange: true,
|
|
62
|
-
onChange: (value) => {
|
|
63
|
-
console.log('...........')
|
|
64
|
-
console.log(value)
|
|
65
|
-
},
|
|
66
|
-
},
|
|
67
|
-
lang: lang,
|
|
68
57
|
}
|
|
69
58
|
|
|
70
59
|
const [visible, setVisible] = useState(false)
|
|
@@ -73,10 +62,10 @@ const App = () => {
|
|
|
73
62
|
// setTimeout(() => setVisible(true), 3000)
|
|
74
63
|
// }, [])
|
|
75
64
|
|
|
76
|
-
initAuthClient({
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
})
|
|
65
|
+
// initAuthClient({
|
|
66
|
+
// appId: '60c02a89a9e0431e271d9ff0',
|
|
67
|
+
// // appHost: 'http://console.authing.localhost:3000',
|
|
68
|
+
// })
|
|
80
69
|
|
|
81
70
|
return (
|
|
82
71
|
// eslint-disable-next-line react/jsx-no-undef
|
|
@@ -125,7 +114,8 @@ const App = () => {
|
|
|
125
114
|
}}
|
|
126
115
|
// onLoad={(a) => console.log(a, '加载完成')}
|
|
127
116
|
// onPwdResetError={(e) => console.log(e)}
|
|
128
|
-
appId="
|
|
117
|
+
appId="619c7976cd38c13a2222464f"
|
|
118
|
+
tenantId="619c864928b15c6421d12e35"
|
|
129
119
|
// appId="5fd877fb0ba0421962eced94"
|
|
130
120
|
config={config}
|
|
131
121
|
/>
|