aws-cdk-lib 2.184.1__py3-none-any.whl → 2.186.0__py3-none-any.whl

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.

Potentially problematic release.


This version of aws-cdk-lib might be problematic. Click here for more details.

Files changed (75) hide show
  1. aws_cdk/__init__.py +102 -29
  2. aws_cdk/_jsii/__init__.py +1 -1
  3. aws_cdk/_jsii/{aws-cdk-lib@2.184.1.jsii.tgz → aws-cdk-lib@2.186.0.jsii.tgz} +0 -0
  4. aws_cdk/aws_amazonmq/__init__.py +3 -2
  5. aws_cdk/aws_apigateway/__init__.py +1 -1
  6. aws_cdk/aws_apigatewayv2/__init__.py +9 -0
  7. aws_cdk/aws_appconfig/__init__.py +3 -3
  8. aws_cdk/aws_applicationsignals/__init__.py +495 -1
  9. aws_cdk/aws_appsync/__init__.py +65 -11
  10. aws_cdk/aws_athena/__init__.py +143 -0
  11. aws_cdk/aws_backup/__init__.py +4 -2
  12. aws_cdk/aws_batch/__init__.py +9 -0
  13. aws_cdk/aws_bedrock/__init__.py +645 -199
  14. aws_cdk/aws_cassandra/__init__.py +3 -5
  15. aws_cdk/aws_chatbot/__init__.py +41 -0
  16. aws_cdk/aws_cleanrooms/__init__.py +21 -9
  17. aws_cdk/aws_cloudformation/__init__.py +1 -5
  18. aws_cdk/aws_cloudfront/__init__.py +4 -1
  19. aws_cdk/aws_cloudfront_origins/__init__.py +4 -2
  20. aws_cdk/aws_codeartifact/__init__.py +20 -33
  21. aws_cdk/aws_codebuild/__init__.py +10 -3
  22. aws_cdk/aws_codepipeline/__init__.py +1328 -120
  23. aws_cdk/aws_cognito/__init__.py +1 -1
  24. aws_cdk/aws_cognito_identitypool/__init__.py +2303 -0
  25. aws_cdk/aws_config/__init__.py +1 -1
  26. aws_cdk/aws_connect/__init__.py +3 -7
  27. aws_cdk/aws_controltower/__init__.py +18 -26
  28. aws_cdk/aws_datasync/__init__.py +12 -14
  29. aws_cdk/aws_datazone/__init__.py +3471 -2
  30. aws_cdk/aws_ec2/__init__.py +701 -37
  31. aws_cdk/aws_ecr/__init__.py +84 -2
  32. aws_cdk/aws_ecs/__init__.py +20 -25
  33. aws_cdk/aws_eks/__init__.py +2 -0
  34. aws_cdk/aws_elasticloadbalancingv2/__init__.py +42 -5
  35. aws_cdk/aws_elasticsearch/__init__.py +1 -1
  36. aws_cdk/aws_events/__init__.py +37 -14
  37. aws_cdk/aws_events_targets/__init__.py +5 -5
  38. aws_cdk/aws_gamelift/__init__.py +165 -165
  39. aws_cdk/aws_gameliftstreams/__init__.py +199 -59
  40. aws_cdk/aws_iam/__init__.py +320 -25
  41. aws_cdk/aws_imagebuilder/__init__.py +15 -2
  42. aws_cdk/aws_iotfleetwise/__init__.py +15 -6
  43. aws_cdk/aws_kinesisfirehose/__init__.py +115 -113
  44. aws_cdk/aws_lambda/__init__.py +7 -1
  45. aws_cdk/aws_location/__init__.py +24 -7
  46. aws_cdk/aws_logs/__init__.py +21 -27
  47. aws_cdk/aws_msk/__init__.py +17 -50
  48. aws_cdk/aws_networkfirewall/__init__.py +16 -12
  49. aws_cdk/aws_oam/__init__.py +8 -37
  50. aws_cdk/aws_opensearchservice/__init__.py +1 -1
  51. aws_cdk/aws_pcs/__init__.py +33 -22
  52. aws_cdk/aws_quicksight/__init__.py +6 -69
  53. aws_cdk/aws_rds/__init__.py +8 -4
  54. aws_cdk/aws_redshiftserverless/__init__.py +192 -15
  55. aws_cdk/aws_rum/__init__.py +454 -43
  56. aws_cdk/aws_s3/__init__.py +4 -6
  57. aws_cdk/aws_s3_deployment/__init__.py +2 -0
  58. aws_cdk/aws_sagemaker/__init__.py +524 -0
  59. aws_cdk/aws_scheduler/__init__.py +3944 -121
  60. aws_cdk/aws_scheduler_targets/__init__.py +4472 -0
  61. aws_cdk/aws_ses/__init__.py +9 -9
  62. aws_cdk/aws_sns/__init__.py +12 -12
  63. aws_cdk/aws_ssmquicksetup/__init__.py +5 -3
  64. aws_cdk/aws_stepfunctions/__init__.py +17 -15
  65. aws_cdk/aws_timestream/__init__.py +4 -4
  66. aws_cdk/aws_wafv2/__init__.py +345 -0
  67. aws_cdk/aws_workspacesthinclient/__init__.py +4 -4
  68. aws_cdk/cx_api/__init__.py +53 -0
  69. aws_cdk/region_info/__init__.py +2 -2
  70. {aws_cdk_lib-2.184.1.dist-info → aws_cdk_lib-2.186.0.dist-info}/METADATA +1 -1
  71. {aws_cdk_lib-2.184.1.dist-info → aws_cdk_lib-2.186.0.dist-info}/RECORD +75 -73
  72. {aws_cdk_lib-2.184.1.dist-info → aws_cdk_lib-2.186.0.dist-info}/LICENSE +0 -0
  73. {aws_cdk_lib-2.184.1.dist-info → aws_cdk_lib-2.186.0.dist-info}/NOTICE +0 -0
  74. {aws_cdk_lib-2.184.1.dist-info → aws_cdk_lib-2.186.0.dist-info}/WHEEL +0 -0
  75. {aws_cdk_lib-2.184.1.dist-info → aws_cdk_lib-2.186.0.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,2303 @@
1
+ r'''
2
+ # Amazon Cognito Identity Pool Construct Library
3
+
4
+ [Amazon Cognito Identity Pools](https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-identity.html) enable you to grant your users access to other AWS services.
5
+
6
+ Identity Pools are one of the two main components of [Amazon Cognito](https://docs.aws.amazon.com/cognito/latest/developerguide/what-is-amazon-cognito.html), which provides authentication, authorization, and
7
+ user management for your web and mobile apps. Your users can sign in through a a trusted identity provider, like a user
8
+ pool or a SAML 2.0 service, as well as with third party providers such as Facebook, Amazon, Google or Apple.
9
+
10
+ The other main component in Amazon Cognito is [user pools](https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-user-identity-pools.html). User Pools are user directories that provide sign-up and
11
+ sign-in options for your app users.
12
+
13
+ This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project.
14
+
15
+ ```python
16
+ from aws_cdk.aws_cognito_identitypool import IdentityPool, UserPoolAuthenticationProvider
17
+ ```
18
+
19
+ ## Table of Contents
20
+
21
+ * [Identity Pools](#identity-pools)
22
+
23
+ * [Authenticated and Unauthenticated Identities](#authenticated-and-unauthenticated-identities)
24
+ * [Authentication Providers](#authentication-providers)
25
+
26
+ * [User Pool Authentication Provider](#user-pool-authentication-provider)
27
+ * [Server Side Token Check](#server-side-token-check)
28
+ * [Associating an External Provider Directly](#associating-an-external-provider-directly)
29
+ * [OpenIdConnect and Saml](#openid-connect-and-saml)
30
+ * [Custom Providers](#custom-providers)
31
+ * [Role Mapping](#role-mapping)
32
+
33
+ * [Provider Urls](#provider-urls)
34
+ * [Authentication Flow](#authentication-flow)
35
+ * [Cognito Sync](#cognito-sync)
36
+ * [Importing Identity Pools](#importing-identity-pools)
37
+
38
+ ## Identity Pools
39
+
40
+ Identity pools provide temporary AWS credentials for users who are guests (unauthenticated) and for users who have
41
+ authenticated by presenting a token from another identity provider. An identity pool is a store of user identity data
42
+ specific to an account.
43
+
44
+ Identity pools can be used in conjunction with Cognito User Pools or by accessing external federated identity providers
45
+ directly. Learn more at [Amazon Cognito Identity Pools](https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-identity.html).
46
+
47
+ ### Authenticated and Unauthenticated Identities
48
+
49
+ Identity pools define two types of identities: authenticated(`user`) and unauthenticated (`guest`). Every identity in
50
+ an identity pool is either authenticated or unauthenticated. Each identity pool has a default role for authenticated
51
+ identities, and a default role for unauthenticated identities. Absent other overriding rules (see below), these are the
52
+ roles that will be assumed by the corresponding users in the authentication process.
53
+
54
+ A basic Identity Pool with minimal configuration has no required props, with default authenticated (user) and
55
+ unauthenticated (guest) roles applied to the identity pool:
56
+
57
+ ```python
58
+ IdentityPool(self, "myIdentityPool")
59
+ ```
60
+
61
+ By default, both the authenticated and unauthenticated roles will have no permissions attached. When granting permissions,
62
+ you should ensure that you are granting the least privileged permissions required for your use case. Grant permissions
63
+ to roles using the public `authenticatedRole` and `unauthenticatedRole` properties:
64
+
65
+ ```python
66
+ import aws_cdk.aws_dynamodb as dynamodb
67
+ # table: dynamodb.Table
68
+
69
+
70
+ identity_pool = IdentityPool(self, "myIdentityPool")
71
+
72
+ # Grant permissions to authenticated users
73
+ table.grant_read_write_data(identity_pool.authenticated_role)
74
+ # Grant permissions to unauthenticated guest users
75
+ table.grant_read_data(identity_pool.unauthenticated_role)
76
+
77
+ # Or add policy statements straight to the role
78
+ identity_pool.authenticated_role.add_to_principal_policy(iam.PolicyStatement(
79
+ effect=iam.Effect.ALLOW,
80
+ actions=["dynamodb:UpdateItem"],
81
+ resources=[table.table_arn]
82
+ ))
83
+ ```
84
+
85
+ The default roles can also be supplied in `IdentityPoolProps`:
86
+
87
+ ```python
88
+ stack = Stack()
89
+ authenticated_role = iam.Role(self, "authRole",
90
+ assumed_by=iam.ServicePrincipal("service.amazonaws.com")
91
+ )
92
+ unauthenticated_role = iam.Role(self, "unauthRole",
93
+ assumed_by=iam.ServicePrincipal("service.amazonaws.com")
94
+ )
95
+ identity_pool = IdentityPool(self, "TestIdentityPoolActions",
96
+ authenticated_role=authenticated_role,
97
+ unauthenticated_role=unauthenticated_role
98
+ )
99
+ ```
100
+
101
+ ### Authentication Providers
102
+
103
+ Authenticated identities belong to users who are authenticated by a public login provider (Amazon Cognito user pools,
104
+ Login with Amazon, Sign in with Apple, Facebook, Google, SAML, or any OpenID Connect Providers) or a developer provider
105
+ (your own backend authentication process).
106
+
107
+ [Authentication providers](https://docs.aws.amazon.com/cognito/latest/developerguide/external-identity-providers.html) can be associated with an Identity Pool by first associating them with a Cognito User Pool or by
108
+ associating the provider directly with the identity pool.
109
+
110
+ #### User Pool Authentication Provider
111
+
112
+ In order to attach a user pool to an identity pool as an authentication provider, the identity pool needs properties
113
+ from both the user pool and the user pool client. For this reason identity pools use a `UserPoolAuthenticationProvider`
114
+ to gather the necessary properties from the user pool constructs.
115
+
116
+ ```python
117
+ user_pool = cognito.UserPool(self, "Pool")
118
+
119
+ IdentityPool(self, "myidentitypool",
120
+ identity_pool_name="myidentitypool",
121
+ authentication_providers=IdentityPoolAuthenticationProviders(
122
+ user_pools=[UserPoolAuthenticationProvider(user_pool=user_pool)]
123
+ )
124
+ )
125
+ ```
126
+
127
+ User pools can also be associated with an identity pool after instantiation. The Identity Pool's `addUserPoolAuthentication` method
128
+ returns the User Pool Client that has been created:
129
+
130
+ ```python
131
+ # identity_pool: IdentityPool
132
+
133
+ user_pool = cognito.UserPool(self, "Pool")
134
+ user_pool_client = identity_pool.add_user_pool_authentication(UserPoolAuthenticationProvider(
135
+ user_pool=user_pool
136
+ ))
137
+ ```
138
+
139
+ #### Server Side Token Check
140
+
141
+ With the `IdentityPool` CDK Construct, by default the pool is configured to check with the integrated user pools to
142
+ make sure that the user has not been globally signed out or deleted before the identity pool provides an OIDC token or
143
+ AWS credentials for the user.
144
+
145
+ If the user is signed out or deleted, the identity pool will return a 400 Not Authorized error. This setting can be
146
+ disabled, however, in several ways.
147
+
148
+ Setting `disableServerSideTokenCheck` to true will change the default behavior to no server side token check. Learn
149
+ more [here](https://docs.aws.amazon.com/cognitoidentity/latest/APIReference/API_CognitoIdentityProvider.html#CognitoIdentity-Type-CognitoIdentityProvider-ServerSideTokenCheck):
150
+
151
+ ```python
152
+ # identity_pool: IdentityPool
153
+
154
+ user_pool = cognito.UserPool(self, "Pool")
155
+ identity_pool.add_user_pool_authentication(UserPoolAuthenticationProvider(
156
+ user_pool=user_pool,
157
+ disable_server_side_token_check=True
158
+ ))
159
+ ```
160
+
161
+ #### Associating an External Provider Directly
162
+
163
+ One or more [external identity providers](https://docs.aws.amazon.com/cognito/latest/developerguide/external-identity-providers.html) can be associated with an identity pool directly using
164
+ `authenticationProviders`:
165
+
166
+ ```python
167
+ IdentityPool(self, "myidentitypool",
168
+ identity_pool_name="myidentitypool",
169
+ authentication_providers=IdentityPoolAuthenticationProviders(
170
+ amazon=IdentityPoolAmazonLoginProvider(
171
+ app_id="amzn1.application.12312k3j234j13rjiwuenf"
172
+ ),
173
+ facebook=IdentityPoolFacebookLoginProvider(
174
+ app_id="1234567890123"
175
+ ),
176
+ google=IdentityPoolGoogleLoginProvider(
177
+ client_id="12345678012.apps.googleusercontent.com"
178
+ ),
179
+ apple=IdentityPoolAppleLoginProvider(
180
+ services_id="com.myappleapp.auth"
181
+ ),
182
+ twitter=IdentityPoolTwitterLoginProvider(
183
+ consumer_key="my-twitter-id",
184
+ consumer_secret="my-twitter-secret"
185
+ )
186
+ )
187
+ )
188
+ ```
189
+
190
+ To associate more than one provider of the same type with the identity pool, use User
191
+ Pools, OpenIdConnect, or SAML. Only one provider per external service can be attached directly to the identity pool.
192
+
193
+ #### OpenId Connect and Saml
194
+
195
+ [OpenID Connect](https://docs.aws.amazon.com/cognito/latest/developerguide/open-id.html) is an open standard for
196
+ authentication that is supported by a number of login providers. Amazon Cognito supports linking of identities with
197
+ OpenID Connect providers that are configured through [AWS Identity and Access Management](http://aws.amazon.com/iam/).
198
+
199
+ An identity provider that supports [Security Assertion Markup Language 2.0 (SAML 2.0)](https://docs.aws.amazon.com/cognito/latest/developerguide/saml-identity-provider.html) can be used to provide a simple
200
+ onboarding flow for users. The SAML-supporting identity provider specifies the IAM roles that can be assumed by users
201
+ so that different users can be granted different sets of permissions. Associating an OpenId Connect or Saml provider
202
+ with an identity pool:
203
+
204
+ ```python
205
+ # open_id_connect_provider: iam.OpenIdConnectProvider
206
+ # saml_provider: iam.SamlProvider
207
+
208
+
209
+ IdentityPool(self, "myidentitypool",
210
+ identity_pool_name="myidentitypool",
211
+ authentication_providers=IdentityPoolAuthenticationProviders(
212
+ open_id_connect_providers=[open_id_connect_provider],
213
+ saml_providers=[saml_provider]
214
+ )
215
+ )
216
+ ```
217
+
218
+ #### Custom Providers
219
+
220
+ The identity pool's behavior can be customized further using custom [developer authenticated identities](https://docs.aws.amazon.com/cognito/latest/developerguide/developer-authenticated-identities.html).
221
+ With developer authenticated identities, users can be registered and authenticated via an existing authentication
222
+ process while still using Amazon Cognito to synchronize user data and access AWS resources.
223
+
224
+ Like the supported external providers, though, only one custom provider can be directly associated with the identity
225
+ pool.
226
+
227
+ ```python
228
+ # open_id_connect_provider: iam.OpenIdConnectProvider
229
+
230
+ IdentityPool(self, "myidentitypool",
231
+ identity_pool_name="myidentitypool",
232
+ authentication_providers=IdentityPoolAuthenticationProviders(
233
+ google=IdentityPoolGoogleLoginProvider(
234
+ client_id="12345678012.apps.googleusercontent.com"
235
+ ),
236
+ open_id_connect_providers=[open_id_connect_provider],
237
+ custom_provider="my-custom-provider.example.com"
238
+ )
239
+ )
240
+ ```
241
+
242
+ ### Role Mapping
243
+
244
+ In addition to setting default roles for authenticated and unauthenticated users, identity pools can also be used to
245
+ define rules to choose the role for each user based on claims in the user's ID token by using Role Mapping. When using
246
+ role mapping, it's important to be aware of some of the permissions the role will need, and that the least privileged
247
+ roles necessary are given for your specific use case. An in depth
248
+ review of roles and role mapping can be found [here](https://docs.aws.amazon.com/cognito/latest/developerguide/role-based-access-control.html).
249
+
250
+ Using a [token-based approach](https://docs.aws.amazon.com/cognito/latest/developerguide/role-based-access-control.html#using-tokens-to-assign-roles-to-users) to role mapping will allow mapped roles to be passed through the `cognito:roles` or
251
+ `cognito:preferred_role` claims from the identity provider:
252
+
253
+ ```python
254
+ from aws_cdk.aws_cognito_identitypool import IdentityPoolProviderUrl
255
+
256
+
257
+ IdentityPool(self, "myidentitypool",
258
+ identity_pool_name="myidentitypool",
259
+ role_mappings=[IdentityPoolRoleMapping(
260
+ provider_url=IdentityPoolProviderUrl.AMAZON,
261
+ use_token=True
262
+ )]
263
+ )
264
+ ```
265
+
266
+ Using a rule-based approach to role mapping allows roles to be assigned based on custom claims passed from the identity provider:
267
+
268
+ ```python
269
+ from aws_cdk.aws_cognito_identitypool import IdentityPoolProviderUrl, RoleMappingMatchType
270
+
271
+ # admin_role: iam.Role
272
+ # non_admin_role: iam.Role
273
+
274
+ IdentityPool(self, "myidentitypool",
275
+ identity_pool_name="myidentitypool",
276
+ # Assign specific roles to users based on whether or not the custom admin claim is passed from the identity provider
277
+ role_mappings=[IdentityPoolRoleMapping(
278
+ provider_url=IdentityPoolProviderUrl.AMAZON,
279
+ rules=[RoleMappingRule(
280
+ claim="custom:admin",
281
+ claim_value="admin",
282
+ mapped_role=admin_role
283
+ ), RoleMappingRule(
284
+ claim="custom:admin",
285
+ claim_value="admin",
286
+ match_type=RoleMappingMatchType.NOTEQUAL,
287
+ mapped_role=non_admin_role
288
+ )
289
+ ]
290
+ )]
291
+ )
292
+ ```
293
+
294
+ #### Provider Urls
295
+
296
+ Role mappings must be associated with the url of an Identity Provider which can be supplied
297
+ `IdentityPoolProviderUrl`. Supported Providers have static Urls that can be used:
298
+
299
+ ```python
300
+ from aws_cdk.aws_cognito_identitypool import IdentityPoolProviderUrl
301
+
302
+
303
+ IdentityPool(self, "myidentitypool",
304
+ identity_pool_name="myidentitypool",
305
+ role_mappings=[IdentityPoolRoleMapping(
306
+ provider_url=IdentityPoolProviderUrl.FACEBOOK,
307
+ use_token=True
308
+ )]
309
+ )
310
+ ```
311
+
312
+ For identity providers that don't have static Urls, a custom Url can be supplied:
313
+
314
+ ```python
315
+ from aws_cdk.aws_cognito_identitypool import IdentityPoolProviderUrl
316
+
317
+
318
+ IdentityPool(self, "myidentitypool",
319
+ identity_pool_name="myidentitypool",
320
+ role_mappings=[IdentityPoolRoleMapping(
321
+ provider_url=IdentityPoolProviderUrl.custom("my-custom-provider.com"),
322
+ use_token=True
323
+ )
324
+ ]
325
+ )
326
+ ```
327
+
328
+ If a provider URL is a CDK Token, as it will be if you are trying to use a previously defined Cognito User Pool, you will need to also provide a mappingKey.
329
+ This is because by default, the key in the Cloudformation role mapping hash is the providerUrl, and Cloudformation map keys must be concrete strings, they
330
+ cannot be references. For example:
331
+
332
+ ```python
333
+ from aws_cdk.aws_cognito import UserPool, UserPoolClient
334
+ from aws_cdk.aws_cognito_identitypool import IdentityPoolProviderUrl
335
+
336
+ # user_pool: UserPool
337
+ # user_pool_client: UserPoolClient
338
+
339
+ IdentityPool(self, "myidentitypool",
340
+ identity_pool_name="myidentitypool",
341
+ role_mappings=[IdentityPoolRoleMapping(
342
+ mapping_key="cognito",
343
+ provider_url=IdentityPoolProviderUrl.user_pool(user_pool, user_pool_client),
344
+ use_token=True
345
+ )]
346
+ )
347
+ ```
348
+
349
+ See [here](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cognito-identitypoolroleattachment-rolemapping.html#cfn-cognito-identitypoolroleattachment-rolemapping-identityprovider) for more information.
350
+
351
+ ### Authentication Flow
352
+
353
+ Identity Pool [Authentication Flow](https://docs.aws.amazon.com/cognito/latest/developerguide/authentication-flow.html) defaults to the enhanced, simplified flow. The Classic (basic) Authentication Flow
354
+ can also be implemented using `allowClassicFlow`:
355
+
356
+ ```python
357
+ IdentityPool(self, "myidentitypool",
358
+ identity_pool_name="myidentitypool",
359
+ allow_classic_flow=True
360
+ )
361
+ ```
362
+
363
+ ### Cognito Sync
364
+
365
+ It's now recommended to integrate [AWS AppSync](https://aws.amazon.com/appsync/) for synchronizing app data across devices, so
366
+ Cognito Sync features like `PushSync`, `CognitoEvents`, and `CognitoStreams` are not a part of `IdentityPool`. More
367
+ information can be found [here](https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-sync.html).
368
+
369
+ ### Importing Identity Pools
370
+
371
+ You can import existing identity pools into your stack using Identity Pool static methods with the Identity Pool Id or
372
+ Arn:
373
+
374
+ ```python
375
+ IdentityPool.from_identity_pool_id(self, "my-imported-identity-pool", "us-east-1:dj2823ryiwuhef937")
376
+ IdentityPool.from_identity_pool_arn(self, "my-imported-identity-pool", "arn:aws:cognito-identity:us-east-1:123456789012:identitypool/us-east-1:dj2823ryiwuhef937")
377
+ ```
378
+ '''
379
+ from pkgutil import extend_path
380
+ __path__ = extend_path(__path__, __name__)
381
+
382
+ import abc
383
+ import builtins
384
+ import datetime
385
+ import enum
386
+ import typing
387
+
388
+ import jsii
389
+ import publication
390
+ import typing_extensions
391
+
392
+ import typeguard
393
+ from importlib.metadata import version as _metadata_package_version
394
+ TYPEGUARD_MAJOR_VERSION = int(_metadata_package_version('typeguard').split('.')[0])
395
+
396
+ def check_type(argname: str, value: object, expected_type: typing.Any) -> typing.Any:
397
+ if TYPEGUARD_MAJOR_VERSION <= 2:
398
+ return typeguard.check_type(argname=argname, value=value, expected_type=expected_type) # type:ignore
399
+ else:
400
+ if isinstance(value, jsii._reference_map.InterfaceDynamicProxy): # pyright: ignore [reportAttributeAccessIssue]
401
+ pass
402
+ else:
403
+ if TYPEGUARD_MAJOR_VERSION == 3:
404
+ typeguard.config.collection_check_strategy = typeguard.CollectionCheckStrategy.ALL_ITEMS # type:ignore
405
+ typeguard.check_type(value=value, expected_type=expected_type) # type:ignore
406
+ else:
407
+ typeguard.check_type(value=value, expected_type=expected_type, collection_check_strategy=typeguard.CollectionCheckStrategy.ALL_ITEMS) # type:ignore
408
+
409
+ from .._jsii import *
410
+
411
+ import constructs as _constructs_77d1e7e8
412
+ from .. import IResource as _IResource_c80c4260, Resource as _Resource_45bc6135
413
+ from ..aws_cognito import (
414
+ IUserPool as _IUserPool_1f1029e2, IUserPoolClient as _IUserPoolClient_75623ba4
415
+ )
416
+ from ..aws_iam import (
417
+ IOpenIdConnectProvider as _IOpenIdConnectProvider_203f0793,
418
+ IRole as _IRole_235f5d8e,
419
+ ISamlProvider as _ISamlProvider_63f03582,
420
+ )
421
+
422
+
423
+ @jsii.interface(jsii_type="aws-cdk-lib.aws_cognito_identitypool.IIdentityPool")
424
+ class IIdentityPool(_IResource_c80c4260, typing_extensions.Protocol):
425
+ '''Represents a Cognito Identity Pool.'''
426
+
427
+ @builtins.property
428
+ @jsii.member(jsii_name="identityPoolArn")
429
+ def identity_pool_arn(self) -> builtins.str:
430
+ '''The ARN of the Identity Pool.
431
+
432
+ :attribute: true
433
+ '''
434
+ ...
435
+
436
+ @builtins.property
437
+ @jsii.member(jsii_name="identityPoolId")
438
+ def identity_pool_id(self) -> builtins.str:
439
+ '''The ID of the Identity Pool in the format REGION:GUID.
440
+
441
+ :attribute: true
442
+ '''
443
+ ...
444
+
445
+ @builtins.property
446
+ @jsii.member(jsii_name="identityPoolName")
447
+ def identity_pool_name(self) -> builtins.str:
448
+ '''Name of the Identity Pool.
449
+
450
+ :attribute: true
451
+ '''
452
+ ...
453
+
454
+
455
+ class _IIdentityPoolProxy(
456
+ jsii.proxy_for(_IResource_c80c4260), # type: ignore[misc]
457
+ ):
458
+ '''Represents a Cognito Identity Pool.'''
459
+
460
+ __jsii_type__: typing.ClassVar[str] = "aws-cdk-lib.aws_cognito_identitypool.IIdentityPool"
461
+
462
+ @builtins.property
463
+ @jsii.member(jsii_name="identityPoolArn")
464
+ def identity_pool_arn(self) -> builtins.str:
465
+ '''The ARN of the Identity Pool.
466
+
467
+ :attribute: true
468
+ '''
469
+ return typing.cast(builtins.str, jsii.get(self, "identityPoolArn"))
470
+
471
+ @builtins.property
472
+ @jsii.member(jsii_name="identityPoolId")
473
+ def identity_pool_id(self) -> builtins.str:
474
+ '''The ID of the Identity Pool in the format REGION:GUID.
475
+
476
+ :attribute: true
477
+ '''
478
+ return typing.cast(builtins.str, jsii.get(self, "identityPoolId"))
479
+
480
+ @builtins.property
481
+ @jsii.member(jsii_name="identityPoolName")
482
+ def identity_pool_name(self) -> builtins.str:
483
+ '''Name of the Identity Pool.
484
+
485
+ :attribute: true
486
+ '''
487
+ return typing.cast(builtins.str, jsii.get(self, "identityPoolName"))
488
+
489
+ # Adding a "__jsii_proxy_class__(): typing.Type" function to the interface
490
+ typing.cast(typing.Any, IIdentityPool).__jsii_proxy_class__ = lambda : _IIdentityPoolProxy
491
+
492
+
493
+ @jsii.interface(
494
+ jsii_type="aws-cdk-lib.aws_cognito_identitypool.IUserPoolAuthenticationProvider"
495
+ )
496
+ class IUserPoolAuthenticationProvider(typing_extensions.Protocol):
497
+ '''Represents the concept of a User Pool Authentication Provider.
498
+
499
+ You use user pool authentication providers to configure User Pools
500
+ and User Pool Clients for use with Identity Pools
501
+ '''
502
+
503
+ @jsii.member(jsii_name="bind")
504
+ def bind(
505
+ self,
506
+ scope: _constructs_77d1e7e8.Construct,
507
+ identity_pool: IIdentityPool,
508
+ ) -> "UserPoolAuthenticationProviderBindConfig":
509
+ '''The method called when a given User Pool Authentication Provider is added (for the first time) to an Identity Pool.
510
+
511
+ :param scope: -
512
+ :param identity_pool: -
513
+ '''
514
+ ...
515
+
516
+
517
+ class _IUserPoolAuthenticationProviderProxy:
518
+ '''Represents the concept of a User Pool Authentication Provider.
519
+
520
+ You use user pool authentication providers to configure User Pools
521
+ and User Pool Clients for use with Identity Pools
522
+ '''
523
+
524
+ __jsii_type__: typing.ClassVar[str] = "aws-cdk-lib.aws_cognito_identitypool.IUserPoolAuthenticationProvider"
525
+
526
+ @jsii.member(jsii_name="bind")
527
+ def bind(
528
+ self,
529
+ scope: _constructs_77d1e7e8.Construct,
530
+ identity_pool: IIdentityPool,
531
+ ) -> "UserPoolAuthenticationProviderBindConfig":
532
+ '''The method called when a given User Pool Authentication Provider is added (for the first time) to an Identity Pool.
533
+
534
+ :param scope: -
535
+ :param identity_pool: -
536
+ '''
537
+ if __debug__:
538
+ type_hints = typing.get_type_hints(_typecheckingstub__5c814fdc426f731ac5e76cbccdb476b3226db8e3f5c19b9f57f6ed181043dd60)
539
+ check_type(argname="argument scope", value=scope, expected_type=type_hints["scope"])
540
+ check_type(argname="argument identity_pool", value=identity_pool, expected_type=type_hints["identity_pool"])
541
+ options = UserPoolAuthenticationProviderBindOptions()
542
+
543
+ return typing.cast("UserPoolAuthenticationProviderBindConfig", jsii.invoke(self, "bind", [scope, identity_pool, options]))
544
+
545
+ # Adding a "__jsii_proxy_class__(): typing.Type" function to the interface
546
+ typing.cast(typing.Any, IUserPoolAuthenticationProvider).__jsii_proxy_class__ = lambda : _IUserPoolAuthenticationProviderProxy
547
+
548
+
549
+ @jsii.implements(IIdentityPool)
550
+ class IdentityPool(
551
+ _Resource_45bc6135,
552
+ metaclass=jsii.JSIIMeta,
553
+ jsii_type="aws-cdk-lib.aws_cognito_identitypool.IdentityPool",
554
+ ):
555
+ '''Define a Cognito Identity Pool.
556
+
557
+ :resource: AWS::Cognito::IdentityPool
558
+ :exampleMetadata: infused
559
+
560
+ Example::
561
+
562
+ # open_id_connect_provider: iam.OpenIdConnectProvider
563
+
564
+ IdentityPool(self, "myidentitypool",
565
+ identity_pool_name="myidentitypool",
566
+ authentication_providers=IdentityPoolAuthenticationProviders(
567
+ google=IdentityPoolGoogleLoginProvider(
568
+ client_id="12345678012.apps.googleusercontent.com"
569
+ ),
570
+ open_id_connect_providers=[open_id_connect_provider],
571
+ custom_provider="my-custom-provider.example.com"
572
+ )
573
+ )
574
+ '''
575
+
576
+ def __init__(
577
+ self,
578
+ scope: _constructs_77d1e7e8.Construct,
579
+ id: builtins.str,
580
+ *,
581
+ allow_classic_flow: typing.Optional[builtins.bool] = None,
582
+ allow_unauthenticated_identities: typing.Optional[builtins.bool] = None,
583
+ authenticated_role: typing.Optional[_IRole_235f5d8e] = None,
584
+ authentication_providers: typing.Optional[typing.Union["IdentityPoolAuthenticationProviders", typing.Dict[builtins.str, typing.Any]]] = None,
585
+ identity_pool_name: typing.Optional[builtins.str] = None,
586
+ role_mappings: typing.Optional[typing.Sequence[typing.Union["IdentityPoolRoleMapping", typing.Dict[builtins.str, typing.Any]]]] = None,
587
+ unauthenticated_role: typing.Optional[_IRole_235f5d8e] = None,
588
+ ) -> None:
589
+ '''
590
+ :param scope: -
591
+ :param id: -
592
+ :param allow_classic_flow: Enables the Basic (Classic) authentication flow. Default: - Classic Flow not allowed
593
+ :param allow_unauthenticated_identities: Whether the Identity Pool supports unauthenticated logins. Default: - false
594
+ :param authenticated_role: The default Role to be assumed by authenticated users. Default: - A default authenticated Role will be added
595
+ :param authentication_providers: Authentication Providers for using in Identity Pool. Default: - No Authentication Providers passed directly to Identity Pool
596
+ :param identity_pool_name: The name of the Identity Pool. Default: - Automatically generated name by CloudFormation at deploy time
597
+ :param role_mappings: Rules for mapping roles to users. Default: - no role mappings
598
+ :param unauthenticated_role: The default Role to be assumed by unauthenticated users. Default: - A default unauthenticated Role will be added
599
+ '''
600
+ if __debug__:
601
+ type_hints = typing.get_type_hints(_typecheckingstub__a7508ece930af8922e09956e6b9166bbdbf4f94d0b43649c6d1c63f6bd90fc80)
602
+ check_type(argname="argument scope", value=scope, expected_type=type_hints["scope"])
603
+ check_type(argname="argument id", value=id, expected_type=type_hints["id"])
604
+ props = IdentityPoolProps(
605
+ allow_classic_flow=allow_classic_flow,
606
+ allow_unauthenticated_identities=allow_unauthenticated_identities,
607
+ authenticated_role=authenticated_role,
608
+ authentication_providers=authentication_providers,
609
+ identity_pool_name=identity_pool_name,
610
+ role_mappings=role_mappings,
611
+ unauthenticated_role=unauthenticated_role,
612
+ )
613
+
614
+ jsii.create(self.__class__, self, [scope, id, props])
615
+
616
+ @jsii.member(jsii_name="fromIdentityPoolArn")
617
+ @builtins.classmethod
618
+ def from_identity_pool_arn(
619
+ cls,
620
+ scope: _constructs_77d1e7e8.Construct,
621
+ id: builtins.str,
622
+ identity_pool_arn: builtins.str,
623
+ ) -> IIdentityPool:
624
+ '''Import an existing Identity Pool from its ARN.
625
+
626
+ :param scope: -
627
+ :param id: -
628
+ :param identity_pool_arn: -
629
+ '''
630
+ if __debug__:
631
+ type_hints = typing.get_type_hints(_typecheckingstub__3173746cd04dd07f081f1f960cd91b67ec8367052f383c0ed193eaf98bcf47c6)
632
+ check_type(argname="argument scope", value=scope, expected_type=type_hints["scope"])
633
+ check_type(argname="argument id", value=id, expected_type=type_hints["id"])
634
+ check_type(argname="argument identity_pool_arn", value=identity_pool_arn, expected_type=type_hints["identity_pool_arn"])
635
+ return typing.cast(IIdentityPool, jsii.sinvoke(cls, "fromIdentityPoolArn", [scope, id, identity_pool_arn]))
636
+
637
+ @jsii.member(jsii_name="fromIdentityPoolId")
638
+ @builtins.classmethod
639
+ def from_identity_pool_id(
640
+ cls,
641
+ scope: _constructs_77d1e7e8.Construct,
642
+ id: builtins.str,
643
+ identity_pool_id: builtins.str,
644
+ ) -> IIdentityPool:
645
+ '''Import an existing Identity Pool from its ID.
646
+
647
+ :param scope: -
648
+ :param id: -
649
+ :param identity_pool_id: -
650
+ '''
651
+ if __debug__:
652
+ type_hints = typing.get_type_hints(_typecheckingstub__b7094f2ba90c5fab8d158b4276f0bc0876fb3f0e3dd42cafa6fb6cb1e02a6893)
653
+ check_type(argname="argument scope", value=scope, expected_type=type_hints["scope"])
654
+ check_type(argname="argument id", value=id, expected_type=type_hints["id"])
655
+ check_type(argname="argument identity_pool_id", value=identity_pool_id, expected_type=type_hints["identity_pool_id"])
656
+ return typing.cast(IIdentityPool, jsii.sinvoke(cls, "fromIdentityPoolId", [scope, id, identity_pool_id]))
657
+
658
+ @jsii.member(jsii_name="addUserPoolAuthentication")
659
+ def add_user_pool_authentication(
660
+ self,
661
+ user_pool: IUserPoolAuthenticationProvider,
662
+ ) -> None:
663
+ '''Add a User Pool to the Identity Pool and configure the User Pool client to handle identities.
664
+
665
+ :param user_pool: -
666
+ '''
667
+ if __debug__:
668
+ type_hints = typing.get_type_hints(_typecheckingstub__fd6d23271053899a9cf9a7ec303ccebbcc3f4c4aa45de84fb3586658a176cb3a)
669
+ check_type(argname="argument user_pool", value=user_pool, expected_type=type_hints["user_pool"])
670
+ return typing.cast(None, jsii.invoke(self, "addUserPoolAuthentication", [user_pool]))
671
+
672
+ @builtins.property
673
+ @jsii.member(jsii_name="authenticatedRole")
674
+ def authenticated_role(self) -> _IRole_235f5d8e:
675
+ '''Default Role for authenticated users.'''
676
+ return typing.cast(_IRole_235f5d8e, jsii.get(self, "authenticatedRole"))
677
+
678
+ @builtins.property
679
+ @jsii.member(jsii_name="identityPoolArn")
680
+ def identity_pool_arn(self) -> builtins.str:
681
+ '''The ARN of the Identity Pool.
682
+
683
+ :attribute: true
684
+ '''
685
+ return typing.cast(builtins.str, jsii.get(self, "identityPoolArn"))
686
+
687
+ @builtins.property
688
+ @jsii.member(jsii_name="identityPoolId")
689
+ def identity_pool_id(self) -> builtins.str:
690
+ '''The ID of the Identity Pool in the format REGION:GUID.
691
+
692
+ :attribute: true
693
+ '''
694
+ return typing.cast(builtins.str, jsii.get(self, "identityPoolId"))
695
+
696
+ @builtins.property
697
+ @jsii.member(jsii_name="identityPoolName")
698
+ def identity_pool_name(self) -> builtins.str:
699
+ '''The name of the Identity Pool.
700
+
701
+ :attribute: true
702
+ '''
703
+ return typing.cast(builtins.str, jsii.get(self, "identityPoolName"))
704
+
705
+ @builtins.property
706
+ @jsii.member(jsii_name="unauthenticatedRole")
707
+ def unauthenticated_role(self) -> _IRole_235f5d8e:
708
+ '''Default Role for unauthenticated users.'''
709
+ return typing.cast(_IRole_235f5d8e, jsii.get(self, "unauthenticatedRole"))
710
+
711
+
712
+ @jsii.data_type(
713
+ jsii_type="aws-cdk-lib.aws_cognito_identitypool.IdentityPoolAmazonLoginProvider",
714
+ jsii_struct_bases=[],
715
+ name_mapping={"app_id": "appId"},
716
+ )
717
+ class IdentityPoolAmazonLoginProvider:
718
+ def __init__(self, *, app_id: builtins.str) -> None:
719
+ '''Login Provider for identity federation using Amazon credentials.
720
+
721
+ :param app_id: App ID for Amazon identity federation.
722
+
723
+ :exampleMetadata: infused
724
+
725
+ Example::
726
+
727
+ IdentityPool(self, "myidentitypool",
728
+ identity_pool_name="myidentitypool",
729
+ authentication_providers=IdentityPoolAuthenticationProviders(
730
+ amazon=IdentityPoolAmazonLoginProvider(
731
+ app_id="amzn1.application.12312k3j234j13rjiwuenf"
732
+ ),
733
+ facebook=IdentityPoolFacebookLoginProvider(
734
+ app_id="1234567890123"
735
+ ),
736
+ google=IdentityPoolGoogleLoginProvider(
737
+ client_id="12345678012.apps.googleusercontent.com"
738
+ ),
739
+ apple=IdentityPoolAppleLoginProvider(
740
+ services_id="com.myappleapp.auth"
741
+ ),
742
+ twitter=IdentityPoolTwitterLoginProvider(
743
+ consumer_key="my-twitter-id",
744
+ consumer_secret="my-twitter-secret"
745
+ )
746
+ )
747
+ )
748
+ '''
749
+ if __debug__:
750
+ type_hints = typing.get_type_hints(_typecheckingstub__469abe646a9b1de4f31f3b04632a02d728f0da52b1c7b2fb1c31b02e48ab80b9)
751
+ check_type(argname="argument app_id", value=app_id, expected_type=type_hints["app_id"])
752
+ self._values: typing.Dict[builtins.str, typing.Any] = {
753
+ "app_id": app_id,
754
+ }
755
+
756
+ @builtins.property
757
+ def app_id(self) -> builtins.str:
758
+ '''App ID for Amazon identity federation.'''
759
+ result = self._values.get("app_id")
760
+ assert result is not None, "Required property 'app_id' is missing"
761
+ return typing.cast(builtins.str, result)
762
+
763
+ def __eq__(self, rhs: typing.Any) -> builtins.bool:
764
+ return isinstance(rhs, self.__class__) and rhs._values == self._values
765
+
766
+ def __ne__(self, rhs: typing.Any) -> builtins.bool:
767
+ return not (rhs == self)
768
+
769
+ def __repr__(self) -> str:
770
+ return "IdentityPoolAmazonLoginProvider(%s)" % ", ".join(
771
+ k + "=" + repr(v) for k, v in self._values.items()
772
+ )
773
+
774
+
775
+ @jsii.data_type(
776
+ jsii_type="aws-cdk-lib.aws_cognito_identitypool.IdentityPoolAppleLoginProvider",
777
+ jsii_struct_bases=[],
778
+ name_mapping={"services_id": "servicesId"},
779
+ )
780
+ class IdentityPoolAppleLoginProvider:
781
+ def __init__(self, *, services_id: builtins.str) -> None:
782
+ '''Login Provider for identity federation using Apple credentials.
783
+
784
+ :param services_id: Services ID for Apple identity federation.
785
+
786
+ :exampleMetadata: infused
787
+
788
+ Example::
789
+
790
+ IdentityPool(self, "myidentitypool",
791
+ identity_pool_name="myidentitypool",
792
+ authentication_providers=IdentityPoolAuthenticationProviders(
793
+ amazon=IdentityPoolAmazonLoginProvider(
794
+ app_id="amzn1.application.12312k3j234j13rjiwuenf"
795
+ ),
796
+ facebook=IdentityPoolFacebookLoginProvider(
797
+ app_id="1234567890123"
798
+ ),
799
+ google=IdentityPoolGoogleLoginProvider(
800
+ client_id="12345678012.apps.googleusercontent.com"
801
+ ),
802
+ apple=IdentityPoolAppleLoginProvider(
803
+ services_id="com.myappleapp.auth"
804
+ ),
805
+ twitter=IdentityPoolTwitterLoginProvider(
806
+ consumer_key="my-twitter-id",
807
+ consumer_secret="my-twitter-secret"
808
+ )
809
+ )
810
+ )
811
+ '''
812
+ if __debug__:
813
+ type_hints = typing.get_type_hints(_typecheckingstub__e9b4447874c9fdd7fed07df178fcf069b944be0d670ec52b85e362202ed6ca80)
814
+ check_type(argname="argument services_id", value=services_id, expected_type=type_hints["services_id"])
815
+ self._values: typing.Dict[builtins.str, typing.Any] = {
816
+ "services_id": services_id,
817
+ }
818
+
819
+ @builtins.property
820
+ def services_id(self) -> builtins.str:
821
+ '''Services ID for Apple identity federation.'''
822
+ result = self._values.get("services_id")
823
+ assert result is not None, "Required property 'services_id' is missing"
824
+ return typing.cast(builtins.str, result)
825
+
826
+ def __eq__(self, rhs: typing.Any) -> builtins.bool:
827
+ return isinstance(rhs, self.__class__) and rhs._values == self._values
828
+
829
+ def __ne__(self, rhs: typing.Any) -> builtins.bool:
830
+ return not (rhs == self)
831
+
832
+ def __repr__(self) -> str:
833
+ return "IdentityPoolAppleLoginProvider(%s)" % ", ".join(
834
+ k + "=" + repr(v) for k, v in self._values.items()
835
+ )
836
+
837
+
838
+ @jsii.data_type(
839
+ jsii_type="aws-cdk-lib.aws_cognito_identitypool.IdentityPoolAuthenticationProviders",
840
+ jsii_struct_bases=[],
841
+ name_mapping={
842
+ "amazon": "amazon",
843
+ "apple": "apple",
844
+ "custom_provider": "customProvider",
845
+ "facebook": "facebook",
846
+ "google": "google",
847
+ "open_id_connect_providers": "openIdConnectProviders",
848
+ "saml_providers": "samlProviders",
849
+ "twitter": "twitter",
850
+ "user_pools": "userPools",
851
+ },
852
+ )
853
+ class IdentityPoolAuthenticationProviders:
854
+ def __init__(
855
+ self,
856
+ *,
857
+ amazon: typing.Optional[typing.Union[IdentityPoolAmazonLoginProvider, typing.Dict[builtins.str, typing.Any]]] = None,
858
+ apple: typing.Optional[typing.Union[IdentityPoolAppleLoginProvider, typing.Dict[builtins.str, typing.Any]]] = None,
859
+ custom_provider: typing.Optional[builtins.str] = None,
860
+ facebook: typing.Optional[typing.Union["IdentityPoolFacebookLoginProvider", typing.Dict[builtins.str, typing.Any]]] = None,
861
+ google: typing.Optional[typing.Union["IdentityPoolGoogleLoginProvider", typing.Dict[builtins.str, typing.Any]]] = None,
862
+ open_id_connect_providers: typing.Optional[typing.Sequence[_IOpenIdConnectProvider_203f0793]] = None,
863
+ saml_providers: typing.Optional[typing.Sequence[_ISamlProvider_63f03582]] = None,
864
+ twitter: typing.Optional[typing.Union["IdentityPoolTwitterLoginProvider", typing.Dict[builtins.str, typing.Any]]] = None,
865
+ user_pools: typing.Optional[typing.Sequence[IUserPoolAuthenticationProvider]] = None,
866
+ ) -> None:
867
+ '''External Authentication Providers for usage in Identity Pool.
868
+
869
+ :param amazon: The Amazon Authentication Provider associated with this Identity Pool. Default: - No Amazon Authentication Provider used without OpenIdConnect or a User Pool
870
+ :param apple: The Apple Authentication Provider associated with this Identity Pool. Default: - No Apple Authentication Provider used without OpenIdConnect or a User Pool
871
+ :param custom_provider: The developer provider name to associate with this Identity Pool. Default: - no custom provider
872
+ :param facebook: The Facebook Authentication Provider associated with this Identity Pool. Default: - No Facebook Authentication Provider used without OpenIdConnect or a User Pool
873
+ :param google: The Google Authentication Provider associated with this Identity Pool. Default: - No Google Authentication Provider used without OpenIdConnect or a User Pool
874
+ :param open_id_connect_providers: The OpenIdConnect Provider associated with this Identity Pool. Default: - no OpenIdConnectProvider
875
+ :param saml_providers: The Security Assertion Markup Language provider associated with this Identity Pool. Default: - no SamlProvider
876
+ :param twitter: The Twitter Authentication Provider associated with this Identity Pool. Default: - No Twitter Authentication Provider used without OpenIdConnect or a User Pool
877
+ :param user_pools: The User Pool Authentication Providers associated with this Identity Pool. Default: - no User Pools associated
878
+
879
+ :see: https://docs.aws.amazon.com/cognito/latest/developerguide/external-identity-providers.html
880
+ :exampleMetadata: infused
881
+
882
+ Example::
883
+
884
+ # open_id_connect_provider: iam.OpenIdConnectProvider
885
+
886
+ IdentityPool(self, "myidentitypool",
887
+ identity_pool_name="myidentitypool",
888
+ authentication_providers=IdentityPoolAuthenticationProviders(
889
+ google=IdentityPoolGoogleLoginProvider(
890
+ client_id="12345678012.apps.googleusercontent.com"
891
+ ),
892
+ open_id_connect_providers=[open_id_connect_provider],
893
+ custom_provider="my-custom-provider.example.com"
894
+ )
895
+ )
896
+ '''
897
+ if isinstance(amazon, dict):
898
+ amazon = IdentityPoolAmazonLoginProvider(**amazon)
899
+ if isinstance(apple, dict):
900
+ apple = IdentityPoolAppleLoginProvider(**apple)
901
+ if isinstance(facebook, dict):
902
+ facebook = IdentityPoolFacebookLoginProvider(**facebook)
903
+ if isinstance(google, dict):
904
+ google = IdentityPoolGoogleLoginProvider(**google)
905
+ if isinstance(twitter, dict):
906
+ twitter = IdentityPoolTwitterLoginProvider(**twitter)
907
+ if __debug__:
908
+ type_hints = typing.get_type_hints(_typecheckingstub__e5736f06974c68519c1ae6c3b7a96f6631b848c6e335b1b26878af4283639ee6)
909
+ check_type(argname="argument amazon", value=amazon, expected_type=type_hints["amazon"])
910
+ check_type(argname="argument apple", value=apple, expected_type=type_hints["apple"])
911
+ check_type(argname="argument custom_provider", value=custom_provider, expected_type=type_hints["custom_provider"])
912
+ check_type(argname="argument facebook", value=facebook, expected_type=type_hints["facebook"])
913
+ check_type(argname="argument google", value=google, expected_type=type_hints["google"])
914
+ check_type(argname="argument open_id_connect_providers", value=open_id_connect_providers, expected_type=type_hints["open_id_connect_providers"])
915
+ check_type(argname="argument saml_providers", value=saml_providers, expected_type=type_hints["saml_providers"])
916
+ check_type(argname="argument twitter", value=twitter, expected_type=type_hints["twitter"])
917
+ check_type(argname="argument user_pools", value=user_pools, expected_type=type_hints["user_pools"])
918
+ self._values: typing.Dict[builtins.str, typing.Any] = {}
919
+ if amazon is not None:
920
+ self._values["amazon"] = amazon
921
+ if apple is not None:
922
+ self._values["apple"] = apple
923
+ if custom_provider is not None:
924
+ self._values["custom_provider"] = custom_provider
925
+ if facebook is not None:
926
+ self._values["facebook"] = facebook
927
+ if google is not None:
928
+ self._values["google"] = google
929
+ if open_id_connect_providers is not None:
930
+ self._values["open_id_connect_providers"] = open_id_connect_providers
931
+ if saml_providers is not None:
932
+ self._values["saml_providers"] = saml_providers
933
+ if twitter is not None:
934
+ self._values["twitter"] = twitter
935
+ if user_pools is not None:
936
+ self._values["user_pools"] = user_pools
937
+
938
+ @builtins.property
939
+ def amazon(self) -> typing.Optional[IdentityPoolAmazonLoginProvider]:
940
+ '''The Amazon Authentication Provider associated with this Identity Pool.
941
+
942
+ :default: - No Amazon Authentication Provider used without OpenIdConnect or a User Pool
943
+ '''
944
+ result = self._values.get("amazon")
945
+ return typing.cast(typing.Optional[IdentityPoolAmazonLoginProvider], result)
946
+
947
+ @builtins.property
948
+ def apple(self) -> typing.Optional[IdentityPoolAppleLoginProvider]:
949
+ '''The Apple Authentication Provider associated with this Identity Pool.
950
+
951
+ :default: - No Apple Authentication Provider used without OpenIdConnect or a User Pool
952
+ '''
953
+ result = self._values.get("apple")
954
+ return typing.cast(typing.Optional[IdentityPoolAppleLoginProvider], result)
955
+
956
+ @builtins.property
957
+ def custom_provider(self) -> typing.Optional[builtins.str]:
958
+ '''The developer provider name to associate with this Identity Pool.
959
+
960
+ :default: - no custom provider
961
+ '''
962
+ result = self._values.get("custom_provider")
963
+ return typing.cast(typing.Optional[builtins.str], result)
964
+
965
+ @builtins.property
966
+ def facebook(self) -> typing.Optional["IdentityPoolFacebookLoginProvider"]:
967
+ '''The Facebook Authentication Provider associated with this Identity Pool.
968
+
969
+ :default: - No Facebook Authentication Provider used without OpenIdConnect or a User Pool
970
+ '''
971
+ result = self._values.get("facebook")
972
+ return typing.cast(typing.Optional["IdentityPoolFacebookLoginProvider"], result)
973
+
974
+ @builtins.property
975
+ def google(self) -> typing.Optional["IdentityPoolGoogleLoginProvider"]:
976
+ '''The Google Authentication Provider associated with this Identity Pool.
977
+
978
+ :default: - No Google Authentication Provider used without OpenIdConnect or a User Pool
979
+ '''
980
+ result = self._values.get("google")
981
+ return typing.cast(typing.Optional["IdentityPoolGoogleLoginProvider"], result)
982
+
983
+ @builtins.property
984
+ def open_id_connect_providers(
985
+ self,
986
+ ) -> typing.Optional[typing.List[_IOpenIdConnectProvider_203f0793]]:
987
+ '''The OpenIdConnect Provider associated with this Identity Pool.
988
+
989
+ :default: - no OpenIdConnectProvider
990
+ '''
991
+ result = self._values.get("open_id_connect_providers")
992
+ return typing.cast(typing.Optional[typing.List[_IOpenIdConnectProvider_203f0793]], result)
993
+
994
+ @builtins.property
995
+ def saml_providers(self) -> typing.Optional[typing.List[_ISamlProvider_63f03582]]:
996
+ '''The Security Assertion Markup Language provider associated with this Identity Pool.
997
+
998
+ :default: - no SamlProvider
999
+ '''
1000
+ result = self._values.get("saml_providers")
1001
+ return typing.cast(typing.Optional[typing.List[_ISamlProvider_63f03582]], result)
1002
+
1003
+ @builtins.property
1004
+ def twitter(self) -> typing.Optional["IdentityPoolTwitterLoginProvider"]:
1005
+ '''The Twitter Authentication Provider associated with this Identity Pool.
1006
+
1007
+ :default: - No Twitter Authentication Provider used without OpenIdConnect or a User Pool
1008
+ '''
1009
+ result = self._values.get("twitter")
1010
+ return typing.cast(typing.Optional["IdentityPoolTwitterLoginProvider"], result)
1011
+
1012
+ @builtins.property
1013
+ def user_pools(
1014
+ self,
1015
+ ) -> typing.Optional[typing.List[IUserPoolAuthenticationProvider]]:
1016
+ '''The User Pool Authentication Providers associated with this Identity Pool.
1017
+
1018
+ :default: - no User Pools associated
1019
+ '''
1020
+ result = self._values.get("user_pools")
1021
+ return typing.cast(typing.Optional[typing.List[IUserPoolAuthenticationProvider]], result)
1022
+
1023
+ def __eq__(self, rhs: typing.Any) -> builtins.bool:
1024
+ return isinstance(rhs, self.__class__) and rhs._values == self._values
1025
+
1026
+ def __ne__(self, rhs: typing.Any) -> builtins.bool:
1027
+ return not (rhs == self)
1028
+
1029
+ def __repr__(self) -> str:
1030
+ return "IdentityPoolAuthenticationProviders(%s)" % ", ".join(
1031
+ k + "=" + repr(v) for k, v in self._values.items()
1032
+ )
1033
+
1034
+
1035
+ @jsii.data_type(
1036
+ jsii_type="aws-cdk-lib.aws_cognito_identitypool.IdentityPoolFacebookLoginProvider",
1037
+ jsii_struct_bases=[],
1038
+ name_mapping={"app_id": "appId"},
1039
+ )
1040
+ class IdentityPoolFacebookLoginProvider:
1041
+ def __init__(self, *, app_id: builtins.str) -> None:
1042
+ '''Login Provider for identity federation using Facebook credentials.
1043
+
1044
+ :param app_id: App ID for Facebook identity federation.
1045
+
1046
+ :exampleMetadata: infused
1047
+
1048
+ Example::
1049
+
1050
+ IdentityPool(self, "myidentitypool",
1051
+ identity_pool_name="myidentitypool",
1052
+ authentication_providers=IdentityPoolAuthenticationProviders(
1053
+ amazon=IdentityPoolAmazonLoginProvider(
1054
+ app_id="amzn1.application.12312k3j234j13rjiwuenf"
1055
+ ),
1056
+ facebook=IdentityPoolFacebookLoginProvider(
1057
+ app_id="1234567890123"
1058
+ ),
1059
+ google=IdentityPoolGoogleLoginProvider(
1060
+ client_id="12345678012.apps.googleusercontent.com"
1061
+ ),
1062
+ apple=IdentityPoolAppleLoginProvider(
1063
+ services_id="com.myappleapp.auth"
1064
+ ),
1065
+ twitter=IdentityPoolTwitterLoginProvider(
1066
+ consumer_key="my-twitter-id",
1067
+ consumer_secret="my-twitter-secret"
1068
+ )
1069
+ )
1070
+ )
1071
+ '''
1072
+ if __debug__:
1073
+ type_hints = typing.get_type_hints(_typecheckingstub__79f268d6507a7ea842aa4eecfa40a33ff4b75964393a3608ad305361f40fbfa4)
1074
+ check_type(argname="argument app_id", value=app_id, expected_type=type_hints["app_id"])
1075
+ self._values: typing.Dict[builtins.str, typing.Any] = {
1076
+ "app_id": app_id,
1077
+ }
1078
+
1079
+ @builtins.property
1080
+ def app_id(self) -> builtins.str:
1081
+ '''App ID for Facebook identity federation.'''
1082
+ result = self._values.get("app_id")
1083
+ assert result is not None, "Required property 'app_id' is missing"
1084
+ return typing.cast(builtins.str, result)
1085
+
1086
+ def __eq__(self, rhs: typing.Any) -> builtins.bool:
1087
+ return isinstance(rhs, self.__class__) and rhs._values == self._values
1088
+
1089
+ def __ne__(self, rhs: typing.Any) -> builtins.bool:
1090
+ return not (rhs == self)
1091
+
1092
+ def __repr__(self) -> str:
1093
+ return "IdentityPoolFacebookLoginProvider(%s)" % ", ".join(
1094
+ k + "=" + repr(v) for k, v in self._values.items()
1095
+ )
1096
+
1097
+
1098
+ @jsii.data_type(
1099
+ jsii_type="aws-cdk-lib.aws_cognito_identitypool.IdentityPoolGoogleLoginProvider",
1100
+ jsii_struct_bases=[],
1101
+ name_mapping={"client_id": "clientId"},
1102
+ )
1103
+ class IdentityPoolGoogleLoginProvider:
1104
+ def __init__(self, *, client_id: builtins.str) -> None:
1105
+ '''Login Provider for identity federation using Google credentials.
1106
+
1107
+ :param client_id: Client ID for Google identity federation.
1108
+
1109
+ :exampleMetadata: infused
1110
+
1111
+ Example::
1112
+
1113
+ IdentityPool(self, "myidentitypool",
1114
+ identity_pool_name="myidentitypool",
1115
+ authentication_providers=IdentityPoolAuthenticationProviders(
1116
+ amazon=IdentityPoolAmazonLoginProvider(
1117
+ app_id="amzn1.application.12312k3j234j13rjiwuenf"
1118
+ ),
1119
+ facebook=IdentityPoolFacebookLoginProvider(
1120
+ app_id="1234567890123"
1121
+ ),
1122
+ google=IdentityPoolGoogleLoginProvider(
1123
+ client_id="12345678012.apps.googleusercontent.com"
1124
+ ),
1125
+ apple=IdentityPoolAppleLoginProvider(
1126
+ services_id="com.myappleapp.auth"
1127
+ ),
1128
+ twitter=IdentityPoolTwitterLoginProvider(
1129
+ consumer_key="my-twitter-id",
1130
+ consumer_secret="my-twitter-secret"
1131
+ )
1132
+ )
1133
+ )
1134
+ '''
1135
+ if __debug__:
1136
+ type_hints = typing.get_type_hints(_typecheckingstub__7cf50453dd8eb6086b031602235511412f140c8a0fd75af98cf94efd203caf0c)
1137
+ check_type(argname="argument client_id", value=client_id, expected_type=type_hints["client_id"])
1138
+ self._values: typing.Dict[builtins.str, typing.Any] = {
1139
+ "client_id": client_id,
1140
+ }
1141
+
1142
+ @builtins.property
1143
+ def client_id(self) -> builtins.str:
1144
+ '''Client ID for Google identity federation.'''
1145
+ result = self._values.get("client_id")
1146
+ assert result is not None, "Required property 'client_id' is missing"
1147
+ return typing.cast(builtins.str, result)
1148
+
1149
+ def __eq__(self, rhs: typing.Any) -> builtins.bool:
1150
+ return isinstance(rhs, self.__class__) and rhs._values == self._values
1151
+
1152
+ def __ne__(self, rhs: typing.Any) -> builtins.bool:
1153
+ return not (rhs == self)
1154
+
1155
+ def __repr__(self) -> str:
1156
+ return "IdentityPoolGoogleLoginProvider(%s)" % ", ".join(
1157
+ k + "=" + repr(v) for k, v in self._values.items()
1158
+ )
1159
+
1160
+
1161
+ @jsii.data_type(
1162
+ jsii_type="aws-cdk-lib.aws_cognito_identitypool.IdentityPoolProps",
1163
+ jsii_struct_bases=[],
1164
+ name_mapping={
1165
+ "allow_classic_flow": "allowClassicFlow",
1166
+ "allow_unauthenticated_identities": "allowUnauthenticatedIdentities",
1167
+ "authenticated_role": "authenticatedRole",
1168
+ "authentication_providers": "authenticationProviders",
1169
+ "identity_pool_name": "identityPoolName",
1170
+ "role_mappings": "roleMappings",
1171
+ "unauthenticated_role": "unauthenticatedRole",
1172
+ },
1173
+ )
1174
+ class IdentityPoolProps:
1175
+ def __init__(
1176
+ self,
1177
+ *,
1178
+ allow_classic_flow: typing.Optional[builtins.bool] = None,
1179
+ allow_unauthenticated_identities: typing.Optional[builtins.bool] = None,
1180
+ authenticated_role: typing.Optional[_IRole_235f5d8e] = None,
1181
+ authentication_providers: typing.Optional[typing.Union[IdentityPoolAuthenticationProviders, typing.Dict[builtins.str, typing.Any]]] = None,
1182
+ identity_pool_name: typing.Optional[builtins.str] = None,
1183
+ role_mappings: typing.Optional[typing.Sequence[typing.Union["IdentityPoolRoleMapping", typing.Dict[builtins.str, typing.Any]]]] = None,
1184
+ unauthenticated_role: typing.Optional[_IRole_235f5d8e] = None,
1185
+ ) -> None:
1186
+ '''Props for the Identity Pool construct.
1187
+
1188
+ :param allow_classic_flow: Enables the Basic (Classic) authentication flow. Default: - Classic Flow not allowed
1189
+ :param allow_unauthenticated_identities: Whether the Identity Pool supports unauthenticated logins. Default: - false
1190
+ :param authenticated_role: The default Role to be assumed by authenticated users. Default: - A default authenticated Role will be added
1191
+ :param authentication_providers: Authentication Providers for using in Identity Pool. Default: - No Authentication Providers passed directly to Identity Pool
1192
+ :param identity_pool_name: The name of the Identity Pool. Default: - Automatically generated name by CloudFormation at deploy time
1193
+ :param role_mappings: Rules for mapping roles to users. Default: - no role mappings
1194
+ :param unauthenticated_role: The default Role to be assumed by unauthenticated users. Default: - A default unauthenticated Role will be added
1195
+
1196
+ :exampleMetadata: infused
1197
+
1198
+ Example::
1199
+
1200
+ # open_id_connect_provider: iam.OpenIdConnectProvider
1201
+
1202
+ IdentityPool(self, "myidentitypool",
1203
+ identity_pool_name="myidentitypool",
1204
+ authentication_providers=IdentityPoolAuthenticationProviders(
1205
+ google=IdentityPoolGoogleLoginProvider(
1206
+ client_id="12345678012.apps.googleusercontent.com"
1207
+ ),
1208
+ open_id_connect_providers=[open_id_connect_provider],
1209
+ custom_provider="my-custom-provider.example.com"
1210
+ )
1211
+ )
1212
+ '''
1213
+ if isinstance(authentication_providers, dict):
1214
+ authentication_providers = IdentityPoolAuthenticationProviders(**authentication_providers)
1215
+ if __debug__:
1216
+ type_hints = typing.get_type_hints(_typecheckingstub__af198fbf56ac885d5c6c92255ff0143c4ee67b99a01cce4cfb3113296d3d7265)
1217
+ check_type(argname="argument allow_classic_flow", value=allow_classic_flow, expected_type=type_hints["allow_classic_flow"])
1218
+ check_type(argname="argument allow_unauthenticated_identities", value=allow_unauthenticated_identities, expected_type=type_hints["allow_unauthenticated_identities"])
1219
+ check_type(argname="argument authenticated_role", value=authenticated_role, expected_type=type_hints["authenticated_role"])
1220
+ check_type(argname="argument authentication_providers", value=authentication_providers, expected_type=type_hints["authentication_providers"])
1221
+ check_type(argname="argument identity_pool_name", value=identity_pool_name, expected_type=type_hints["identity_pool_name"])
1222
+ check_type(argname="argument role_mappings", value=role_mappings, expected_type=type_hints["role_mappings"])
1223
+ check_type(argname="argument unauthenticated_role", value=unauthenticated_role, expected_type=type_hints["unauthenticated_role"])
1224
+ self._values: typing.Dict[builtins.str, typing.Any] = {}
1225
+ if allow_classic_flow is not None:
1226
+ self._values["allow_classic_flow"] = allow_classic_flow
1227
+ if allow_unauthenticated_identities is not None:
1228
+ self._values["allow_unauthenticated_identities"] = allow_unauthenticated_identities
1229
+ if authenticated_role is not None:
1230
+ self._values["authenticated_role"] = authenticated_role
1231
+ if authentication_providers is not None:
1232
+ self._values["authentication_providers"] = authentication_providers
1233
+ if identity_pool_name is not None:
1234
+ self._values["identity_pool_name"] = identity_pool_name
1235
+ if role_mappings is not None:
1236
+ self._values["role_mappings"] = role_mappings
1237
+ if unauthenticated_role is not None:
1238
+ self._values["unauthenticated_role"] = unauthenticated_role
1239
+
1240
+ @builtins.property
1241
+ def allow_classic_flow(self) -> typing.Optional[builtins.bool]:
1242
+ '''Enables the Basic (Classic) authentication flow.
1243
+
1244
+ :default: - Classic Flow not allowed
1245
+ '''
1246
+ result = self._values.get("allow_classic_flow")
1247
+ return typing.cast(typing.Optional[builtins.bool], result)
1248
+
1249
+ @builtins.property
1250
+ def allow_unauthenticated_identities(self) -> typing.Optional[builtins.bool]:
1251
+ '''Whether the Identity Pool supports unauthenticated logins.
1252
+
1253
+ :default: - false
1254
+ '''
1255
+ result = self._values.get("allow_unauthenticated_identities")
1256
+ return typing.cast(typing.Optional[builtins.bool], result)
1257
+
1258
+ @builtins.property
1259
+ def authenticated_role(self) -> typing.Optional[_IRole_235f5d8e]:
1260
+ '''The default Role to be assumed by authenticated users.
1261
+
1262
+ :default: - A default authenticated Role will be added
1263
+ '''
1264
+ result = self._values.get("authenticated_role")
1265
+ return typing.cast(typing.Optional[_IRole_235f5d8e], result)
1266
+
1267
+ @builtins.property
1268
+ def authentication_providers(
1269
+ self,
1270
+ ) -> typing.Optional[IdentityPoolAuthenticationProviders]:
1271
+ '''Authentication Providers for using in Identity Pool.
1272
+
1273
+ :default: - No Authentication Providers passed directly to Identity Pool
1274
+ '''
1275
+ result = self._values.get("authentication_providers")
1276
+ return typing.cast(typing.Optional[IdentityPoolAuthenticationProviders], result)
1277
+
1278
+ @builtins.property
1279
+ def identity_pool_name(self) -> typing.Optional[builtins.str]:
1280
+ '''The name of the Identity Pool.
1281
+
1282
+ :default: - Automatically generated name by CloudFormation at deploy time
1283
+ '''
1284
+ result = self._values.get("identity_pool_name")
1285
+ return typing.cast(typing.Optional[builtins.str], result)
1286
+
1287
+ @builtins.property
1288
+ def role_mappings(self) -> typing.Optional[typing.List["IdentityPoolRoleMapping"]]:
1289
+ '''Rules for mapping roles to users.
1290
+
1291
+ :default: - no role mappings
1292
+ '''
1293
+ result = self._values.get("role_mappings")
1294
+ return typing.cast(typing.Optional[typing.List["IdentityPoolRoleMapping"]], result)
1295
+
1296
+ @builtins.property
1297
+ def unauthenticated_role(self) -> typing.Optional[_IRole_235f5d8e]:
1298
+ '''The default Role to be assumed by unauthenticated users.
1299
+
1300
+ :default: - A default unauthenticated Role will be added
1301
+ '''
1302
+ result = self._values.get("unauthenticated_role")
1303
+ return typing.cast(typing.Optional[_IRole_235f5d8e], result)
1304
+
1305
+ def __eq__(self, rhs: typing.Any) -> builtins.bool:
1306
+ return isinstance(rhs, self.__class__) and rhs._values == self._values
1307
+
1308
+ def __ne__(self, rhs: typing.Any) -> builtins.bool:
1309
+ return not (rhs == self)
1310
+
1311
+ def __repr__(self) -> str:
1312
+ return "IdentityPoolProps(%s)" % ", ".join(
1313
+ k + "=" + repr(v) for k, v in self._values.items()
1314
+ )
1315
+
1316
+
1317
+ @jsii.enum(jsii_type="aws-cdk-lib.aws_cognito_identitypool.IdentityPoolProviderType")
1318
+ class IdentityPoolProviderType(enum.Enum):
1319
+ '''Types of Identity Pool Login Providers.'''
1320
+
1321
+ FACEBOOK = "FACEBOOK"
1322
+ '''Facebook provider type.'''
1323
+ GOOGLE = "GOOGLE"
1324
+ '''Google provider type.'''
1325
+ AMAZON = "AMAZON"
1326
+ '''Amazon provider type.'''
1327
+ APPLE = "APPLE"
1328
+ '''Apple provider type.'''
1329
+ TWITTER = "TWITTER"
1330
+ '''Twitter provider type.'''
1331
+ OPEN_ID = "OPEN_ID"
1332
+ '''Open Id provider type.'''
1333
+ SAML = "SAML"
1334
+ '''Saml provider type.'''
1335
+ USER_POOL = "USER_POOL"
1336
+ '''User Pool provider type.'''
1337
+ CUSTOM = "CUSTOM"
1338
+ '''Custom provider type.'''
1339
+
1340
+
1341
+ class IdentityPoolProviderUrl(
1342
+ metaclass=jsii.JSIIMeta,
1343
+ jsii_type="aws-cdk-lib.aws_cognito_identitypool.IdentityPoolProviderUrl",
1344
+ ):
1345
+ '''Keys for Login Providers - each correspond to the client IDs of their respective federation Identity Providers.
1346
+
1347
+ :exampleMetadata: infused
1348
+
1349
+ Example::
1350
+
1351
+ from aws_cdk.aws_cognito_identitypool import IdentityPoolProviderUrl
1352
+
1353
+
1354
+ IdentityPool(self, "myidentitypool",
1355
+ identity_pool_name="myidentitypool",
1356
+ role_mappings=[IdentityPoolRoleMapping(
1357
+ provider_url=IdentityPoolProviderUrl.custom("my-custom-provider.com"),
1358
+ use_token=True
1359
+ )
1360
+ ]
1361
+ )
1362
+ '''
1363
+
1364
+ def __init__(self, type: IdentityPoolProviderType, value: builtins.str) -> None:
1365
+ '''
1366
+ :param type: The type of Identity Pool Provider.
1367
+ :param value: The value of the Identity Pool Provider.
1368
+ '''
1369
+ if __debug__:
1370
+ type_hints = typing.get_type_hints(_typecheckingstub__e21346602560f1cca6af9cafa3890159f40fe201ff2586fe35bff0fa41238584)
1371
+ check_type(argname="argument type", value=type, expected_type=type_hints["type"])
1372
+ check_type(argname="argument value", value=value, expected_type=type_hints["value"])
1373
+ jsii.create(self.__class__, self, [type, value])
1374
+
1375
+ @jsii.member(jsii_name="custom")
1376
+ @builtins.classmethod
1377
+ def custom(cls, url: builtins.str) -> "IdentityPoolProviderUrl":
1378
+ '''Custom Provider url.
1379
+
1380
+ :param url: -
1381
+ '''
1382
+ if __debug__:
1383
+ type_hints = typing.get_type_hints(_typecheckingstub__d20114b4fee683d84de101e404d5d8ef6cfea15634e2d35c6cc734c6009b8bad)
1384
+ check_type(argname="argument url", value=url, expected_type=type_hints["url"])
1385
+ return typing.cast("IdentityPoolProviderUrl", jsii.sinvoke(cls, "custom", [url]))
1386
+
1387
+ @jsii.member(jsii_name="openId")
1388
+ @builtins.classmethod
1389
+ def open_id(cls, url: builtins.str) -> "IdentityPoolProviderUrl":
1390
+ '''OpenId Provider url.
1391
+
1392
+ :param url: -
1393
+ '''
1394
+ if __debug__:
1395
+ type_hints = typing.get_type_hints(_typecheckingstub__6c92bcc9f8137a1d3e5beb43462992a38aaa0afc35af1ed27bb9a025f816fbda)
1396
+ check_type(argname="argument url", value=url, expected_type=type_hints["url"])
1397
+ return typing.cast("IdentityPoolProviderUrl", jsii.sinvoke(cls, "openId", [url]))
1398
+
1399
+ @jsii.member(jsii_name="saml")
1400
+ @builtins.classmethod
1401
+ def saml(cls, url: builtins.str) -> "IdentityPoolProviderUrl":
1402
+ '''Saml Provider url.
1403
+
1404
+ :param url: -
1405
+ '''
1406
+ if __debug__:
1407
+ type_hints = typing.get_type_hints(_typecheckingstub__4c7e07ca5a6f8dcc0f5236108ff2bb3698b65026b062307b86b3d67f3c6bda1f)
1408
+ check_type(argname="argument url", value=url, expected_type=type_hints["url"])
1409
+ return typing.cast("IdentityPoolProviderUrl", jsii.sinvoke(cls, "saml", [url]))
1410
+
1411
+ @jsii.member(jsii_name="userPool")
1412
+ @builtins.classmethod
1413
+ def user_pool(
1414
+ cls,
1415
+ user_pool: _IUserPool_1f1029e2,
1416
+ user_pool_client: _IUserPoolClient_75623ba4,
1417
+ ) -> "IdentityPoolProviderUrl":
1418
+ '''User Pool Provider Url.
1419
+
1420
+ :param user_pool: -
1421
+ :param user_pool_client: -
1422
+ '''
1423
+ if __debug__:
1424
+ type_hints = typing.get_type_hints(_typecheckingstub__121c7b058215a85a8a95870556fad2d21fc96c58ad014823e300286ace7fde64)
1425
+ check_type(argname="argument user_pool", value=user_pool, expected_type=type_hints["user_pool"])
1426
+ check_type(argname="argument user_pool_client", value=user_pool_client, expected_type=type_hints["user_pool_client"])
1427
+ return typing.cast("IdentityPoolProviderUrl", jsii.sinvoke(cls, "userPool", [user_pool, user_pool_client]))
1428
+
1429
+ @jsii.python.classproperty
1430
+ @jsii.member(jsii_name="AMAZON")
1431
+ def AMAZON(cls) -> "IdentityPoolProviderUrl":
1432
+ '''Amazon Provider url.'''
1433
+ return typing.cast("IdentityPoolProviderUrl", jsii.sget(cls, "AMAZON"))
1434
+
1435
+ @jsii.python.classproperty
1436
+ @jsii.member(jsii_name="APPLE")
1437
+ def APPLE(cls) -> "IdentityPoolProviderUrl":
1438
+ '''Apple Provider url.'''
1439
+ return typing.cast("IdentityPoolProviderUrl", jsii.sget(cls, "APPLE"))
1440
+
1441
+ @jsii.python.classproperty
1442
+ @jsii.member(jsii_name="FACEBOOK")
1443
+ def FACEBOOK(cls) -> "IdentityPoolProviderUrl":
1444
+ '''Facebook Provider url.'''
1445
+ return typing.cast("IdentityPoolProviderUrl", jsii.sget(cls, "FACEBOOK"))
1446
+
1447
+ @jsii.python.classproperty
1448
+ @jsii.member(jsii_name="GOOGLE")
1449
+ def GOOGLE(cls) -> "IdentityPoolProviderUrl":
1450
+ '''Google Provider url.'''
1451
+ return typing.cast("IdentityPoolProviderUrl", jsii.sget(cls, "GOOGLE"))
1452
+
1453
+ @jsii.python.classproperty
1454
+ @jsii.member(jsii_name="TWITTER")
1455
+ def TWITTER(cls) -> "IdentityPoolProviderUrl":
1456
+ '''Twitter Provider url.'''
1457
+ return typing.cast("IdentityPoolProviderUrl", jsii.sget(cls, "TWITTER"))
1458
+
1459
+ @builtins.property
1460
+ @jsii.member(jsii_name="type")
1461
+ def type(self) -> IdentityPoolProviderType:
1462
+ '''The type of Identity Pool Provider.'''
1463
+ return typing.cast(IdentityPoolProviderType, jsii.get(self, "type"))
1464
+
1465
+ @builtins.property
1466
+ @jsii.member(jsii_name="value")
1467
+ def value(self) -> builtins.str:
1468
+ '''The value of the Identity Pool Provider.'''
1469
+ return typing.cast(builtins.str, jsii.get(self, "value"))
1470
+
1471
+
1472
+ @jsii.data_type(
1473
+ jsii_type="aws-cdk-lib.aws_cognito_identitypool.IdentityPoolRoleMapping",
1474
+ jsii_struct_bases=[],
1475
+ name_mapping={
1476
+ "provider_url": "providerUrl",
1477
+ "mapping_key": "mappingKey",
1478
+ "resolve_ambiguous_roles": "resolveAmbiguousRoles",
1479
+ "rules": "rules",
1480
+ "use_token": "useToken",
1481
+ },
1482
+ )
1483
+ class IdentityPoolRoleMapping:
1484
+ def __init__(
1485
+ self,
1486
+ *,
1487
+ provider_url: IdentityPoolProviderUrl,
1488
+ mapping_key: typing.Optional[builtins.str] = None,
1489
+ resolve_ambiguous_roles: typing.Optional[builtins.bool] = None,
1490
+ rules: typing.Optional[typing.Sequence[typing.Union["RoleMappingRule", typing.Dict[builtins.str, typing.Any]]]] = None,
1491
+ use_token: typing.Optional[builtins.bool] = None,
1492
+ ) -> None:
1493
+ '''Map roles to users in the Identity Pool based on claims from the Identity Provider.
1494
+
1495
+ :param provider_url: The url of the Provider for which the role is mapped.
1496
+ :param mapping_key: The key used for the role mapping in the role mapping hash. Required if the providerUrl is a token. Default: - The provided providerUrl
1497
+ :param resolve_ambiguous_roles: Allow for role assumption when results of role mapping are ambiguous. Default: false - Ambiguous role resolutions will lead to requester being denied
1498
+ :param rules: The claim and value that must be matched in order to assume the role. Required if useToken is false Default: - No role mapping rule
1499
+ :param use_token: If true then mapped roles must be passed through the cognito:roles or cognito:preferred_role claims from Identity Provider. Default: false
1500
+
1501
+ :see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cognito-identitypoolroleattachment.html
1502
+ :exampleMetadata: fixture=_generated
1503
+
1504
+ Example::
1505
+
1506
+ # The code below shows an example of how to instantiate this type.
1507
+ # The values are placeholders you should change.
1508
+ from aws_cdk import aws_cognito_identitypool as cognito_identitypool
1509
+ from aws_cdk import aws_iam as iam
1510
+
1511
+ # identity_pool_provider_url: cognito_identitypool.IdentityPoolProviderUrl
1512
+ # role: iam.Role
1513
+
1514
+ identity_pool_role_mapping = cognito_identitypool.IdentityPoolRoleMapping(
1515
+ provider_url=identity_pool_provider_url,
1516
+
1517
+ # the properties below are optional
1518
+ mapping_key="mappingKey",
1519
+ resolve_ambiguous_roles=False,
1520
+ rules=[cognito_identitypool.RoleMappingRule(
1521
+ claim="claim",
1522
+ claim_value="claimValue",
1523
+ mapped_role=role,
1524
+
1525
+ # the properties below are optional
1526
+ match_type=cognito_identitypool.RoleMappingMatchType.EQUALS
1527
+ )],
1528
+ use_token=False
1529
+ )
1530
+ '''
1531
+ if __debug__:
1532
+ type_hints = typing.get_type_hints(_typecheckingstub__05374fa9238ffbe78c089d88ef40291976f7b4f0da96abe1bc7076a3dc7f654a)
1533
+ check_type(argname="argument provider_url", value=provider_url, expected_type=type_hints["provider_url"])
1534
+ check_type(argname="argument mapping_key", value=mapping_key, expected_type=type_hints["mapping_key"])
1535
+ check_type(argname="argument resolve_ambiguous_roles", value=resolve_ambiguous_roles, expected_type=type_hints["resolve_ambiguous_roles"])
1536
+ check_type(argname="argument rules", value=rules, expected_type=type_hints["rules"])
1537
+ check_type(argname="argument use_token", value=use_token, expected_type=type_hints["use_token"])
1538
+ self._values: typing.Dict[builtins.str, typing.Any] = {
1539
+ "provider_url": provider_url,
1540
+ }
1541
+ if mapping_key is not None:
1542
+ self._values["mapping_key"] = mapping_key
1543
+ if resolve_ambiguous_roles is not None:
1544
+ self._values["resolve_ambiguous_roles"] = resolve_ambiguous_roles
1545
+ if rules is not None:
1546
+ self._values["rules"] = rules
1547
+ if use_token is not None:
1548
+ self._values["use_token"] = use_token
1549
+
1550
+ @builtins.property
1551
+ def provider_url(self) -> IdentityPoolProviderUrl:
1552
+ '''The url of the Provider for which the role is mapped.'''
1553
+ result = self._values.get("provider_url")
1554
+ assert result is not None, "Required property 'provider_url' is missing"
1555
+ return typing.cast(IdentityPoolProviderUrl, result)
1556
+
1557
+ @builtins.property
1558
+ def mapping_key(self) -> typing.Optional[builtins.str]:
1559
+ '''The key used for the role mapping in the role mapping hash.
1560
+
1561
+ Required if the providerUrl is a token.
1562
+
1563
+ :default: - The provided providerUrl
1564
+ '''
1565
+ result = self._values.get("mapping_key")
1566
+ return typing.cast(typing.Optional[builtins.str], result)
1567
+
1568
+ @builtins.property
1569
+ def resolve_ambiguous_roles(self) -> typing.Optional[builtins.bool]:
1570
+ '''Allow for role assumption when results of role mapping are ambiguous.
1571
+
1572
+ :default: false - Ambiguous role resolutions will lead to requester being denied
1573
+ '''
1574
+ result = self._values.get("resolve_ambiguous_roles")
1575
+ return typing.cast(typing.Optional[builtins.bool], result)
1576
+
1577
+ @builtins.property
1578
+ def rules(self) -> typing.Optional[typing.List["RoleMappingRule"]]:
1579
+ '''The claim and value that must be matched in order to assume the role.
1580
+
1581
+ Required if useToken is false
1582
+
1583
+ :default: - No role mapping rule
1584
+ '''
1585
+ result = self._values.get("rules")
1586
+ return typing.cast(typing.Optional[typing.List["RoleMappingRule"]], result)
1587
+
1588
+ @builtins.property
1589
+ def use_token(self) -> typing.Optional[builtins.bool]:
1590
+ '''If true then mapped roles must be passed through the cognito:roles or cognito:preferred_role claims from Identity Provider.
1591
+
1592
+ :default: false
1593
+
1594
+ :see: https://docs.aws.amazon.com/cognito/latest/developerguide/role-based-access-control.html#using-tokens-to-assign-roles-to-users
1595
+ '''
1596
+ result = self._values.get("use_token")
1597
+ return typing.cast(typing.Optional[builtins.bool], result)
1598
+
1599
+ def __eq__(self, rhs: typing.Any) -> builtins.bool:
1600
+ return isinstance(rhs, self.__class__) and rhs._values == self._values
1601
+
1602
+ def __ne__(self, rhs: typing.Any) -> builtins.bool:
1603
+ return not (rhs == self)
1604
+
1605
+ def __repr__(self) -> str:
1606
+ return "IdentityPoolRoleMapping(%s)" % ", ".join(
1607
+ k + "=" + repr(v) for k, v in self._values.items()
1608
+ )
1609
+
1610
+
1611
+ @jsii.data_type(
1612
+ jsii_type="aws-cdk-lib.aws_cognito_identitypool.IdentityPoolTwitterLoginProvider",
1613
+ jsii_struct_bases=[],
1614
+ name_mapping={"consumer_key": "consumerKey", "consumer_secret": "consumerSecret"},
1615
+ )
1616
+ class IdentityPoolTwitterLoginProvider:
1617
+ def __init__(
1618
+ self,
1619
+ *,
1620
+ consumer_key: builtins.str,
1621
+ consumer_secret: builtins.str,
1622
+ ) -> None:
1623
+ '''Login Provider for identity federation using Twitter credentials.
1624
+
1625
+ :param consumer_key: Consumer key for Twitter identity federation.
1626
+ :param consumer_secret: Consumer secret for identity federation.
1627
+
1628
+ :exampleMetadata: infused
1629
+
1630
+ Example::
1631
+
1632
+ IdentityPool(self, "myidentitypool",
1633
+ identity_pool_name="myidentitypool",
1634
+ authentication_providers=IdentityPoolAuthenticationProviders(
1635
+ amazon=IdentityPoolAmazonLoginProvider(
1636
+ app_id="amzn1.application.12312k3j234j13rjiwuenf"
1637
+ ),
1638
+ facebook=IdentityPoolFacebookLoginProvider(
1639
+ app_id="1234567890123"
1640
+ ),
1641
+ google=IdentityPoolGoogleLoginProvider(
1642
+ client_id="12345678012.apps.googleusercontent.com"
1643
+ ),
1644
+ apple=IdentityPoolAppleLoginProvider(
1645
+ services_id="com.myappleapp.auth"
1646
+ ),
1647
+ twitter=IdentityPoolTwitterLoginProvider(
1648
+ consumer_key="my-twitter-id",
1649
+ consumer_secret="my-twitter-secret"
1650
+ )
1651
+ )
1652
+ )
1653
+ '''
1654
+ if __debug__:
1655
+ type_hints = typing.get_type_hints(_typecheckingstub__786d99918d74ebff131cc6829f43e101b4ff2f81ae8498f6e87eeb4d19eeaab6)
1656
+ check_type(argname="argument consumer_key", value=consumer_key, expected_type=type_hints["consumer_key"])
1657
+ check_type(argname="argument consumer_secret", value=consumer_secret, expected_type=type_hints["consumer_secret"])
1658
+ self._values: typing.Dict[builtins.str, typing.Any] = {
1659
+ "consumer_key": consumer_key,
1660
+ "consumer_secret": consumer_secret,
1661
+ }
1662
+
1663
+ @builtins.property
1664
+ def consumer_key(self) -> builtins.str:
1665
+ '''Consumer key for Twitter identity federation.'''
1666
+ result = self._values.get("consumer_key")
1667
+ assert result is not None, "Required property 'consumer_key' is missing"
1668
+ return typing.cast(builtins.str, result)
1669
+
1670
+ @builtins.property
1671
+ def consumer_secret(self) -> builtins.str:
1672
+ '''Consumer secret for identity federation.'''
1673
+ result = self._values.get("consumer_secret")
1674
+ assert result is not None, "Required property 'consumer_secret' is missing"
1675
+ return typing.cast(builtins.str, result)
1676
+
1677
+ def __eq__(self, rhs: typing.Any) -> builtins.bool:
1678
+ return isinstance(rhs, self.__class__) and rhs._values == self._values
1679
+
1680
+ def __ne__(self, rhs: typing.Any) -> builtins.bool:
1681
+ return not (rhs == self)
1682
+
1683
+ def __repr__(self) -> str:
1684
+ return "IdentityPoolTwitterLoginProvider(%s)" % ", ".join(
1685
+ k + "=" + repr(v) for k, v in self._values.items()
1686
+ )
1687
+
1688
+
1689
+ @jsii.enum(jsii_type="aws-cdk-lib.aws_cognito_identitypool.RoleMappingMatchType")
1690
+ class RoleMappingMatchType(enum.Enum):
1691
+ '''Types of matches allowed for role mapping.
1692
+
1693
+ :exampleMetadata: infused
1694
+
1695
+ Example::
1696
+
1697
+ from aws_cdk.aws_cognito_identitypool import IdentityPoolProviderUrl, RoleMappingMatchType
1698
+
1699
+ # admin_role: iam.Role
1700
+ # non_admin_role: iam.Role
1701
+
1702
+ IdentityPool(self, "myidentitypool",
1703
+ identity_pool_name="myidentitypool",
1704
+ # Assign specific roles to users based on whether or not the custom admin claim is passed from the identity provider
1705
+ role_mappings=[IdentityPoolRoleMapping(
1706
+ provider_url=IdentityPoolProviderUrl.AMAZON,
1707
+ rules=[RoleMappingRule(
1708
+ claim="custom:admin",
1709
+ claim_value="admin",
1710
+ mapped_role=admin_role
1711
+ ), RoleMappingRule(
1712
+ claim="custom:admin",
1713
+ claim_value="admin",
1714
+ match_type=RoleMappingMatchType.NOTEQUAL,
1715
+ mapped_role=non_admin_role
1716
+ )
1717
+ ]
1718
+ )]
1719
+ )
1720
+ '''
1721
+
1722
+ EQUALS = "EQUALS"
1723
+ '''The claim from the token must equal the given value in order for a match.'''
1724
+ CONTAINS = "CONTAINS"
1725
+ '''The claim from the token must contain the given value in order for a match.'''
1726
+ STARTS_WITH = "STARTS_WITH"
1727
+ '''The claim from the token must start with the given value in order for a match.'''
1728
+ NOTEQUAL = "NOTEQUAL"
1729
+ '''The claim from the token must not equal the given value in order for a match.'''
1730
+
1731
+
1732
+ @jsii.data_type(
1733
+ jsii_type="aws-cdk-lib.aws_cognito_identitypool.RoleMappingRule",
1734
+ jsii_struct_bases=[],
1735
+ name_mapping={
1736
+ "claim": "claim",
1737
+ "claim_value": "claimValue",
1738
+ "mapped_role": "mappedRole",
1739
+ "match_type": "matchType",
1740
+ },
1741
+ )
1742
+ class RoleMappingRule:
1743
+ def __init__(
1744
+ self,
1745
+ *,
1746
+ claim: builtins.str,
1747
+ claim_value: builtins.str,
1748
+ mapped_role: _IRole_235f5d8e,
1749
+ match_type: typing.Optional[RoleMappingMatchType] = None,
1750
+ ) -> None:
1751
+ '''Represents an Identity Pool Role Attachment role mapping rule.
1752
+
1753
+ :param claim: The key sent in the token by the federated Identity Provider.
1754
+ :param claim_value: The value of the claim that must be matched.
1755
+ :param mapped_role: The role to be assumed when the claim value is matched.
1756
+ :param match_type: How to match with the claim value. Default: RoleMappingMatchType.EQUALS
1757
+
1758
+ :exampleMetadata: fixture=_generated
1759
+
1760
+ Example::
1761
+
1762
+ # The code below shows an example of how to instantiate this type.
1763
+ # The values are placeholders you should change.
1764
+ from aws_cdk import aws_cognito_identitypool as cognito_identitypool
1765
+ from aws_cdk import aws_iam as iam
1766
+
1767
+ # role: iam.Role
1768
+
1769
+ role_mapping_rule = cognito_identitypool.RoleMappingRule(
1770
+ claim="claim",
1771
+ claim_value="claimValue",
1772
+ mapped_role=role,
1773
+
1774
+ # the properties below are optional
1775
+ match_type=cognito_identitypool.RoleMappingMatchType.EQUALS
1776
+ )
1777
+ '''
1778
+ if __debug__:
1779
+ type_hints = typing.get_type_hints(_typecheckingstub__0a3e6602f3dd1fc95d5e6a85eb1c6cd033f9584c3a5e317879694442cae64080)
1780
+ check_type(argname="argument claim", value=claim, expected_type=type_hints["claim"])
1781
+ check_type(argname="argument claim_value", value=claim_value, expected_type=type_hints["claim_value"])
1782
+ check_type(argname="argument mapped_role", value=mapped_role, expected_type=type_hints["mapped_role"])
1783
+ check_type(argname="argument match_type", value=match_type, expected_type=type_hints["match_type"])
1784
+ self._values: typing.Dict[builtins.str, typing.Any] = {
1785
+ "claim": claim,
1786
+ "claim_value": claim_value,
1787
+ "mapped_role": mapped_role,
1788
+ }
1789
+ if match_type is not None:
1790
+ self._values["match_type"] = match_type
1791
+
1792
+ @builtins.property
1793
+ def claim(self) -> builtins.str:
1794
+ '''The key sent in the token by the federated Identity Provider.'''
1795
+ result = self._values.get("claim")
1796
+ assert result is not None, "Required property 'claim' is missing"
1797
+ return typing.cast(builtins.str, result)
1798
+
1799
+ @builtins.property
1800
+ def claim_value(self) -> builtins.str:
1801
+ '''The value of the claim that must be matched.'''
1802
+ result = self._values.get("claim_value")
1803
+ assert result is not None, "Required property 'claim_value' is missing"
1804
+ return typing.cast(builtins.str, result)
1805
+
1806
+ @builtins.property
1807
+ def mapped_role(self) -> _IRole_235f5d8e:
1808
+ '''The role to be assumed when the claim value is matched.'''
1809
+ result = self._values.get("mapped_role")
1810
+ assert result is not None, "Required property 'mapped_role' is missing"
1811
+ return typing.cast(_IRole_235f5d8e, result)
1812
+
1813
+ @builtins.property
1814
+ def match_type(self) -> typing.Optional[RoleMappingMatchType]:
1815
+ '''How to match with the claim value.
1816
+
1817
+ :default: RoleMappingMatchType.EQUALS
1818
+ '''
1819
+ result = self._values.get("match_type")
1820
+ return typing.cast(typing.Optional[RoleMappingMatchType], result)
1821
+
1822
+ def __eq__(self, rhs: typing.Any) -> builtins.bool:
1823
+ return isinstance(rhs, self.__class__) and rhs._values == self._values
1824
+
1825
+ def __ne__(self, rhs: typing.Any) -> builtins.bool:
1826
+ return not (rhs == self)
1827
+
1828
+ def __repr__(self) -> str:
1829
+ return "RoleMappingRule(%s)" % ", ".join(
1830
+ k + "=" + repr(v) for k, v in self._values.items()
1831
+ )
1832
+
1833
+
1834
+ @jsii.implements(IUserPoolAuthenticationProvider)
1835
+ class UserPoolAuthenticationProvider(
1836
+ metaclass=jsii.JSIIMeta,
1837
+ jsii_type="aws-cdk-lib.aws_cognito_identitypool.UserPoolAuthenticationProvider",
1838
+ ):
1839
+ '''Defines a User Pool Authentication Provider.
1840
+
1841
+ :exampleMetadata: infused
1842
+
1843
+ Example::
1844
+
1845
+ # identity_pool: IdentityPool
1846
+
1847
+ user_pool = cognito.UserPool(self, "Pool")
1848
+ identity_pool.add_user_pool_authentication(UserPoolAuthenticationProvider(
1849
+ user_pool=user_pool,
1850
+ disable_server_side_token_check=True
1851
+ ))
1852
+ '''
1853
+
1854
+ def __init__(
1855
+ self,
1856
+ *,
1857
+ user_pool: _IUserPool_1f1029e2,
1858
+ disable_server_side_token_check: typing.Optional[builtins.bool] = None,
1859
+ user_pool_client: typing.Optional[_IUserPoolClient_75623ba4] = None,
1860
+ ) -> None:
1861
+ '''
1862
+ :param user_pool: The User Pool of the Associated Identity Providers.
1863
+ :param disable_server_side_token_check: Setting this to true turns off identity pool checks for this user pool to make sure the user has not been globally signed out or deleted before the identity pool provides an OIDC token or AWS credentials for the user. Default: false
1864
+ :param user_pool_client: The User Pool Client for the provided User Pool. Default: - A default user pool client will be added to User Pool
1865
+ '''
1866
+ props = UserPoolAuthenticationProviderProps(
1867
+ user_pool=user_pool,
1868
+ disable_server_side_token_check=disable_server_side_token_check,
1869
+ user_pool_client=user_pool_client,
1870
+ )
1871
+
1872
+ jsii.create(self.__class__, self, [props])
1873
+
1874
+ @jsii.member(jsii_name="bind")
1875
+ def bind(
1876
+ self,
1877
+ scope: _constructs_77d1e7e8.Construct,
1878
+ identity_pool: IIdentityPool,
1879
+ ) -> "UserPoolAuthenticationProviderBindConfig":
1880
+ '''The method called when a given User Pool Authentication Provider is added (for the first time) to an Identity Pool.
1881
+
1882
+ :param scope: -
1883
+ :param identity_pool: -
1884
+ '''
1885
+ if __debug__:
1886
+ type_hints = typing.get_type_hints(_typecheckingstub__ba6eb139548890358ee0627f6ab76a68ed34453606a7c47e22b81e13d0d8b649)
1887
+ check_type(argname="argument scope", value=scope, expected_type=type_hints["scope"])
1888
+ check_type(argname="argument identity_pool", value=identity_pool, expected_type=type_hints["identity_pool"])
1889
+ _options = UserPoolAuthenticationProviderBindOptions()
1890
+
1891
+ return typing.cast("UserPoolAuthenticationProviderBindConfig", jsii.invoke(self, "bind", [scope, identity_pool, _options]))
1892
+
1893
+
1894
+ @jsii.data_type(
1895
+ jsii_type="aws-cdk-lib.aws_cognito_identitypool.UserPoolAuthenticationProviderBindConfig",
1896
+ jsii_struct_bases=[],
1897
+ name_mapping={
1898
+ "client_id": "clientId",
1899
+ "provider_name": "providerName",
1900
+ "server_side_token_check": "serverSideTokenCheck",
1901
+ },
1902
+ )
1903
+ class UserPoolAuthenticationProviderBindConfig:
1904
+ def __init__(
1905
+ self,
1906
+ *,
1907
+ client_id: builtins.str,
1908
+ provider_name: builtins.str,
1909
+ server_side_token_check: builtins.bool,
1910
+ ) -> None:
1911
+ '''Represents a UserPoolAuthenticationProvider Bind Configuration.
1912
+
1913
+ :param client_id: Client Id of the Associated User Pool Client.
1914
+ :param provider_name: The identity providers associated with the UserPool.
1915
+ :param server_side_token_check: Whether to enable the identity pool's server side token check.
1916
+
1917
+ :exampleMetadata: fixture=_generated
1918
+
1919
+ Example::
1920
+
1921
+ # The code below shows an example of how to instantiate this type.
1922
+ # The values are placeholders you should change.
1923
+ from aws_cdk import aws_cognito_identitypool as cognito_identitypool
1924
+
1925
+ user_pool_authentication_provider_bind_config = cognito_identitypool.UserPoolAuthenticationProviderBindConfig(
1926
+ client_id="clientId",
1927
+ provider_name="providerName",
1928
+ server_side_token_check=False
1929
+ )
1930
+ '''
1931
+ if __debug__:
1932
+ type_hints = typing.get_type_hints(_typecheckingstub__5e30a131979e49e3de120bda434e1aadc44c66a60ebb331ed0a7cb68845b2e58)
1933
+ check_type(argname="argument client_id", value=client_id, expected_type=type_hints["client_id"])
1934
+ check_type(argname="argument provider_name", value=provider_name, expected_type=type_hints["provider_name"])
1935
+ check_type(argname="argument server_side_token_check", value=server_side_token_check, expected_type=type_hints["server_side_token_check"])
1936
+ self._values: typing.Dict[builtins.str, typing.Any] = {
1937
+ "client_id": client_id,
1938
+ "provider_name": provider_name,
1939
+ "server_side_token_check": server_side_token_check,
1940
+ }
1941
+
1942
+ @builtins.property
1943
+ def client_id(self) -> builtins.str:
1944
+ '''Client Id of the Associated User Pool Client.'''
1945
+ result = self._values.get("client_id")
1946
+ assert result is not None, "Required property 'client_id' is missing"
1947
+ return typing.cast(builtins.str, result)
1948
+
1949
+ @builtins.property
1950
+ def provider_name(self) -> builtins.str:
1951
+ '''The identity providers associated with the UserPool.'''
1952
+ result = self._values.get("provider_name")
1953
+ assert result is not None, "Required property 'provider_name' is missing"
1954
+ return typing.cast(builtins.str, result)
1955
+
1956
+ @builtins.property
1957
+ def server_side_token_check(self) -> builtins.bool:
1958
+ '''Whether to enable the identity pool's server side token check.'''
1959
+ result = self._values.get("server_side_token_check")
1960
+ assert result is not None, "Required property 'server_side_token_check' is missing"
1961
+ return typing.cast(builtins.bool, result)
1962
+
1963
+ def __eq__(self, rhs: typing.Any) -> builtins.bool:
1964
+ return isinstance(rhs, self.__class__) and rhs._values == self._values
1965
+
1966
+ def __ne__(self, rhs: typing.Any) -> builtins.bool:
1967
+ return not (rhs == self)
1968
+
1969
+ def __repr__(self) -> str:
1970
+ return "UserPoolAuthenticationProviderBindConfig(%s)" % ", ".join(
1971
+ k + "=" + repr(v) for k, v in self._values.items()
1972
+ )
1973
+
1974
+
1975
+ @jsii.data_type(
1976
+ jsii_type="aws-cdk-lib.aws_cognito_identitypool.UserPoolAuthenticationProviderBindOptions",
1977
+ jsii_struct_bases=[],
1978
+ name_mapping={},
1979
+ )
1980
+ class UserPoolAuthenticationProviderBindOptions:
1981
+ def __init__(self) -> None:
1982
+ '''Represents UserPoolAuthenticationProvider Bind Options.
1983
+
1984
+ :exampleMetadata: fixture=_generated
1985
+
1986
+ Example::
1987
+
1988
+ # The code below shows an example of how to instantiate this type.
1989
+ # The values are placeholders you should change.
1990
+ from aws_cdk import aws_cognito_identitypool as cognito_identitypool
1991
+
1992
+ user_pool_authentication_provider_bind_options = cognito_identitypool.UserPoolAuthenticationProviderBindOptions()
1993
+ '''
1994
+ self._values: typing.Dict[builtins.str, typing.Any] = {}
1995
+
1996
+ def __eq__(self, rhs: typing.Any) -> builtins.bool:
1997
+ return isinstance(rhs, self.__class__) and rhs._values == self._values
1998
+
1999
+ def __ne__(self, rhs: typing.Any) -> builtins.bool:
2000
+ return not (rhs == self)
2001
+
2002
+ def __repr__(self) -> str:
2003
+ return "UserPoolAuthenticationProviderBindOptions(%s)" % ", ".join(
2004
+ k + "=" + repr(v) for k, v in self._values.items()
2005
+ )
2006
+
2007
+
2008
+ @jsii.data_type(
2009
+ jsii_type="aws-cdk-lib.aws_cognito_identitypool.UserPoolAuthenticationProviderProps",
2010
+ jsii_struct_bases=[],
2011
+ name_mapping={
2012
+ "user_pool": "userPool",
2013
+ "disable_server_side_token_check": "disableServerSideTokenCheck",
2014
+ "user_pool_client": "userPoolClient",
2015
+ },
2016
+ )
2017
+ class UserPoolAuthenticationProviderProps:
2018
+ def __init__(
2019
+ self,
2020
+ *,
2021
+ user_pool: _IUserPool_1f1029e2,
2022
+ disable_server_side_token_check: typing.Optional[builtins.bool] = None,
2023
+ user_pool_client: typing.Optional[_IUserPoolClient_75623ba4] = None,
2024
+ ) -> None:
2025
+ '''Props for the User Pool Authentication Provider.
2026
+
2027
+ :param user_pool: The User Pool of the Associated Identity Providers.
2028
+ :param disable_server_side_token_check: Setting this to true turns off identity pool checks for this user pool to make sure the user has not been globally signed out or deleted before the identity pool provides an OIDC token or AWS credentials for the user. Default: false
2029
+ :param user_pool_client: The User Pool Client for the provided User Pool. Default: - A default user pool client will be added to User Pool
2030
+
2031
+ :exampleMetadata: infused
2032
+
2033
+ Example::
2034
+
2035
+ # identity_pool: IdentityPool
2036
+
2037
+ user_pool = cognito.UserPool(self, "Pool")
2038
+ identity_pool.add_user_pool_authentication(UserPoolAuthenticationProvider(
2039
+ user_pool=user_pool,
2040
+ disable_server_side_token_check=True
2041
+ ))
2042
+ '''
2043
+ if __debug__:
2044
+ type_hints = typing.get_type_hints(_typecheckingstub__96b0f5e74875a97abd1e74170f934c5a7746bf416d00b5b9a3a2b79560e66c96)
2045
+ check_type(argname="argument user_pool", value=user_pool, expected_type=type_hints["user_pool"])
2046
+ check_type(argname="argument disable_server_side_token_check", value=disable_server_side_token_check, expected_type=type_hints["disable_server_side_token_check"])
2047
+ check_type(argname="argument user_pool_client", value=user_pool_client, expected_type=type_hints["user_pool_client"])
2048
+ self._values: typing.Dict[builtins.str, typing.Any] = {
2049
+ "user_pool": user_pool,
2050
+ }
2051
+ if disable_server_side_token_check is not None:
2052
+ self._values["disable_server_side_token_check"] = disable_server_side_token_check
2053
+ if user_pool_client is not None:
2054
+ self._values["user_pool_client"] = user_pool_client
2055
+
2056
+ @builtins.property
2057
+ def user_pool(self) -> _IUserPool_1f1029e2:
2058
+ '''The User Pool of the Associated Identity Providers.'''
2059
+ result = self._values.get("user_pool")
2060
+ assert result is not None, "Required property 'user_pool' is missing"
2061
+ return typing.cast(_IUserPool_1f1029e2, result)
2062
+
2063
+ @builtins.property
2064
+ def disable_server_side_token_check(self) -> typing.Optional[builtins.bool]:
2065
+ '''Setting this to true turns off identity pool checks for this user pool to make sure the user has not been globally signed out or deleted before the identity pool provides an OIDC token or AWS credentials for the user.
2066
+
2067
+ :default: false
2068
+
2069
+ :see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cognito-identitypool-cognitoidentityprovider.html
2070
+ '''
2071
+ result = self._values.get("disable_server_side_token_check")
2072
+ return typing.cast(typing.Optional[builtins.bool], result)
2073
+
2074
+ @builtins.property
2075
+ def user_pool_client(self) -> typing.Optional[_IUserPoolClient_75623ba4]:
2076
+ '''The User Pool Client for the provided User Pool.
2077
+
2078
+ :default: - A default user pool client will be added to User Pool
2079
+ '''
2080
+ result = self._values.get("user_pool_client")
2081
+ return typing.cast(typing.Optional[_IUserPoolClient_75623ba4], result)
2082
+
2083
+ def __eq__(self, rhs: typing.Any) -> builtins.bool:
2084
+ return isinstance(rhs, self.__class__) and rhs._values == self._values
2085
+
2086
+ def __ne__(self, rhs: typing.Any) -> builtins.bool:
2087
+ return not (rhs == self)
2088
+
2089
+ def __repr__(self) -> str:
2090
+ return "UserPoolAuthenticationProviderProps(%s)" % ", ".join(
2091
+ k + "=" + repr(v) for k, v in self._values.items()
2092
+ )
2093
+
2094
+
2095
+ __all__ = [
2096
+ "IIdentityPool",
2097
+ "IUserPoolAuthenticationProvider",
2098
+ "IdentityPool",
2099
+ "IdentityPoolAmazonLoginProvider",
2100
+ "IdentityPoolAppleLoginProvider",
2101
+ "IdentityPoolAuthenticationProviders",
2102
+ "IdentityPoolFacebookLoginProvider",
2103
+ "IdentityPoolGoogleLoginProvider",
2104
+ "IdentityPoolProps",
2105
+ "IdentityPoolProviderType",
2106
+ "IdentityPoolProviderUrl",
2107
+ "IdentityPoolRoleMapping",
2108
+ "IdentityPoolTwitterLoginProvider",
2109
+ "RoleMappingMatchType",
2110
+ "RoleMappingRule",
2111
+ "UserPoolAuthenticationProvider",
2112
+ "UserPoolAuthenticationProviderBindConfig",
2113
+ "UserPoolAuthenticationProviderBindOptions",
2114
+ "UserPoolAuthenticationProviderProps",
2115
+ ]
2116
+
2117
+ publication.publish()
2118
+
2119
+ def _typecheckingstub__5c814fdc426f731ac5e76cbccdb476b3226db8e3f5c19b9f57f6ed181043dd60(
2120
+ scope: _constructs_77d1e7e8.Construct,
2121
+ identity_pool: IIdentityPool,
2122
+ ) -> None:
2123
+ """Type checking stubs"""
2124
+ pass
2125
+
2126
+ def _typecheckingstub__a7508ece930af8922e09956e6b9166bbdbf4f94d0b43649c6d1c63f6bd90fc80(
2127
+ scope: _constructs_77d1e7e8.Construct,
2128
+ id: builtins.str,
2129
+ *,
2130
+ allow_classic_flow: typing.Optional[builtins.bool] = None,
2131
+ allow_unauthenticated_identities: typing.Optional[builtins.bool] = None,
2132
+ authenticated_role: typing.Optional[_IRole_235f5d8e] = None,
2133
+ authentication_providers: typing.Optional[typing.Union[IdentityPoolAuthenticationProviders, typing.Dict[builtins.str, typing.Any]]] = None,
2134
+ identity_pool_name: typing.Optional[builtins.str] = None,
2135
+ role_mappings: typing.Optional[typing.Sequence[typing.Union[IdentityPoolRoleMapping, typing.Dict[builtins.str, typing.Any]]]] = None,
2136
+ unauthenticated_role: typing.Optional[_IRole_235f5d8e] = None,
2137
+ ) -> None:
2138
+ """Type checking stubs"""
2139
+ pass
2140
+
2141
+ def _typecheckingstub__3173746cd04dd07f081f1f960cd91b67ec8367052f383c0ed193eaf98bcf47c6(
2142
+ scope: _constructs_77d1e7e8.Construct,
2143
+ id: builtins.str,
2144
+ identity_pool_arn: builtins.str,
2145
+ ) -> None:
2146
+ """Type checking stubs"""
2147
+ pass
2148
+
2149
+ def _typecheckingstub__b7094f2ba90c5fab8d158b4276f0bc0876fb3f0e3dd42cafa6fb6cb1e02a6893(
2150
+ scope: _constructs_77d1e7e8.Construct,
2151
+ id: builtins.str,
2152
+ identity_pool_id: builtins.str,
2153
+ ) -> None:
2154
+ """Type checking stubs"""
2155
+ pass
2156
+
2157
+ def _typecheckingstub__fd6d23271053899a9cf9a7ec303ccebbcc3f4c4aa45de84fb3586658a176cb3a(
2158
+ user_pool: IUserPoolAuthenticationProvider,
2159
+ ) -> None:
2160
+ """Type checking stubs"""
2161
+ pass
2162
+
2163
+ def _typecheckingstub__469abe646a9b1de4f31f3b04632a02d728f0da52b1c7b2fb1c31b02e48ab80b9(
2164
+ *,
2165
+ app_id: builtins.str,
2166
+ ) -> None:
2167
+ """Type checking stubs"""
2168
+ pass
2169
+
2170
+ def _typecheckingstub__e9b4447874c9fdd7fed07df178fcf069b944be0d670ec52b85e362202ed6ca80(
2171
+ *,
2172
+ services_id: builtins.str,
2173
+ ) -> None:
2174
+ """Type checking stubs"""
2175
+ pass
2176
+
2177
+ def _typecheckingstub__e5736f06974c68519c1ae6c3b7a96f6631b848c6e335b1b26878af4283639ee6(
2178
+ *,
2179
+ amazon: typing.Optional[typing.Union[IdentityPoolAmazonLoginProvider, typing.Dict[builtins.str, typing.Any]]] = None,
2180
+ apple: typing.Optional[typing.Union[IdentityPoolAppleLoginProvider, typing.Dict[builtins.str, typing.Any]]] = None,
2181
+ custom_provider: typing.Optional[builtins.str] = None,
2182
+ facebook: typing.Optional[typing.Union[IdentityPoolFacebookLoginProvider, typing.Dict[builtins.str, typing.Any]]] = None,
2183
+ google: typing.Optional[typing.Union[IdentityPoolGoogleLoginProvider, typing.Dict[builtins.str, typing.Any]]] = None,
2184
+ open_id_connect_providers: typing.Optional[typing.Sequence[_IOpenIdConnectProvider_203f0793]] = None,
2185
+ saml_providers: typing.Optional[typing.Sequence[_ISamlProvider_63f03582]] = None,
2186
+ twitter: typing.Optional[typing.Union[IdentityPoolTwitterLoginProvider, typing.Dict[builtins.str, typing.Any]]] = None,
2187
+ user_pools: typing.Optional[typing.Sequence[IUserPoolAuthenticationProvider]] = None,
2188
+ ) -> None:
2189
+ """Type checking stubs"""
2190
+ pass
2191
+
2192
+ def _typecheckingstub__79f268d6507a7ea842aa4eecfa40a33ff4b75964393a3608ad305361f40fbfa4(
2193
+ *,
2194
+ app_id: builtins.str,
2195
+ ) -> None:
2196
+ """Type checking stubs"""
2197
+ pass
2198
+
2199
+ def _typecheckingstub__7cf50453dd8eb6086b031602235511412f140c8a0fd75af98cf94efd203caf0c(
2200
+ *,
2201
+ client_id: builtins.str,
2202
+ ) -> None:
2203
+ """Type checking stubs"""
2204
+ pass
2205
+
2206
+ def _typecheckingstub__af198fbf56ac885d5c6c92255ff0143c4ee67b99a01cce4cfb3113296d3d7265(
2207
+ *,
2208
+ allow_classic_flow: typing.Optional[builtins.bool] = None,
2209
+ allow_unauthenticated_identities: typing.Optional[builtins.bool] = None,
2210
+ authenticated_role: typing.Optional[_IRole_235f5d8e] = None,
2211
+ authentication_providers: typing.Optional[typing.Union[IdentityPoolAuthenticationProviders, typing.Dict[builtins.str, typing.Any]]] = None,
2212
+ identity_pool_name: typing.Optional[builtins.str] = None,
2213
+ role_mappings: typing.Optional[typing.Sequence[typing.Union[IdentityPoolRoleMapping, typing.Dict[builtins.str, typing.Any]]]] = None,
2214
+ unauthenticated_role: typing.Optional[_IRole_235f5d8e] = None,
2215
+ ) -> None:
2216
+ """Type checking stubs"""
2217
+ pass
2218
+
2219
+ def _typecheckingstub__e21346602560f1cca6af9cafa3890159f40fe201ff2586fe35bff0fa41238584(
2220
+ type: IdentityPoolProviderType,
2221
+ value: builtins.str,
2222
+ ) -> None:
2223
+ """Type checking stubs"""
2224
+ pass
2225
+
2226
+ def _typecheckingstub__d20114b4fee683d84de101e404d5d8ef6cfea15634e2d35c6cc734c6009b8bad(
2227
+ url: builtins.str,
2228
+ ) -> None:
2229
+ """Type checking stubs"""
2230
+ pass
2231
+
2232
+ def _typecheckingstub__6c92bcc9f8137a1d3e5beb43462992a38aaa0afc35af1ed27bb9a025f816fbda(
2233
+ url: builtins.str,
2234
+ ) -> None:
2235
+ """Type checking stubs"""
2236
+ pass
2237
+
2238
+ def _typecheckingstub__4c7e07ca5a6f8dcc0f5236108ff2bb3698b65026b062307b86b3d67f3c6bda1f(
2239
+ url: builtins.str,
2240
+ ) -> None:
2241
+ """Type checking stubs"""
2242
+ pass
2243
+
2244
+ def _typecheckingstub__121c7b058215a85a8a95870556fad2d21fc96c58ad014823e300286ace7fde64(
2245
+ user_pool: _IUserPool_1f1029e2,
2246
+ user_pool_client: _IUserPoolClient_75623ba4,
2247
+ ) -> None:
2248
+ """Type checking stubs"""
2249
+ pass
2250
+
2251
+ def _typecheckingstub__05374fa9238ffbe78c089d88ef40291976f7b4f0da96abe1bc7076a3dc7f654a(
2252
+ *,
2253
+ provider_url: IdentityPoolProviderUrl,
2254
+ mapping_key: typing.Optional[builtins.str] = None,
2255
+ resolve_ambiguous_roles: typing.Optional[builtins.bool] = None,
2256
+ rules: typing.Optional[typing.Sequence[typing.Union[RoleMappingRule, typing.Dict[builtins.str, typing.Any]]]] = None,
2257
+ use_token: typing.Optional[builtins.bool] = None,
2258
+ ) -> None:
2259
+ """Type checking stubs"""
2260
+ pass
2261
+
2262
+ def _typecheckingstub__786d99918d74ebff131cc6829f43e101b4ff2f81ae8498f6e87eeb4d19eeaab6(
2263
+ *,
2264
+ consumer_key: builtins.str,
2265
+ consumer_secret: builtins.str,
2266
+ ) -> None:
2267
+ """Type checking stubs"""
2268
+ pass
2269
+
2270
+ def _typecheckingstub__0a3e6602f3dd1fc95d5e6a85eb1c6cd033f9584c3a5e317879694442cae64080(
2271
+ *,
2272
+ claim: builtins.str,
2273
+ claim_value: builtins.str,
2274
+ mapped_role: _IRole_235f5d8e,
2275
+ match_type: typing.Optional[RoleMappingMatchType] = None,
2276
+ ) -> None:
2277
+ """Type checking stubs"""
2278
+ pass
2279
+
2280
+ def _typecheckingstub__ba6eb139548890358ee0627f6ab76a68ed34453606a7c47e22b81e13d0d8b649(
2281
+ scope: _constructs_77d1e7e8.Construct,
2282
+ identity_pool: IIdentityPool,
2283
+ ) -> None:
2284
+ """Type checking stubs"""
2285
+ pass
2286
+
2287
+ def _typecheckingstub__5e30a131979e49e3de120bda434e1aadc44c66a60ebb331ed0a7cb68845b2e58(
2288
+ *,
2289
+ client_id: builtins.str,
2290
+ provider_name: builtins.str,
2291
+ server_side_token_check: builtins.bool,
2292
+ ) -> None:
2293
+ """Type checking stubs"""
2294
+ pass
2295
+
2296
+ def _typecheckingstub__96b0f5e74875a97abd1e74170f934c5a7746bf416d00b5b9a3a2b79560e66c96(
2297
+ *,
2298
+ user_pool: _IUserPool_1f1029e2,
2299
+ disable_server_side_token_check: typing.Optional[builtins.bool] = None,
2300
+ user_pool_client: typing.Optional[_IUserPoolClient_75623ba4] = None,
2301
+ ) -> None:
2302
+ """Type checking stubs"""
2303
+ pass