@ttoss/react-auth 1.7.20 → 1.7.21
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 +94 -70
- package/package.json +3 -3
package/dist/esm/index.js
CHANGED
|
@@ -369,6 +369,9 @@ var createAuthTemplate = ({
|
|
|
369
369
|
AWSTemplateFormatVersion: "2010-09-09",
|
|
370
370
|
Resources: {
|
|
371
371
|
[CognitoUserPoolLogicalId]: {
|
|
372
|
+
/**
|
|
373
|
+
* https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cognito-userpool.html
|
|
374
|
+
*/
|
|
372
375
|
Type: "AWS::Cognito::UserPool",
|
|
373
376
|
Properties: {
|
|
374
377
|
AutoVerifiedAttributes,
|
|
@@ -392,6 +395,9 @@ var createAuthTemplate = ({
|
|
|
392
395
|
}
|
|
393
396
|
},
|
|
394
397
|
[CognitoUserPoolClientLogicalId]: {
|
|
398
|
+
/**
|
|
399
|
+
* https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cognito-userpoolclient.html
|
|
400
|
+
*/
|
|
395
401
|
Type: "AWS::Cognito::UserPoolClient",
|
|
396
402
|
Properties: {
|
|
397
403
|
SupportedIdentityProviders: ["COGNITO"],
|
|
@@ -473,9 +479,12 @@ var createAuthTemplate = ({
|
|
|
473
479
|
}
|
|
474
480
|
if (identityPool?.enabled) {
|
|
475
481
|
template.Resources[CognitoIdentityPoolLogicalId] = {
|
|
482
|
+
/**
|
|
483
|
+
* https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cognito-identitypool.html
|
|
484
|
+
*/
|
|
476
485
|
Type: "AWS::Cognito::IdentityPool",
|
|
477
486
|
Properties: {
|
|
478
|
-
AllowUnauthenticatedIdentities:
|
|
487
|
+
AllowUnauthenticatedIdentities: identityPool.allowUnauthenticatedIdentities || false,
|
|
479
488
|
CognitoIdentityProviders: [{
|
|
480
489
|
ClientId: {
|
|
481
490
|
Ref: CognitoUserPoolClientLogicalId
|
|
@@ -486,86 +495,99 @@ var createAuthTemplate = ({
|
|
|
486
495
|
}]
|
|
487
496
|
}
|
|
488
497
|
};
|
|
489
|
-
|
|
490
|
-
|
|
498
|
+
if (identityPool.name) {
|
|
499
|
+
template.Resources[CognitoIdentityPoolLogicalId].Properties.IdentityPoolName = identityPool.name;
|
|
500
|
+
}
|
|
501
|
+
template.Resources.CognitoIdentityPoolRoleAttachment = {
|
|
502
|
+
/**
|
|
503
|
+
* https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cognito-identitypoolroleattachment.html
|
|
504
|
+
*/
|
|
505
|
+
Type: "AWS::Cognito::IdentityPoolRoleAttachment",
|
|
491
506
|
Properties: {
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
Statement: [{
|
|
495
|
-
Effect: "Allow",
|
|
496
|
-
Principal: {
|
|
497
|
-
Federated: "cognito-identity.amazonaws.com"
|
|
498
|
-
},
|
|
499
|
-
Action: ["sts:AssumeRoleWithWebIdentity", "sts:TagSession"],
|
|
500
|
-
Condition: {
|
|
501
|
-
StringEquals: {
|
|
502
|
-
"cognito-identity.amazonaws.com:aud": {
|
|
503
|
-
Ref: CognitoIdentityPoolLogicalId
|
|
504
|
-
}
|
|
505
|
-
},
|
|
506
|
-
"ForAnyValue:StringLike": {
|
|
507
|
-
"cognito-identity.amazonaws.com:amr": "authenticated"
|
|
508
|
-
}
|
|
509
|
-
}
|
|
510
|
-
}]
|
|
507
|
+
IdentityPoolId: {
|
|
508
|
+
Ref: CognitoIdentityPoolLogicalId
|
|
511
509
|
},
|
|
512
|
-
|
|
513
|
-
PolicyName: "IdentityPoolAuthenticatedIAMRolePolicyName",
|
|
514
|
-
PolicyDocument: {
|
|
515
|
-
Version: "2012-10-17",
|
|
516
|
-
Statement: [DenyStatement]
|
|
517
|
-
}
|
|
518
|
-
}]
|
|
510
|
+
Roles: {}
|
|
519
511
|
}
|
|
520
512
|
};
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
Action: "sts:AssumeRoleWithWebIdentity",
|
|
532
|
-
Condition: {
|
|
533
|
-
StringEquals: {
|
|
534
|
-
"cognito-identity.amazonaws.com:aud": {
|
|
535
|
-
Ref: CognitoIdentityPoolLogicalId
|
|
536
|
-
}
|
|
513
|
+
if (!identityPool.authenticatedRoleArn) {
|
|
514
|
+
template.Resources[IdentityPoolAuthenticatedIAMRoleLogicalId] = {
|
|
515
|
+
Type: "AWS::IAM::Role",
|
|
516
|
+
Properties: {
|
|
517
|
+
AssumeRolePolicyDocument: {
|
|
518
|
+
Version: "2012-10-17",
|
|
519
|
+
Statement: [{
|
|
520
|
+
Effect: "Allow",
|
|
521
|
+
Principal: {
|
|
522
|
+
Federated: "cognito-identity.amazonaws.com"
|
|
537
523
|
},
|
|
538
|
-
"
|
|
539
|
-
|
|
524
|
+
Action: ["sts:AssumeRoleWithWebIdentity", "sts:TagSession"],
|
|
525
|
+
Condition: {
|
|
526
|
+
StringEquals: {
|
|
527
|
+
"cognito-identity.amazonaws.com:aud": {
|
|
528
|
+
Ref: CognitoIdentityPoolLogicalId
|
|
529
|
+
}
|
|
530
|
+
},
|
|
531
|
+
"ForAnyValue:StringLike": {
|
|
532
|
+
"cognito-identity.amazonaws.com:amr": "authenticated"
|
|
533
|
+
}
|
|
540
534
|
}
|
|
535
|
+
}]
|
|
536
|
+
},
|
|
537
|
+
Policies: identityPool.authenticatedPolicies || [{
|
|
538
|
+
PolicyName: "IdentityPoolAuthenticatedIAMRolePolicyName",
|
|
539
|
+
PolicyDocument: {
|
|
540
|
+
Version: "2012-10-17",
|
|
541
|
+
Statement: [DenyStatement]
|
|
541
542
|
}
|
|
542
543
|
}]
|
|
543
|
-
}
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
544
|
+
}
|
|
545
|
+
};
|
|
546
|
+
template.Resources.CognitoIdentityPoolRoleAttachment.Properties.Roles.authenticated = {
|
|
547
|
+
"Fn::GetAtt": [IdentityPoolAuthenticatedIAMRoleLogicalId, "Arn"]
|
|
548
|
+
};
|
|
549
|
+
} else {
|
|
550
|
+
template.Resources.CognitoIdentityPoolRoleAttachment.Properties.Roles.authenticated = identityPool.authenticatedRoleArn;
|
|
551
|
+
}
|
|
552
|
+
if (!identityPool.unauthenticatedRoleArn) {
|
|
553
|
+
template.Resources[IdentityPoolUnauthenticatedIAMRoleLogicalId] = {
|
|
554
|
+
Type: "AWS::IAM::Role",
|
|
555
|
+
Properties: {
|
|
556
|
+
AssumeRolePolicyDocument: {
|
|
547
557
|
Version: "2012-10-17",
|
|
548
|
-
Statement: [
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
558
|
+
Statement: [{
|
|
559
|
+
Effect: "Allow",
|
|
560
|
+
Principal: {
|
|
561
|
+
Federated: "cognito-identity.amazonaws.com"
|
|
562
|
+
},
|
|
563
|
+
Action: "sts:AssumeRoleWithWebIdentity",
|
|
564
|
+
Condition: {
|
|
565
|
+
StringEquals: {
|
|
566
|
+
"cognito-identity.amazonaws.com:aud": {
|
|
567
|
+
Ref: CognitoIdentityPoolLogicalId
|
|
568
|
+
}
|
|
569
|
+
},
|
|
570
|
+
"ForAnyValue:StringLike": {
|
|
571
|
+
"cognito-identity.amazonaws.com:amr": "unauthenticated"
|
|
572
|
+
}
|
|
573
|
+
}
|
|
574
|
+
}]
|
|
562
575
|
},
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
576
|
+
Policies: identityPool.authenticatedPolicies || [{
|
|
577
|
+
PolicyName: "IdentityPoolUnauthenticatedIAMRolePolicyName",
|
|
578
|
+
PolicyDocument: {
|
|
579
|
+
Version: "2012-10-17",
|
|
580
|
+
Statement: [DenyStatement]
|
|
581
|
+
}
|
|
582
|
+
}]
|
|
566
583
|
}
|
|
567
|
-
}
|
|
568
|
-
|
|
584
|
+
};
|
|
585
|
+
template.Resources.CognitoIdentityPoolRoleAttachment.Properties.Roles.unauthenticated = {
|
|
586
|
+
"Fn::GetAtt": [IdentityPoolUnauthenticatedIAMRoleLogicalId, "Arn"]
|
|
587
|
+
};
|
|
588
|
+
} else {
|
|
589
|
+
template.Resources.CognitoIdentityPoolRoleAttachment.Properties.Roles.unauthenticated = identityPool.unauthenticatedRoleArn;
|
|
590
|
+
}
|
|
569
591
|
if (!template.Outputs) {
|
|
570
592
|
template.Outputs = {};
|
|
571
593
|
}
|
|
@@ -588,6 +610,8 @@ var createAuthTemplate = ({
|
|
|
588
610
|
createAuthTemplate.CognitoUserPoolLogicalId = CognitoUserPoolLogicalId;
|
|
589
611
|
createAuthTemplate.CognitoUserPoolClientLogicalId = CognitoUserPoolClientLogicalId;
|
|
590
612
|
createAuthTemplate.CognitoIdentityPoolLogicalId = CognitoIdentityPoolLogicalId;
|
|
613
|
+
createAuthTemplate.IdentityPoolAuthenticatedIAMRoleLogicalId = IdentityPoolAuthenticatedIAMRoleLogicalId;
|
|
614
|
+
createAuthTemplate.IdentityPoolUnauthenticatedIAMRoleLogicalId = IdentityPoolUnauthenticatedIAMRoleLogicalId;
|
|
591
615
|
|
|
592
616
|
// src/AuthForgotPasswordResetPassword.tsx
|
|
593
617
|
import { useI18n as useI18n3 } from "@ttoss/react-i18n";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ttoss/react-auth",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.21",
|
|
4
4
|
"description": "ttoss authentication module for React apps.",
|
|
5
5
|
"author": "ttoss",
|
|
6
6
|
"contributors": [
|
|
@@ -42,11 +42,11 @@
|
|
|
42
42
|
"aws-amplify": "^5.3.11",
|
|
43
43
|
"jest": "^29.7.0",
|
|
44
44
|
"tsup": "^8.0.1",
|
|
45
|
-
"@ttoss/cloud-auth": "^0.
|
|
45
|
+
"@ttoss/cloud-auth": "^0.11.0",
|
|
46
46
|
"@ttoss/config": "^1.31.4",
|
|
47
47
|
"@ttoss/i18n-cli": "^0.7.5",
|
|
48
|
-
"@ttoss/react-i18n": "^1.25.8",
|
|
49
48
|
"@ttoss/react-notifications": "^1.24.22",
|
|
49
|
+
"@ttoss/react-i18n": "^1.25.8",
|
|
50
50
|
"@ttoss/test-utils": "^2.0.4",
|
|
51
51
|
"@ttoss/ui": "^4.0.7"
|
|
52
52
|
},
|