@ttoss/react-auth 1.2.4 → 1.2.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.
- package/dist/esm/index.js +134 -0
- package/dist/index.js +134 -0
- package/package.json +10 -10
package/dist/esm/index.js
CHANGED
|
@@ -199,6 +199,140 @@ import { Form as Form2, FormFieldInput as FormFieldInput2, useForm as useForm2,
|
|
|
199
199
|
|
|
200
200
|
// ../cloud-auth/dist/esm/index.js
|
|
201
201
|
var PASSWORD_MINIMUM_LENGTH = 8;
|
|
202
|
+
var CognitoUserPoolLogicalId = "CognitoUserPool";
|
|
203
|
+
var CognitoUserPoolClientLogicalId = "CognitoUserPoolClient";
|
|
204
|
+
var CognitoIdentityPoolLogicalId = "CognitoIdentityPool";
|
|
205
|
+
var createAuthTemplate = ({
|
|
206
|
+
autoVerifiedAttributes = ["email"],
|
|
207
|
+
identityPool = true,
|
|
208
|
+
roles,
|
|
209
|
+
schema
|
|
210
|
+
} = {}) => {
|
|
211
|
+
const AutoVerifiedAttributes = Array.isArray(autoVerifiedAttributes) && autoVerifiedAttributes.length > 0 ? autoVerifiedAttributes : void 0;
|
|
212
|
+
const template = {
|
|
213
|
+
AWSTemplateFormatVersion: "2010-09-09",
|
|
214
|
+
Resources: {
|
|
215
|
+
[CognitoUserPoolLogicalId]: {
|
|
216
|
+
Type: "AWS::Cognito::UserPool",
|
|
217
|
+
Properties: {
|
|
218
|
+
AutoVerifiedAttributes,
|
|
219
|
+
Policies: {
|
|
220
|
+
PasswordPolicy: {
|
|
221
|
+
MinimumLength: PASSWORD_MINIMUM_LENGTH,
|
|
222
|
+
RequireLowercase: false,
|
|
223
|
+
RequireNumbers: false,
|
|
224
|
+
RequireSymbols: false,
|
|
225
|
+
RequireUppercase: false,
|
|
226
|
+
TemporaryPasswordValidityDays: 30
|
|
227
|
+
}
|
|
228
|
+
},
|
|
229
|
+
Schema: schema,
|
|
230
|
+
UsernameAttributes: ["email"],
|
|
231
|
+
UsernameConfiguration: {
|
|
232
|
+
CaseSensitive: false
|
|
233
|
+
},
|
|
234
|
+
UserPoolName: {
|
|
235
|
+
Ref: "AWS::StackName"
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
},
|
|
239
|
+
[CognitoUserPoolClientLogicalId]: {
|
|
240
|
+
Type: "AWS::Cognito::UserPoolClient",
|
|
241
|
+
Properties: {
|
|
242
|
+
SupportedIdentityProviders: ["COGNITO"],
|
|
243
|
+
UserPoolId: {
|
|
244
|
+
Ref: "CognitoUserPool"
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
},
|
|
249
|
+
Outputs: {
|
|
250
|
+
Region: {
|
|
251
|
+
Description: "You use this value on Amplify Auth `region`.",
|
|
252
|
+
Value: {
|
|
253
|
+
Ref: "AWS::Region"
|
|
254
|
+
},
|
|
255
|
+
Export: {
|
|
256
|
+
Name: {
|
|
257
|
+
"Fn::Join": [":", [{ Ref: "AWS::StackName" }, "Region"]]
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
},
|
|
261
|
+
UserPoolId: {
|
|
262
|
+
Description: "You use this value on Amplify Auth `userPoolId`.",
|
|
263
|
+
Value: {
|
|
264
|
+
Ref: CognitoUserPoolLogicalId
|
|
265
|
+
},
|
|
266
|
+
Export: {
|
|
267
|
+
Name: {
|
|
268
|
+
"Fn::Join": [":", [{ Ref: "AWS::StackName" }, "UserPoolId"]]
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
},
|
|
272
|
+
AppClientId: {
|
|
273
|
+
Description: "You use this value on Amplify Auth `userPoolWebClientId`.",
|
|
274
|
+
Value: {
|
|
275
|
+
Ref: CognitoUserPoolClientLogicalId
|
|
276
|
+
},
|
|
277
|
+
Export: {
|
|
278
|
+
Name: {
|
|
279
|
+
"Fn::Join": [":", [{ Ref: "AWS::StackName" }, "AppClientId"]]
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
};
|
|
285
|
+
if (identityPool) {
|
|
286
|
+
template.Resources[CognitoIdentityPoolLogicalId] = {
|
|
287
|
+
Type: "AWS::Cognito::IdentityPool",
|
|
288
|
+
Properties: {
|
|
289
|
+
AllowUnauthenticatedIdentities: true,
|
|
290
|
+
CognitoIdentityProviders: [
|
|
291
|
+
{
|
|
292
|
+
ClientId: {
|
|
293
|
+
Ref: CognitoUserPoolClientLogicalId
|
|
294
|
+
},
|
|
295
|
+
ProviderName: {
|
|
296
|
+
"Fn::GetAtt": [CognitoUserPoolLogicalId, "ProviderName"]
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
]
|
|
300
|
+
}
|
|
301
|
+
};
|
|
302
|
+
if (roles) {
|
|
303
|
+
template.Resources.CognitoIdentityPoolRoleAttachment = {
|
|
304
|
+
Type: "AWS::Cognito::IdentityPoolRoleAttachment",
|
|
305
|
+
Properties: {
|
|
306
|
+
IdentityPoolId: {
|
|
307
|
+
Ref: CognitoIdentityPoolLogicalId
|
|
308
|
+
},
|
|
309
|
+
Roles: roles
|
|
310
|
+
}
|
|
311
|
+
};
|
|
312
|
+
}
|
|
313
|
+
if (!template.Outputs) {
|
|
314
|
+
template.Outputs = {};
|
|
315
|
+
}
|
|
316
|
+
template.Outputs.IdentityPoolId = {
|
|
317
|
+
Description: "You use this value on Amplify Auth `identityPoolId`.",
|
|
318
|
+
Value: {
|
|
319
|
+
Ref: CognitoIdentityPoolLogicalId
|
|
320
|
+
},
|
|
321
|
+
Export: {
|
|
322
|
+
Name: {
|
|
323
|
+
"Fn::Join": [
|
|
324
|
+
":",
|
|
325
|
+
[{ Ref: "AWS::StackName" }, "CognitoIdentityPoolId"]
|
|
326
|
+
]
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
};
|
|
330
|
+
}
|
|
331
|
+
return template;
|
|
332
|
+
};
|
|
333
|
+
createAuthTemplate.CognitoUserPoolLogicalId = CognitoUserPoolLogicalId;
|
|
334
|
+
createAuthTemplate.CognitoUserPoolClientLogicalId = CognitoUserPoolClientLogicalId;
|
|
335
|
+
createAuthTemplate.CognitoIdentityPoolLogicalId = CognitoIdentityPoolLogicalId;
|
|
202
336
|
|
|
203
337
|
// src/AuthSignIn.tsx
|
|
204
338
|
import { useI18n as useI18n2 } from "@ttoss/react-i18n";
|
package/dist/index.js
CHANGED
|
@@ -232,6 +232,140 @@ var import_forms2 = require("@ttoss/forms");
|
|
|
232
232
|
|
|
233
233
|
// ../cloud-auth/dist/esm/index.js
|
|
234
234
|
var PASSWORD_MINIMUM_LENGTH = 8;
|
|
235
|
+
var CognitoUserPoolLogicalId = "CognitoUserPool";
|
|
236
|
+
var CognitoUserPoolClientLogicalId = "CognitoUserPoolClient";
|
|
237
|
+
var CognitoIdentityPoolLogicalId = "CognitoIdentityPool";
|
|
238
|
+
var createAuthTemplate = ({
|
|
239
|
+
autoVerifiedAttributes = ["email"],
|
|
240
|
+
identityPool = true,
|
|
241
|
+
roles,
|
|
242
|
+
schema
|
|
243
|
+
} = {}) => {
|
|
244
|
+
const AutoVerifiedAttributes = Array.isArray(autoVerifiedAttributes) && autoVerifiedAttributes.length > 0 ? autoVerifiedAttributes : void 0;
|
|
245
|
+
const template = {
|
|
246
|
+
AWSTemplateFormatVersion: "2010-09-09",
|
|
247
|
+
Resources: {
|
|
248
|
+
[CognitoUserPoolLogicalId]: {
|
|
249
|
+
Type: "AWS::Cognito::UserPool",
|
|
250
|
+
Properties: {
|
|
251
|
+
AutoVerifiedAttributes,
|
|
252
|
+
Policies: {
|
|
253
|
+
PasswordPolicy: {
|
|
254
|
+
MinimumLength: PASSWORD_MINIMUM_LENGTH,
|
|
255
|
+
RequireLowercase: false,
|
|
256
|
+
RequireNumbers: false,
|
|
257
|
+
RequireSymbols: false,
|
|
258
|
+
RequireUppercase: false,
|
|
259
|
+
TemporaryPasswordValidityDays: 30
|
|
260
|
+
}
|
|
261
|
+
},
|
|
262
|
+
Schema: schema,
|
|
263
|
+
UsernameAttributes: ["email"],
|
|
264
|
+
UsernameConfiguration: {
|
|
265
|
+
CaseSensitive: false
|
|
266
|
+
},
|
|
267
|
+
UserPoolName: {
|
|
268
|
+
Ref: "AWS::StackName"
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
},
|
|
272
|
+
[CognitoUserPoolClientLogicalId]: {
|
|
273
|
+
Type: "AWS::Cognito::UserPoolClient",
|
|
274
|
+
Properties: {
|
|
275
|
+
SupportedIdentityProviders: ["COGNITO"],
|
|
276
|
+
UserPoolId: {
|
|
277
|
+
Ref: "CognitoUserPool"
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
},
|
|
282
|
+
Outputs: {
|
|
283
|
+
Region: {
|
|
284
|
+
Description: "You use this value on Amplify Auth `region`.",
|
|
285
|
+
Value: {
|
|
286
|
+
Ref: "AWS::Region"
|
|
287
|
+
},
|
|
288
|
+
Export: {
|
|
289
|
+
Name: {
|
|
290
|
+
"Fn::Join": [":", [{ Ref: "AWS::StackName" }, "Region"]]
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
},
|
|
294
|
+
UserPoolId: {
|
|
295
|
+
Description: "You use this value on Amplify Auth `userPoolId`.",
|
|
296
|
+
Value: {
|
|
297
|
+
Ref: CognitoUserPoolLogicalId
|
|
298
|
+
},
|
|
299
|
+
Export: {
|
|
300
|
+
Name: {
|
|
301
|
+
"Fn::Join": [":", [{ Ref: "AWS::StackName" }, "UserPoolId"]]
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
},
|
|
305
|
+
AppClientId: {
|
|
306
|
+
Description: "You use this value on Amplify Auth `userPoolWebClientId`.",
|
|
307
|
+
Value: {
|
|
308
|
+
Ref: CognitoUserPoolClientLogicalId
|
|
309
|
+
},
|
|
310
|
+
Export: {
|
|
311
|
+
Name: {
|
|
312
|
+
"Fn::Join": [":", [{ Ref: "AWS::StackName" }, "AppClientId"]]
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
};
|
|
318
|
+
if (identityPool) {
|
|
319
|
+
template.Resources[CognitoIdentityPoolLogicalId] = {
|
|
320
|
+
Type: "AWS::Cognito::IdentityPool",
|
|
321
|
+
Properties: {
|
|
322
|
+
AllowUnauthenticatedIdentities: true,
|
|
323
|
+
CognitoIdentityProviders: [
|
|
324
|
+
{
|
|
325
|
+
ClientId: {
|
|
326
|
+
Ref: CognitoUserPoolClientLogicalId
|
|
327
|
+
},
|
|
328
|
+
ProviderName: {
|
|
329
|
+
"Fn::GetAtt": [CognitoUserPoolLogicalId, "ProviderName"]
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
]
|
|
333
|
+
}
|
|
334
|
+
};
|
|
335
|
+
if (roles) {
|
|
336
|
+
template.Resources.CognitoIdentityPoolRoleAttachment = {
|
|
337
|
+
Type: "AWS::Cognito::IdentityPoolRoleAttachment",
|
|
338
|
+
Properties: {
|
|
339
|
+
IdentityPoolId: {
|
|
340
|
+
Ref: CognitoIdentityPoolLogicalId
|
|
341
|
+
},
|
|
342
|
+
Roles: roles
|
|
343
|
+
}
|
|
344
|
+
};
|
|
345
|
+
}
|
|
346
|
+
if (!template.Outputs) {
|
|
347
|
+
template.Outputs = {};
|
|
348
|
+
}
|
|
349
|
+
template.Outputs.IdentityPoolId = {
|
|
350
|
+
Description: "You use this value on Amplify Auth `identityPoolId`.",
|
|
351
|
+
Value: {
|
|
352
|
+
Ref: CognitoIdentityPoolLogicalId
|
|
353
|
+
},
|
|
354
|
+
Export: {
|
|
355
|
+
Name: {
|
|
356
|
+
"Fn::Join": [
|
|
357
|
+
":",
|
|
358
|
+
[{ Ref: "AWS::StackName" }, "CognitoIdentityPoolId"]
|
|
359
|
+
]
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
};
|
|
363
|
+
}
|
|
364
|
+
return template;
|
|
365
|
+
};
|
|
366
|
+
createAuthTemplate.CognitoUserPoolLogicalId = CognitoUserPoolLogicalId;
|
|
367
|
+
createAuthTemplate.CognitoUserPoolClientLogicalId = CognitoUserPoolClientLogicalId;
|
|
368
|
+
createAuthTemplate.CognitoIdentityPoolLogicalId = CognitoIdentityPoolLogicalId;
|
|
235
369
|
|
|
236
370
|
// src/AuthSignIn.tsx
|
|
237
371
|
var import_react_i18n2 = require("@ttoss/react-i18n");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ttoss/react-auth",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.6",
|
|
4
4
|
"description": "ttoss authentication module for React apps.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"author": "ttoss",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"sideEffects": false,
|
|
23
23
|
"typings": "./dist/index.d.ts",
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@ttoss/forms": "^0.
|
|
25
|
+
"@ttoss/forms": "^0.13.0",
|
|
26
26
|
"@xstate/react": "^3.0.1",
|
|
27
27
|
"xstate": "^4.35.0"
|
|
28
28
|
},
|
|
@@ -34,13 +34,13 @@
|
|
|
34
34
|
"react": ">=16.8.0"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
|
-
"@ttoss/cloud-auth": "^0.
|
|
38
|
-
"@ttoss/config": "^1.
|
|
39
|
-
"@ttoss/i18n-cli": "^0.3.
|
|
40
|
-
"@ttoss/react-i18n": "^1.18.
|
|
41
|
-
"@ttoss/react-notifications": "^1.19.
|
|
42
|
-
"@ttoss/test-utils": "^1.20.
|
|
43
|
-
"@ttoss/ui": "^1.
|
|
37
|
+
"@ttoss/cloud-auth": "^0.4.0",
|
|
38
|
+
"@ttoss/config": "^1.27.0",
|
|
39
|
+
"@ttoss/i18n-cli": "^0.3.1",
|
|
40
|
+
"@ttoss/react-i18n": "^1.18.4",
|
|
41
|
+
"@ttoss/react-notifications": "^1.19.5",
|
|
42
|
+
"@ttoss/test-utils": "^1.20.1",
|
|
43
|
+
"@ttoss/ui": "^1.29.0",
|
|
44
44
|
"aws-amplify": "^5.0.7"
|
|
45
45
|
},
|
|
46
46
|
"keywords": [
|
|
@@ -50,5 +50,5 @@
|
|
|
50
50
|
"publishConfig": {
|
|
51
51
|
"access": "public"
|
|
52
52
|
},
|
|
53
|
-
"gitHead": "
|
|
53
|
+
"gitHead": "2bf304efc726a34b95859bb9b6fe8749c1a16844"
|
|
54
54
|
}
|