HttpUserPoolAuthorizer
- class aws_cdk.aws_apigatewayv2_authorizers.HttpUserPoolAuthorizer(id, pool, *, authorizer_name=None, identity_source=None, user_pool_clients=None, user_pool_region=None)
Bases:
object
Authorize Http Api routes on whether the requester is registered as part of an AWS Cognito user pool.
- ExampleMetadata:
infused
Example:
import aws_cdk.aws_cognito as cognito from aws_cdk.aws_apigatewayv2_authorizers import HttpUserPoolAuthorizer from aws_cdk.aws_apigatewayv2_integrations import HttpUrlIntegration user_pool = cognito.UserPool(self, "UserPool") authorizer = HttpUserPoolAuthorizer("BooksAuthorizer", user_pool) api = apigwv2.HttpApi(self, "HttpApi") api.add_routes( integration=HttpUrlIntegration("BooksIntegration", "https://get-books-proxy.example.com"), path="/books", authorizer=authorizer )
Initialize a Cognito user pool authorizer to be bound with HTTP route.
- Parameters:
id (
str
) – The id of the underlying construct.pool (
IUserPool
) – The user pool to use for authorization.authorizer_name (
Optional
[str
]) – Friendly name of the authorizer. Default: - same value asid
passed in the constructoridentity_source (
Optional
[Sequence
[str
]]) – The identity source for which authorization is requested. Default: [‘$request.header.Authorization’]user_pool_clients (
Optional
[Sequence
[IUserPoolClient
]]) – The user pool clients that should be used to authorize requests with the user pool. Default: - a new client will be created for the given user pooluser_pool_region (
Optional
[str
]) – The AWS region in which the user pool is present. Default: - same region as the Route the authorizer is attached to.
Methods
- bind(*, route, scope)
Bind this authorizer to a specified Http route.
- Parameters:
route (
IHttpRoute
) – The route to which the authorizer is being bound.scope (
Construct
) – The scope for any constructs created as part of the bind.
- Return type:
Attributes
- authorization_type
The authorizationType used for UserPool Authorizer.
- authorizer_id
Return the id of the authorizer if it’s been constructed.