Skip to content

Commit

Permalink
Fix for custom attribute mapping
Browse files Browse the repository at this point in the history
  • Loading branch information
Balaji-JBC committed Nov 3, 2024
1 parent 796c6d1 commit 24fd60f
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export abstract class UserPoolIdentityProviderBase extends Resource implements I
}, mapping);
if (this.props.attributeMapping.custom) {
mapping = Object.entries(this.props.attributeMapping.custom).reduce((agg, [k, v]) => {
return { ...agg, [k]: v.attributeName };
return { ...agg, [k]: `custom:${v.attributeName}` };
}, mapping);
}
if (Object.keys(mapping).length === 0) { return undefined; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ describe('UserPoolIdentityProvider', () => {
AttributeMapping: {
given_name: 'name',
address: 'amzn-address',
customAttr1: 'email',
customAttr2: 'amzn-custom-attr',
customAttr1: 'custom:email',
customAttr2: 'custom:amzn-custom-attr',
},
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@ describe('UserPoolIdentityProvider', () => {
AttributeMapping: {
family_name: 'lastName',
given_name: 'firstName',
customAttr1: 'email',
customAttr2: 'sub',
customAttr1: 'custom:email',
customAttr2: 'custom:sub',
},
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ describe('UserPoolIdentityProvider', () => {

// THEN
expect(idp.mapping).toStrictEqual({
'custom-attr-1': 'email',
'custom-attr-2': 'name',
'custom-attr-1': 'custom:email',
'custom-attr-2': 'custom:name',
});
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@ describe('UserPoolIdentityProvider', () => {
AttributeMapping: {
given_name: 'name',
address: 'fb-address',
customAttr1: 'email',
customAttr2: 'fb-custom-attr',
customAttr1: 'custom:email',
customAttr2: 'custom:fb-custom-attr',
},
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ describe('UserPoolIdentityProvider', () => {
AttributeMapping: {
given_name: 'name',
address: 'google-address',
customAttr1: 'email',
customAttr2: 'google-custom-attr',
customAttr1: 'custom:email',
customAttr2: 'custom:google-custom-attr',
},
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,8 @@ describe('UserPoolIdentityProvider', () => {
AttributeMapping: {
family_name: 'family_name',
given_name: 'given_name',
customAttr1: 'email',
customAttr2: 'sub',
customAttr1: 'custom:email',
customAttr2: 'custom:sub',
},
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,8 @@ describe('UserPoolIdentityProvider', () => {
AttributeMapping: {
family_name: 'family_name',
given_name: 'given_name',
customAttr1: 'email',
customAttr2: 'sub',
customAttr1: 'custom:email',
customAttr2: 'custom:sub',
},
});
});
Expand Down

0 comments on commit 24fd60f

Please sign in to comment.