Amazon Verified Permissions

2023/11/17 - Amazon Verified Permissions - 1 new api methods

Changes  Adding BatchIsAuthorized API which supports multiple authorization requests against a PolicyStore

BatchIsAuthorized (new) Link ΒΆ

Makes a series of decisions about multiple authorization requests for one principal or resource. Each request contains the equivalent content of an IsAuthorized request: principal, action, resource, and context. Either the principal or the resource parameter must be identical across all requests. For example, Verified Permissions won't evaluate a pair of requests where bob views photo1 and alice views photo2. Authorization of bob to view photo1 and photo2, or bob and alice to view photo1, are valid batches.

The request is evaluated against all policies in the specified policy store that match the entities that you declare. The result of the decisions is a series of Allow or Deny responses, along with the IDs of the policies that produced each decision.

The entities of a BatchIsAuthorized API request can contain up to 100 principals and up to 100 resources. The requests of a BatchIsAuthorized API request can contain up to 30 requests.

See also: AWS API Documentation

Request Syntax

client.batch_is_authorized(
    policyStoreId='string',
    entities={
        'entityList': [
            {
                'identifier': {
                    'entityType': 'string',
                    'entityId': 'string'
                },
                'attributes': {
                    'string': {
                        'boolean': True|False,
                        'entityIdentifier': {
                            'entityType': 'string',
                            'entityId': 'string'
                        },
                        'long': 123,
                        'string': 'string',
                        'set': [
                            {'... recursive ...'},
                        ],
                        'record': {
                            'string': {'... recursive ...'}
                        }
                    }
                },
                'parents': [
                    {
                        'entityType': 'string',
                        'entityId': 'string'
                    },
                ]
            },
        ]
    },
    requests=[
        {
            'principal': {
                'entityType': 'string',
                'entityId': 'string'
            },
            'action': {
                'actionType': 'string',
                'actionId': 'string'
            },
            'resource': {
                'entityType': 'string',
                'entityId': 'string'
            },
            'context': {
                'contextMap': {
                    'string': {
                        'boolean': True|False,
                        'entityIdentifier': {
                            'entityType': 'string',
                            'entityId': 'string'
                        },
                        'long': 123,
                        'string': 'string',
                        'set': [
                            {'... recursive ...'},
                        ],
                        'record': {
                            'string': {'... recursive ...'}
                        }
                    }
                }
            }
        },
    ]
)
type policyStoreId:

string

param policyStoreId:

[REQUIRED]

Specifies the ID of the policy store. Policies in this policy store will be used to make the authorization decisions for the input.

type entities:

dict

param entities:

Specifies the list of resources and principals and their associated attributes that Verified Permissions can examine when evaluating the policies.

  • entityList (list) --

    An array of entities that are needed to successfully evaluate an authorization request. Each entity in this array must include an identifier for the entity, the attributes of the entity, and a list of any parent entities.

    • (dict) --

      Contains information about an entity that can be referenced in a Cedar policy.

      This data type is used as one of the fields in the EntitiesDefinition structure.

      { "identifier": { "entityType": "Photo", "entityId": "VacationPhoto94.jpg" }, "attributes": {}, "parents": [ { "entityType": "Album", "entityId": "alice_folder" } ] }

      • identifier (dict) -- [REQUIRED]

        The identifier of the entity.

        • entityType (string) -- [REQUIRED]

          The type of an entity.

          Example: "entityType":"typeName"

        • entityId (string) -- [REQUIRED]

          The identifier of an entity.

          "entityId":"identifier"

      • attributes (dict) --

        A list of attributes for the entity.

        • (string) --

          • (dict) --

            The value of an attribute.

            Contains information about the runtime context for a request for which an authorization decision is made.

            This data type is used as a member of the ContextDefinition structure which is uses as a request parameter for the IsAuthorized, BatchIsAuthorized, and IsAuthorizedWithToken operations.

            • boolean (boolean) --

              An attribute value of Boolean type.

              Example: {"boolean": true}

            • entityIdentifier (dict) --

              An attribute value of type EntityIdentifier.

              Example: "entityIdentifier": { "entityId": "<id>", "entityType": "<entity type>"}

              • entityType (string) -- [REQUIRED]

                The type of an entity.

                Example: "entityType":"typeName"

              • entityId (string) -- [REQUIRED]

                The identifier of an entity.

                "entityId":"identifier"

            • long (integer) --

              An attribute value of Long type.

              Example: {"long": 0}

            • string (string) --

              An attribute value of String type.

              Example: {"string": "abc"}

            • set (list) --

              An attribute value of Set type.

              Example: {"set": [ {} ] }

              • (dict) --

                The value of an attribute.

                Contains information about the runtime context for a request for which an authorization decision is made.

                This data type is used as a member of the ContextDefinition structure which is uses as a request parameter for the IsAuthorized, BatchIsAuthorized, and IsAuthorizedWithToken operations.

            • record (dict) --

              An attribute value of Record type.

              Example: {"record": { "keyName": {} } }

              • (string) --

                • (dict) --

                  The value of an attribute.

                  Contains information about the runtime context for a request for which an authorization decision is made.

                  This data type is used as a member of the ContextDefinition structure which is uses as a request parameter for the IsAuthorized, BatchIsAuthorized, and IsAuthorizedWithToken operations.

      • parents (list) --

        The parents in the hierarchy that contains the entity.

        • (dict) --

          Contains the identifier of an entity, including its ID and type.

          This data type is used as a request parameter for IsAuthorized operation, and as a response parameter for the CreatePolicy, GetPolicy, and UpdatePolicy operations.

          Example: {"entityId":"string","entityType":"string"}

          • entityType (string) -- [REQUIRED]

            The type of an entity.

            Example: "entityType":"typeName"

          • entityId (string) -- [REQUIRED]

            The identifier of an entity.

            "entityId":"identifier"

type requests:

list

param requests:

[REQUIRED]

An array of up to 30 requests that you want Verified Permissions to evaluate.

  • (dict) --

    An authorization request that you include in a BatchIsAuthorized API request.

    • principal (dict) --

      Specifies the principal for which the authorization decision is to be made.

      • entityType (string) -- [REQUIRED]

        The type of an entity.

        Example: "entityType":"typeName"

      • entityId (string) -- [REQUIRED]

        The identifier of an entity.

        "entityId":"identifier"

    • action (dict) --

      Specifies the requested action to be authorized. For example, is the principal authorized to perform this action on the resource?

      • actionType (string) -- [REQUIRED]

        The type of an action.

      • actionId (string) -- [REQUIRED]

        The ID of an action.

    • resource (dict) --

      Specifies the resource for which the authorization decision is to be made.

      • entityType (string) -- [REQUIRED]

        The type of an entity.

        Example: "entityType":"typeName"

      • entityId (string) -- [REQUIRED]

        The identifier of an entity.

        "entityId":"identifier"

    • context (dict) --

      Specifies additional context that can be used to make more granular authorization decisions.

      • contextMap (dict) --

        An list of attributes that are needed to successfully evaluate an authorization request. Each attribute in this array must include a map of a data type and its value.

        Example: "contextMap":{"<KeyName1>":{"boolean":true},"<KeyName2>":{"long":1234}}

        • (string) --

          • (dict) --

            The value of an attribute.

            Contains information about the runtime context for a request for which an authorization decision is made.

            This data type is used as a member of the ContextDefinition structure which is uses as a request parameter for the IsAuthorized, BatchIsAuthorized, and IsAuthorizedWithToken operations.

            • boolean (boolean) --

              An attribute value of Boolean type.

              Example: {"boolean": true}

            • entityIdentifier (dict) --

              An attribute value of type EntityIdentifier.

              Example: "entityIdentifier": { "entityId": "<id>", "entityType": "<entity type>"}

              • entityType (string) -- [REQUIRED]

                The type of an entity.

                Example: "entityType":"typeName"

              • entityId (string) -- [REQUIRED]

                The identifier of an entity.

                "entityId":"identifier"

            • long (integer) --

              An attribute value of Long type.

              Example: {"long": 0}

            • string (string) --

              An attribute value of String type.

              Example: {"string": "abc"}

            • set (list) --

              An attribute value of Set type.

              Example: {"set": [ {} ] }

              • (dict) --

                The value of an attribute.

                Contains information about the runtime context for a request for which an authorization decision is made.

                This data type is used as a member of the ContextDefinition structure which is uses as a request parameter for the IsAuthorized, BatchIsAuthorized, and IsAuthorizedWithToken operations.

            • record (dict) --

              An attribute value of Record type.

              Example: {"record": { "keyName": {} } }

              • (string) --

                • (dict) --

                  The value of an attribute.

                  Contains information about the runtime context for a request for which an authorization decision is made.

                  This data type is used as a member of the ContextDefinition structure which is uses as a request parameter for the IsAuthorized, BatchIsAuthorized, and IsAuthorizedWithToken operations.

rtype:

dict

returns:

Response Syntax

