VerifiedPermissions / Client / create_identity_source

create_identity_source#

VerifiedPermissions.Client.create_identity_source(**kwargs)#

Creates a reference to an Amazon Cognito user pool as an external identity provider (IdP).

After you create an identity source, you can use the identities provided by the IdP as proxies for the principal in authorization queries that use the IsAuthorizedWithToken operation. These identities take the form of tokens that contain claims about the user, such as IDs, attributes and group memberships. Amazon Cognito provides both identity tokens and access tokens, and Verified Permissions can use either or both. Any combination of identity and access tokens results in the same Cedar principal. Verified Permissions automatically translates the information about the identities into the standard Cedar attributes that can be evaluated by your policies. Because the Amazon Cognito identity and access tokens can contain different information, the tokens you choose to use determine which principal attributes are available to access when evaluating Cedar policies.

Warning

If you delete a Amazon Cognito user pool or user, tokens from that deleted pool or that deleted user continue to be usable until they expire.

Note

To reference a user from this identity source in your Cedar policies, use the following syntax.

IdentityType::”<CognitoUserPoolIdentifier>|<CognitoClientId>

Where IdentityType is the string that you provide to the PrincipalEntityType parameter for this operation. The CognitoUserPoolId and CognitoClientId are defined by the Amazon Cognito user pool.

Note

Verified Permissions is eventually consistent . It can take a few seconds for a new or changed element to propagate through the service and be visible in the results of other Verified Permissions operations.

See also: AWS API Documentation

Request Syntax

response = client.create_identity_source(
    clientToken='string',
    policyStoreId='string',
    configuration={
        'cognitoUserPoolConfiguration': {
            'userPoolArn': 'string',
            'clientIds': [
                'string',
            ],
            'groupConfiguration': {
                'groupEntityType': 'string'
            }
        }
    },
    principalEntityType='string'
)
Parameters:
  • clientToken (string) –

    Specifies a unique, case-sensitive ID that you provide to ensure the idempotency of the request. This lets you safely retry the request without accidentally performing the same operation a second time. Passing the same value to a later call to an operation requires that you also pass the same value for all other parameters. We recommend that you use a UUID type of value..

    If you don’t provide this value, then Amazon Web Services generates a random one for you.

    If you retry the operation with the same ClientToken, but with different parameters, the retry fails with an ConflictException error.

    Verified Permissions recognizes a ClientToken for eight hours. After eight hours, the next request with the same parameters performs the operation again regardless of the value of ClientToken.

    This field is autopopulated if not provided.

  • policyStoreId (string) –

    [REQUIRED]

    Specifies the ID of the policy store in which you want to store this identity source. Only policies and requests made using this policy store can reference identities from the identity provider configured in the new identity source.

  • configuration (dict) –

    [REQUIRED]

    Specifies the details required to communicate with the identity provider (IdP) associated with this identity source.

    Note

    At this time, the only valid member of this structure is a Amazon Cognito user pool configuration.

    You must specify a UserPoolArn, and optionally, a ClientId.

    Note

    This is a Tagged Union structure. Only one of the following top level keys can be set: cognitoUserPoolConfiguration.

    • cognitoUserPoolConfiguration (dict) –

      Contains configuration details of a Amazon Cognito user pool that Verified Permissions can use as a source of authenticated identities as entities. It specifies the Amazon Resource Name (ARN) of a Amazon Cognito user pool and one or more application client IDs.

      Example: "configuration":{"cognitoUserPoolConfiguration":{"userPoolArn":"arn:aws:cognito-idp:us-east-1:123456789012:userpool/us-east-1_1a2b3c4d5","clientIds": ["a1b2c3d4e5f6g7h8i9j0kalbmc"],"groupConfiguration": {"groupEntityType": "MyCorp::Group"}}}

      • userPoolArn (string) – [REQUIRED]

        The Amazon Resource Name (ARN) of the Amazon Cognito user pool that contains the identities to be authorized.

        Example: "UserPoolArn": "arn:aws:cognito-idp:us-east-1:123456789012:userpool/us-east-1_1a2b3c4d5"

      • clientIds (list) –

        The unique application client IDs that are associated with the specified Amazon Cognito user pool.

        Example: "ClientIds": ["&ExampleCogClientId;"]

        • (string) –

      • groupConfiguration (dict) –

        The configuration of the user groups from an Amazon Cognito user pool identity source.

        • groupEntityType (string) – [REQUIRED]

          The name of the schema entity type that’s mapped to the user pool group. Defaults to AWS::CognitoGroup.

  • principalEntityType (string) – Specifies the namespace and data type of the principals generated for identities authenticated by the new identity source.

Return type:

dict

Returns:

Response Syntax

{
    'createdDate': datetime(2015, 1, 1),
    'identitySourceId': 'string',
    'lastUpdatedDate': datetime(2015, 1, 1),
    'policyStoreId': 'string'
}

Response Structure

  • (dict) –

    • createdDate (datetime) –

      The date and time the identity source was originally created.

    • identitySourceId (string) –

      The unique ID of the new identity source.

    • lastUpdatedDate (datetime) –

      The date and time the identity source was most recently updated.

    • policyStoreId (string) –

      The ID of the policy store that contains the identity source.

Exceptions