From b6bd651a6b53f47d60be71dbaa8210ff545356cf Mon Sep 17 00:00:00 2001 From: ykethan Date: Tue, 21 May 2024 05:33:54 +0530 Subject: [PATCH 1/3] update custom attribute example --- .../auth/modify-resources-with-cdk/index.mdx | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/pages/[platform]/build-a-backend/auth/modify-resources-with-cdk/index.mdx b/src/pages/[platform]/build-a-backend/auth/modify-resources-with-cdk/index.mdx index e298e2bc8e6..b816536ae37 100644 --- a/src/pages/[platform]/build-a-backend/auth/modify-resources-with-cdk/index.mdx +++ b/src/pages/[platform]/build-a-backend/auth/modify-resources-with-cdk/index.mdx @@ -76,14 +76,14 @@ const backend = defineBackend({ // extract L1 CfnUserPool resources const { cfnUserPool } = backend.auth.resources.cfnResources; -// use CDK's `addPropertyOverride` to modify properties directly -cfnUserPool.addPropertyOverride("Schema", [ - { - Name: "publicName", - AttributeDataType: "String", - Mutable: true, - }, -]); +// update the schema property to add custom attributes +if (Array.isArray(cfnUserPool.schema)) { + cfnUserPool.schema.push({ + name: "policyName", + attributeDataType: "Boolean", + developerOnlyAttribute: true, + }); +} ``` {/* token validity */} From 919a69dfbca62e804b246a342f73e995097a5359 Mon Sep 17 00:00:00 2001 From: ykethan Date: Tue, 21 May 2024 05:47:36 +0530 Subject: [PATCH 2/3] update password policy example --- .../auth/modify-resources-with-cdk/index.mdx | 31 +++++++++---------- 1 file changed, 14 insertions(+), 17 deletions(-) diff --git a/src/pages/[platform]/build-a-backend/auth/modify-resources-with-cdk/index.mdx b/src/pages/[platform]/build-a-backend/auth/modify-resources-with-cdk/index.mdx index b816536ae37..1e869944699 100644 --- a/src/pages/[platform]/build-a-backend/auth/modify-resources-with-cdk/index.mdx +++ b/src/pages/[platform]/build-a-backend/auth/modify-resources-with-cdk/index.mdx @@ -44,20 +44,17 @@ const backend = defineBackend({ }); // extract L1 CfnUserPool resources const { cfnUserPool } = backend.auth.resources.cfnResources; -// use CDK's `addPropertyOverride` to modify properties directly -cfnUserPool.addPropertyOverride( - "Policies", - { - PasswordPolicy: { - MinimumLength: 10, - RequireLowercase: true, - RequireNumbers: true, - RequireSymbols: true, - RequireUppercase: true, - TemporaryPasswordValidityDays: 20, - }, - } -); +// modify cfnUserPool policies directly +cfnUserPool.policies = { + passwordPolicy: { + minimumLength: 10, + requireLowercase: true, + requireNumbers: true, + requireSymbols: true, + requireUppercase: true, + temporaryPasswordValidityDays: 20, + }, +}; ``` ## Custom Attributes @@ -76,11 +73,11 @@ const backend = defineBackend({ // extract L1 CfnUserPool resources const { cfnUserPool } = backend.auth.resources.cfnResources; -// update the schema property to add custom attributes +// update the schema property to add a custom attributes if (Array.isArray(cfnUserPool.schema)) { cfnUserPool.schema.push({ - name: "policyName", - attributeDataType: "Boolean", + name: 'policyName', + attributeDataType: 'Boolean', developerOnlyAttribute: true, }); } From 6e9f9d3fe5c8a2c195616e56f9fc6e4b34f2f7ab Mon Sep 17 00:00:00 2001 From: josef Date: Mon, 20 May 2024 17:25:08 -0700 Subject: [PATCH 3/3] Update src/pages/[platform]/build-a-backend/auth/modify-resources-with-cdk/index.mdx --- .../build-a-backend/auth/modify-resources-with-cdk/index.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/[platform]/build-a-backend/auth/modify-resources-with-cdk/index.mdx b/src/pages/[platform]/build-a-backend/auth/modify-resources-with-cdk/index.mdx index 1e869944699..3cfbda4a6b0 100644 --- a/src/pages/[platform]/build-a-backend/auth/modify-resources-with-cdk/index.mdx +++ b/src/pages/[platform]/build-a-backend/auth/modify-resources-with-cdk/index.mdx @@ -73,7 +73,7 @@ const backend = defineBackend({ // extract L1 CfnUserPool resources const { cfnUserPool } = backend.auth.resources.cfnResources; -// update the schema property to add a custom attributes +// update the schema property to add custom attributes if (Array.isArray(cfnUserPool.schema)) { cfnUserPool.schema.push({ name: 'policyName',