AttributeMapping Struct
The mapping of user pool attributes to the attributes provided by the identity providers.
Example
ts
const userpool = new cognito.UserPool(this, 'Pool');
new cognito.UserPoolIdentityProviderAmazon(this, 'Amazon', {
clientId: 'amzn-client-id',
clientSecret: 'amzn-client-secret',
userPool: userpool,
attributeMapping: {
email: cognito.ProviderAttribute.AMAZON_EMAIL,
website: cognito.ProviderAttribute.other('url'), // use other() when an attribute is not pre-defined in the CDK
custom: {
// custom user pool attributes go here
uniqueId: cognito.ProviderAttribute.AMAZON_USER_ID,
},
},
});
python
userpool = cognito.UserPool(self, "Pool")
cognito.UserPoolIdentityProviderAmazon(self, "Amazon",
client_id="amzn-client-id",
client_secret="amzn-client-secret",
user_pool=userpool,
attribute_mapping=cognito.AttributeMapping(
email=cognito.ProviderAttribute.AMAZON_EMAIL,
website=cognito.ProviderAttribute.other("url"), # use other() when an attribute is not pre-defined in the CDK
custom={
# custom user pool attributes go here
"unique_id": cognito.ProviderAttribute.AMAZON_USER_ID
}
)
)
java
UserPool userpool = new UserPool(this, "Pool");
UserPoolIdentityProviderAmazon.Builder.create(this, "Amazon")
.clientId("amzn-client-id")
.clientSecret("amzn-client-secret")
.userPool(userpool)
.attributeMapping(AttributeMapping.builder()
.email(ProviderAttribute.AMAZON_EMAIL)
.website(ProviderAttribute.other("url")) // use other() when an attribute is not pre-defined in the CDK
.custom(Map.of(
// custom user pool attributes go here
"uniqueId", ProviderAttribute.AMAZON_USER_ID))
.build())
.build();
csharp
// Install: dotnet add package Amazon.CDK.Lib
var userpool = new UserPool(this, "Pool");
new UserPoolIdentityProviderAmazon(this, "Amazon", new UserPoolIdentityProviderAmazonProps {
ClientId = "amzn-client-id",
ClientSecret = "amzn-client-secret",
UserPool = userpool,
AttributeMapping = new AttributeMapping {
Email = ProviderAttribute.AMAZON_EMAIL,
Website = ProviderAttribute.Other("url"), // use other() when an attribute is not pre-defined in the CDK
Custom = new Dictionary<string, ProviderAttribute> {
// custom user pool attributes go here
{ "uniqueId", ProviderAttribute.AMAZON_USER_ID }
}
}
});
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
userpool := cognito.NewUserPool(this, jsii.String("Pool"))
cognito.NewUserPoolIdentityProviderAmazon(this, jsii.String("Amazon"), &UserPoolIdentityProviderAmazonProps{
ClientId: jsii.String("amzn-client-id"),
ClientSecret: jsii.String("amzn-client-secret"),
UserPool: userpool,
AttributeMapping: &AttributeMapping{
Email: cognito.ProviderAttribute_AMAZON_EMAIL(),
Website: cognito.ProviderAttribute_Other(jsii.String("url")),
// use other() when an attribute is not pre-defined in the CDK
Custom: map[string]ProviderAttribute{
// custom user pool attributes go here
"uniqueId": cognito.ProviderAttribute_AMAZON_USER_ID(),
},
},
})
Properties
addressoptionalProviderAttributeaddressoptionalProviderAttributeaddressoptionalProviderAttributeAddressoptionalProviderAttributeAddressoptionalProviderAttribute#The user's postal address is a required attribute.
Default: not mapped
birthdateoptionalProviderAttributebirthdateoptionalProviderAttributebirthdateoptionalProviderAttributeBirthdateoptionalProviderAttributeBirthdateoptionalProviderAttribute#The user's birthday.
Default: not mapped
customoptional{ [key: string]: ProviderAttribute }customoptionaltyping.Mapping[str, ProviderAttribute]customoptionalMap<String, ProviderAttribute>CustomoptionalIDictionary<string, ProviderAttribute>Customoptional*map[string]ProviderAttribute#Specify custom attribute mapping here and mapping for any standard attributes not supported yet.
Default: no custom attribute mapping
emailoptionalProviderAttributeemailoptionalProviderAttributeemailoptionalProviderAttributeEmailoptionalProviderAttributeEmailoptionalProviderAttribute#The user's e-mail address.
Default: not mapped
emailVerifiedoptionalProviderAttributeemail_verifiedoptionalProviderAttributeemailVerifiedoptionalProviderAttributeEmailVerifiedoptionalProviderAttributeEmailVerifiedoptionalProviderAttribute#The user's e-mail address is verification.
Default: not mapped
familyNameoptionalProviderAttributefamily_nameoptionalProviderAttributefamilyNameoptionalProviderAttributeFamilyNameoptionalProviderAttributeFamilyNameoptionalProviderAttribute#The surname or last name of user.
Default: not mapped
fullnameoptionalProviderAttributefullnameoptionalProviderAttributefullnameoptionalProviderAttributeFullnameoptionalProviderAttributeFullnameoptionalProviderAttribute#The user's full name in displayable form.
Default: not mapped
genderoptionalProviderAttributegenderoptionalProviderAttributegenderoptionalProviderAttributeGenderoptionalProviderAttributeGenderoptionalProviderAttribute#The user's gender.
Default: not mapped
givenNameoptionalProviderAttributegiven_nameoptionalProviderAttributegivenNameoptionalProviderAttributeGivenNameoptionalProviderAttributeGivenNameoptionalProviderAttribute#The user's first name or give name.
Default: not mapped
lastUpdateTimeoptionalProviderAttributelast_update_timeoptionalProviderAttributelastUpdateTimeoptionalProviderAttributeLastUpdateTimeoptionalProviderAttributeLastUpdateTimeoptionalProviderAttribute#Time, the user's information was last updated.
Default: not mapped
localeoptionalProviderAttributelocaleoptionalProviderAttributelocaleoptionalProviderAttributeLocaleoptionalProviderAttributeLocaleoptionalProviderAttribute#The user's locale.
Default: not mapped
middleNameoptionalProviderAttributemiddle_nameoptionalProviderAttributemiddleNameoptionalProviderAttributeMiddleNameoptionalProviderAttributeMiddleNameoptionalProviderAttribute#The user's middle name.
Default: not mapped
nicknameoptionalProviderAttributenicknameoptionalProviderAttributenicknameoptionalProviderAttributeNicknameoptionalProviderAttributeNicknameoptionalProviderAttribute#The user's nickname or casual name.
Default: not mapped
phoneNumberoptionalProviderAttributephone_numberoptionalProviderAttributephoneNumberoptionalProviderAttributePhoneNumberoptionalProviderAttributePhoneNumberoptionalProviderAttribute#The user's telephone number.
Default: not mapped
preferredUsernameoptionalProviderAttributepreferred_usernameoptionalProviderAttributepreferredUsernameoptionalProviderAttributePreferredUsernameoptionalProviderAttributePreferredUsernameoptionalProviderAttribute#The user's preferred username.
Default: not mapped
profilePageoptionalProviderAttributeprofile_pageoptionalProviderAttributeprofilePageoptionalProviderAttributeProfilePageoptionalProviderAttributeProfilePageoptionalProviderAttribute#The URL to the user's profile page.
Default: not mapped
profilePictureoptionalProviderAttributeprofile_pictureoptionalProviderAttributeprofilePictureoptionalProviderAttributeProfilePictureoptionalProviderAttributeProfilePictureoptionalProviderAttribute#The URL to the user's profile picture.
Default: not mapped
timezoneoptionalProviderAttributetimezoneoptionalProviderAttributetimezoneoptionalProviderAttributeTimezoneoptionalProviderAttributeTimezoneoptionalProviderAttribute#The user's time zone.
Default: not mapped
websiteoptionalProviderAttributewebsiteoptionalProviderAttributewebsiteoptionalProviderAttributeWebsiteoptionalProviderAttributeWebsiteoptionalProviderAttribute#The URL to the user's web page or blog.
Default: not mapped