ClientAttributes

class aws_cdk.aws_cognito.ClientAttributes

Bases: object

A set of attributes, useful to set Read and Write attributes.

ExampleMetadata:

infused

Example:

pool = cognito.UserPool(self, "Pool")

client_write_attributes = (cognito.ClientAttributes()).with_standard_attributes(fullname=True, email=True).with_custom_attributes("favouritePizza", "favouriteBeverage")

client_read_attributes = client_write_attributes.with_standard_attributes(email_verified=True).with_custom_attributes("pointsEarned")

pool.add_client("app-client",
    # ...
    read_attributes=client_read_attributes,
    write_attributes=client_write_attributes
)

Creates a ClientAttributes with the specified attributes.

Default:
  • a ClientAttributes object without any attributes

Methods

attributes()

The list of attributes represented by this ClientAttributes.

Return type:

List[str]

with_custom_attributes(*attributes)

Creates a custom ClientAttributes with the specified attributes.

Parameters:

attributes (str) – a list of custom attributes to add to the set.

Return type:

ClientAttributes

with_standard_attributes(*, address=None, birthdate=None, email=None, email_verified=None, family_name=None, fullname=None, gender=None, given_name=None, last_update_time=None, locale=None, middle_name=None, nickname=None, phone_number=None, phone_number_verified=None, preferred_username=None, profile_page=None, profile_picture=None, timezone=None, website=None)

Creates a custom ClientAttributes with the specified attributes.

Parameters:
  • address (Optional[bool]) – The user’s postal address. Default: false

  • birthdate (Optional[bool]) – The user’s birthday, represented as an ISO 8601:2004 format. Default: false

  • email (Optional[bool]) – The user’s e-mail address, represented as an RFC 5322 [RFC5322] addr-spec. Default: false

  • email_verified (Optional[bool]) – Whether the email address has been verified. Default: false

  • family_name (Optional[bool]) – The surname or last name of the user. Default: false

  • fullname (Optional[bool]) – The user’s full name in displayable form, including all name parts, titles and suffixes. Default: false

  • gender (Optional[bool]) – The user’s gender. Default: false

  • given_name (Optional[bool]) – The user’s first name or give name. Default: false

  • last_update_time (Optional[bool]) – The time, the user’s information was last updated. Default: false

  • locale (Optional[bool]) – The user’s locale, represented as a BCP47 [RFC5646] language tag. Default: false

  • middle_name (Optional[bool]) – The user’s middle name. Default: false

  • nickname (Optional[bool]) – The user’s nickname or casual name. Default: false

  • phone_number (Optional[bool]) – The user’s telephone number. Default: false

  • phone_number_verified (Optional[bool]) – Whether the phone number has been verified. Default: false

  • preferred_username (Optional[bool]) – The user’s preffered username, different from the immutable user name. Default: false

  • profile_page (Optional[bool]) – The URL to the user’s profile page. Default: false

  • profile_picture (Optional[bool]) – The URL to the user’s profile picture. Default: false

  • timezone (Optional[bool]) – The user’s time zone. Default: false

  • website (Optional[bool]) – The URL to the user’s web page or blog. Default: false

Return type:

ClientAttributes