{
    'results': [
        {
            'request': {
                'principal': {
                    'entityType': 'string',
                    'entityId': 'string'
                },
                'action': {
                    'actionType': 'string',
                    'actionId': 'string'
                },
                'resource': {
                    'entityType': 'string',
                    'entityId': 'string'
                },
                'context': {
                    'contextMap': {
                        'string': {
                            'boolean': True|False,
                            'entityIdentifier': {
                                'entityType': 'string',
                                'entityId': 'string'
                            },
                            'long': 123,
                            'string': 'string',
                            'set': [
                                {'... recursive ...'},
                            ],
                            'record': {
                                'string': {'... recursive ...'}
                            }
                        }
                    }
                }
            },
            'decision': 'ALLOW'|'DENY',
            'determiningPolicies': [
                {
                    'policyId': 'string'
                },
            ],
            'errors': [
                {
                    'errorDescription': 'string'
                },
            ]
        },
    ]
}

Response Structure

  • (dict) --

    • results (list) --

      A series of Allow or Deny decisions for each request, and the policies that produced them.

      • (dict) --

        The decision, based on policy evaluation, from an individual authorization request in a BatchIsAuthorized API request.

        • request (dict) --

          The authorization request that initiated the decision.

          • principal (dict) --

            Specifies the principal for which the authorization decision is to be made.

            • entityType (string) --

              The type of an entity.

              Example: "entityType":"typeName"

            • entityId (string) --

              The identifier of an entity.

              "entityId":"identifier"

          • action (dict) --

            Specifies the requested action to be authorized. For example, is the principal authorized to perform this action on the resource?

            • actionType (string) --

              The type of an action.

            • actionId (string) --

              The ID of an action.

          • resource (dict) --

            Specifies the resource for which the authorization decision is to be made.

            • entityType (string) --

              The type of an entity.

              Example: "entityType":"typeName"

            • entityId (string) --

              The identifier of an entity.

              "entityId":"identifier"

          • context (dict) --

            Specifies additional context that can be used to make more granular authorization decisions.

            • contextMap (dict) --

              An list of attributes that are needed to successfully evaluate an authorization request. Each attribute in this array must include a map of a data type and its value.

              Example: "contextMap":{"<KeyName1>":{"boolean":true},"<KeyName2>":{"long":1234}}

              • (string) --

                • (dict) --

                  The value of an attribute.

                  Contains information about the runtime context for a request for which an authorization decision is made.

                  This data type is used as a member of the ContextDefinition structure which is uses as a request parameter for the IsAuthorized, BatchIsAuthorized, and IsAuthorizedWithToken operations.

                  • boolean (boolean) --

                    An attribute value of Boolean type.

                    Example: {"boolean": true}

                  • entityIdentifier (dict) --

                    An attribute value of type EntityIdentifier.

                    Example: "entityIdentifier": { "entityId": "<id>", "entityType": "<entity type>"}

                    • entityType (string) --

                      The type of an entity.

                      Example: "entityType":"typeName"

                    • entityId (string) --

                      The identifier of an entity.

                      "entityId":"identifier"

                  • long (integer) --

                    An attribute value of Long type.

                    Example: {"long": 0}

                  • string (string) --

                    An attribute value of String type.

                    Example: {"string": "abc"}

                  • set (list) --

                    An attribute value of Set type.

                    Example: {"set": [ {} ] }

                    • (dict) --

                      The value of an attribute.

                      Contains information about the runtime context for a request for which an authorization decision is made.

                      This data type is used as a member of the ContextDefinition structure which is uses as a request parameter for the IsAuthorized, BatchIsAuthorized, and IsAuthorizedWithToken operations.

                  • record (dict) --

                    An attribute value of Record type.

                    Example: {"record": { "keyName": {} } }

                    • (string) --

                      • (dict) --

                        The value of an attribute.

                        Contains information about the runtime context for a request for which an authorization decision is made.

                        This data type is used as a member of the ContextDefinition structure which is uses as a request parameter for the IsAuthorized, BatchIsAuthorized, and IsAuthorizedWithToken operations.

        • decision (string) --

          An authorization decision that indicates if the authorization request should be allowed or denied.

        • determiningPolicies (list) --

          The list of determining policies used to make the authorization decision. For example, if there are two matching policies, where one is a forbid and the other is a permit, then the forbid policy will be the determining policy. In the case of multiple matching permit policies then there would be multiple determining policies. In the case that no policies match, and hence the response is DENY, there would be no determining policies.

          • (dict) --

            Contains information about one of the policies that determined an authorization decision.

            This data type is used as an element in a response parameter for the IsAuthorized, BatchIsAuthorized, and IsAuthorizedWithToken operations.

            Example: "determiningPolicies":[{"policyId":"SPEXAMPLEabcdefg111111"}]

            • policyId (string) --

              The Id of a policy that determined to an authorization decision.

              Example: "policyId":"SPEXAMPLEabcdefg111111"

        • errors (list) --

          Errors that occurred while making an authorization decision, for example, a policy references an Entity or entity Attribute that does not exist in the slice.