Skip to content

(aws-apigatewayv2-authorizers): HttpUserPoolAuthorizer constructor should take and array of user pool client ids #15431

Closed
@dan-lind

Description

The current HttpUserPoolAuthorizer is created like this

const authorizer = new HttpUserPoolAuthorizer({
    userPool: userPool,
    userPoolClient: userPoolClient,
});

This will synthesize to

 "MyTestHttpProxyPrivateApiUserPoolAuthorizer":{
   "Type":"AWS::ApiGatewayV2::Authorizer",
   "Properties":{
      "ApiId":{
         "Ref":"MyTestHttpProxyPrivateApi"
      },
      "AuthorizerType":"JWT",
      "Name":"UserPoolAuthorizer",
      "IdentitySource":[
         "$request.header.Authorization"
      ],
      "JwtConfiguration":{
         "Audience":[
            "<user pool id>"
         ],
         "Issuer":"https://cognito-idp.eu-west-1.amazonaws.com/eu-west-1_XXXXXXXXX"
      }
   }
},

Where the provided user pool client id end up in the Audience array

Use Case

Currently it is possible to provide multiple user pool ids using a HttpJwtAuthorizer

const jwtAuthorizer = new HttpJwtAuthorizer({
    jwtAudience: ['XXXXXX', 'YYYYYY'],
    jwtIssuer: `https://cognito-idp.eu-west-1.amazonaws.com/eu-west-1_XXXXXXXXX`
})

For consistency and ease of use, HttpUserPoolAuthorizer should also allow users to pass an array of user pool clients, rather than a single one.

Proposed Solution

Allow users to pass an array of user pool clients like so

const authorizer = new HttpUserPoolAuthorizer({
    userPool: userPool,
    userPoolClient: [userPoolClient1, userPoolClient2, userPoolClient3]
});
  • 👋 I may be able to implement this feature request
  • ⚠️ This feature might incur a breaking change

This is a 🚀 Feature Request

Metadata

Assignees

No one assigned

    Labels

    @aws-cdk/aws-apigatewayv2-authorizersRelated to aws-apigatewayv2-authorizers packageeffort/smallSmall work item – less than a day of effortfeature-requestA feature should be added or improved.good first issueRelated to contributions. See CONTRIBUTING.mdp2

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions