batchIsAuthorizedWithToken

Makes a series of decisions about multiple authorization requests for one token. The principal in this request comes from an external identity source in the form of an identity or access token, formatted as a JSON web token (JWT). The information in the parameters can also define additional context that Verified Permissions can include in the evaluations.

The request is evaluated against all policies in the specified policy store that match the entities that you provide in the entities declaration and in the token. 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 BatchIsAuthorizedWithToken API request can contain up to 100 resources and up to 99 user groups. The requests of a BatchIsAuthorizedWithToken API request can contain up to 30 requests.

The BatchIsAuthorizedWithToken operation doesn't have its own IAM permission. To authorize this operation for Amazon Web Services principals, include the permission verifiedpermissions:IsAuthorizedWithToken in their IAM policies.

Samples

import aws.sdk.kotlin.services.verifiedpermissions.model.ActionIdentifier
import aws.sdk.kotlin.services.verifiedpermissions.model.BatchIsAuthorizedWithTokenInputItem
import aws.sdk.kotlin.services.verifiedpermissions.model.EntitiesDefinition
import aws.sdk.kotlin.services.verifiedpermissions.model.EntityIdentifier
import aws.sdk.kotlin.services.verifiedpermissions.model.EntityItem

fun main() { 
   //sampleStart 
   // The following example requests three authorization decisions for two resources and two actions in
// different photo albums.
val resp = verifiedPermissionsClient.batchIsAuthorizedWithToken {
    identityToken = "eyJra12345EXAMPLE"
    requests = listOf<BatchIsAuthorizedWithTokenInputItem>(
        BatchIsAuthorizedWithTokenInputItem {
            action = ActionIdentifier {
                actionType = "PhotoFlash::Action"
                actionId = "ViewPhoto"
            }
            resource = EntityIdentifier {
                entityType = "PhotoFlash::Photo"
                entityId = "VacationPhoto94.jpg"
            }
        },
        BatchIsAuthorizedWithTokenInputItem {
            action = ActionIdentifier {
                actionType = "PhotoFlash::Action"
                actionId = "SharePhoto"
            }
            resource = EntityIdentifier {
                entityType = "PhotoFlash::Photo"
                entityId = "VacationPhoto94.jpg"
            }
        },
        BatchIsAuthorizedWithTokenInputItem {
            action = ActionIdentifier {
                actionType = "PhotoFlash::Action"
                actionId = "ViewPhoto"
            }
            resource = EntityIdentifier {
                entityType = "PhotoFlash::Photo"
                entityId = "OfficePhoto94.jpg"
            }
        }            
    )
    entities = EntitiesDefinition.EntityList(listOf<EntityItem>(
        EntityItem {
            identifier = EntityIdentifier {
                entityType = "PhotoFlash::Photo"
                entityId = "VacationPhoto94.jpg"
            }
            parents = listOf<EntityIdentifier>(
                EntityIdentifier {
                    entityType = "PhotoFlash::Album"
                    entityId = "MyExampleAlbum1"
                }                    
            )
        },
        EntityItem {
            identifier = EntityIdentifier {
                entityType = "PhotoFlash::Photo"
                entityId = "OfficePhoto94.jpg"
            }
            parents = listOf<EntityIdentifier>(
                EntityIdentifier {
                    entityType = "PhotoFlash::Album"
                    entityId = "MyExampleAlbum2"
                }                    
            )
        }            
    )
    )
    policyStoreId = "C7v5xMplfFH3i3e4Jrzb1a"
} 
   //sampleEnd
}