Skip to content

Conversation

@badmintoncryer
Copy link
Contributor

@badmintoncryer badmintoncryer commented Nov 18, 2025

Issue # (if applicable)

None

Reason for this change

ALB now supports for JWT(JSON Web Token) verification.

https://docs.aws.amazon.com/ja_jp/elasticloadbalancing/latest/application/listener-verify-jwt.html

Description of changes

  • add ListenerAction.authenticateJwt()
  • define AuthenticateJwtAction class

I'm currently aiming to implement basic functionality first, so I do not support the additionalClaims argument. I will add implementation as needed.

Describe any new or updated permissions being added

None

Description of how you validated changes

add both unit and integ tests

Checklist


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

@github-actions github-actions bot added the p2 label Nov 18, 2025
@aws-cdk-automation aws-cdk-automation requested a review from a team November 18, 2025 23:04
@github-actions github-actions bot added the distinguished-contributor [Pilot] contributed 50+ PRs to the CDK label Nov 18, 2025
Copy link
Collaborator

@aws-cdk-automation aws-cdk-automation left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(This review is outdated)

@aws-cdk-automation aws-cdk-automation added the pr/needs-further-review PR requires additional review from our team specialists due to the scope or complexity of changes. label Nov 18, 2025
*
* @see https://docs.aws.amazon.com/elasticloadbalancing/latest/application/listener-verify-jwt.html
*/
public static authenticateJwt(options: AuthenticateJwtOptions): ListenerAction {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One suggestion. If Cognito integration is one of main use cases, how about adding a separate method specifically for Cognito like Bedrock AgentCore?

https://github.com/aws/aws-cdk/blob/main/packages/%40aws-cdk/aws-bedrock-agentcore-alpha/agentcore/runtime/runtime-authorizer-configuration.ts#L62

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the comments! That’s exactly the kind of function implementation I had in mind.
Since the PR might get quite large, I’m planning to first implement a generic authenticateJwt() function, and then add the Cognito-specific implementation in a separate PR.

@aws-cdk-automation aws-cdk-automation dismissed their stale review November 19, 2025 12:58

✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.

Comment on lines +537 to +539
if (listener instanceof ApplicationListener && listener.protocol !== ApplicationProtocol.HTTPS) {
throw new UnscopedValidationError('JWT authentication requires an HTTPS listener. Please use ApplicationProtocol.HTTPS for the listener protocol.');
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This condition causes deployment error.

Actions of type 'jwt-validation' are supported only on HTTPS listeners (Service: ElasticLoadBalancingV2, Status Code: 400, 

@badmintoncryer badmintoncryer marked this pull request as ready for review November 19, 2025 13:53
@aws-cdk-automation aws-cdk-automation added the pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member. label Nov 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

distinguished-contributor [Pilot] contributed 50+ PRs to the CDK p2 pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member. pr/needs-further-review PR requires additional review from our team specialists due to the scope or complexity of changes.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants