UserPoolAuthorizerProps

class aws_cdk.aws_apigatewayv2_authorizers.UserPoolAuthorizerProps(*, user_pool, user_pool_clients, authorizer_name=None, identity_source=None, user_pool_region=None)

Bases: object

(experimental) Properties to initialize UserPoolAuthorizer.

Parameters
  • user_pool (IUserPool) – (experimental) The associated user pool.

  • user_pool_clients (Sequence[IUserPoolClient]) – (experimental) The user pool clients that should be used to authorize requests with the user pool.

  • authorizer_name (Optional[str]) – (experimental) The name of the authorizer. Default: ‘UserPoolAuthorizer’

  • identity_source (Optional[Sequence[str]]) – (experimental) The identity source for which authorization is requested. Default: [‘$request.header.Authorization’]

  • user_pool_region (Optional[str]) – (experimental) The AWS region in which the user pool is present. Default: - same region as the Route the authorizer is attached to.

Stability

experimental

Example:

import aws_cdk.aws_cognito as cognito
from aws_cdk.aws_apigatewayv2_authorizers import HttpUserPoolAuthorizer
from aws_cdk.aws_apigatewayv2_integrations import HttpProxyIntegration


user_pool = cognito.UserPool(self, "UserPool")
user_pool_client = user_pool.add_client("UserPoolClient")

authorizer = HttpUserPoolAuthorizer(
    user_pool=user_pool,
    user_pool_clients=[user_pool_client]
)

api = apigwv2.HttpApi(self, "HttpApi")

api.add_routes(
    integration=HttpProxyIntegration(
        url="https://get-books-proxy.myproxy.internal"
    ),
    path="/books",
    authorizer=authorizer
)

Attributes

authorizer_name

(experimental) The name of the authorizer.

Default

‘UserPoolAuthorizer’

Stability

experimental

Return type

Optional[str]

identity_source

(experimental) The identity source for which authorization is requested.

Default

[‘$request.header.Authorization’]

Stability

experimental

Return type

Optional[List[str]]

user_pool

(experimental) The associated user pool.

Stability

experimental

Return type

IUserPool

user_pool_clients

(experimental) The user pool clients that should be used to authorize requests with the user pool.

Stability

experimental

Return type

List[IUserPoolClient]

user_pool_region

(experimental) The AWS region in which the user pool is present.

Default
  • same region as the Route the authorizer is attached to.

Stability

experimental

Return type

Optional[str]