Skip to content

Conversation

@krokoko
Copy link
Contributor

@krokoko krokoko commented Jan 28, 2026

Issue # (if applicable)

Add support for allowed audience to runtime and gateway JWT authorizers

see https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/inbound-jwt-authorizer.html, as well as https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/aws-properties-bedrockagentcore-runtime-customjwtauthorizerconfiguration.html and https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/aws-properties-bedrockagentcore-gateway-customjwtauthorizerconfiguration.html

Reason for this change

Coverage of missing features

Description of changes

Add missing properties to existing code

Describe any new or updated permissions being added

No changes in perms

Description of how you validated changes

Added unit tests
Updated an integ test

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 valued-contributor [Pilot] contributed between 6-12 PRs to the CDK label Jan 28, 2026
@aws-cdk-automation aws-cdk-automation requested a review from a team January 28, 2026 21:50
@github-actions github-actions bot added the p2 label Jan 28, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Jan 28, 2026

⚠️ Experimental Feature: This security report is currently in experimental phase. Results may include false positives and the rules are being actively refined.
Please try merge from main to avoid findings unrelated to the PR.


TestsPassed ✅SkippedFailed
Security Guardian Results24 ran24 passed
TestResult
No test annotations available

@github-actions
Copy link
Contributor

github-actions bot commented Jan 28, 2026

⚠️ Experimental Feature: This security report is currently in experimental phase. Results may include false positives and the rules are being actively refined.
Please try merge from main to avoid findings unrelated to the PR.


TestsPassed ✅SkippedFailed
Security Guardian Results with resolved templates24 ran24 passed
TestResult
No test annotations available

@aws-cdk-automation aws-cdk-automation added pr/needs-further-review PR requires additional review from our team specialists due to the scope or complexity of changes. pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member. labels Jan 28, 2026
@alvazjor alvazjor self-assigned this Jan 30, 2026
@alvazjor alvazjor changed the title feat(agentcore): add support for custom claims and scopes to runtime/gateway authorizers feat(bedrock-agentcore-alpha): add support for custom claims and scopes to runtime/gateway authorizers Jan 30, 2026
Copy link
Contributor

@alvazjor alvazjor left a comment

Choose a reason for hiding this comment

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

@krokoko added some suggestions

private readonly value: string | string[],
) {
// Validate that value matches the valueType
if (valueType === CustomClaimValueType.STRING && typeof value !== 'string') {
Copy link
Contributor

Choose a reason for hiding this comment

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

Since value is an open string(s), lets do an initial validation to check if it is a token

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done in 003c6e3

/**
* Custom claim match operator for Gateway JWT authorizers.
*/
export enum GatewayCustomClaimOperator {
Copy link
Contributor

@alvazjor alvazjor Jan 30, 2026

Choose a reason for hiding this comment

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

To avoid this duplication of enums, I think is ok to have a single type called CustomClaimValueType and CustomClaimOperator and reuse both on the gatways and runtime. Just dont include that shared file in the index.ts so it wont be exposed as part of the public api

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That is fine for ClaimValueType, but the operator needs to be exposed since users can provide it, for instance:

agentcore.GatewayCustomClaim.withStringArrayValue('roles', ['admin'], agentcore.GatewayCustomClaimOperator.CONTAINS)

Should I re-export it from runtime and gateway ? Something like:

export { CustomClaimOperator as RuntimeCustomClaimOperator } from '../../common/types';

and under common/types:

/**
 * Custom claim match operator.
 * Shared by Runtime and Gateway custom claim implementations.
 * @internal
 */
export enum CustomClaimOperator {
  /** Equals operator - used for STRING type claims */
  EQUALS = 'EQUALS',
  /** Contains operator - used for STRING_ARRAY type claims. Checks if the claim array contains a specific string value. */
  CONTAINS = 'CONTAINS',
  /** ContainsAny operator - used for STRING_ARRAY type claims. Checks if the claim array contains any of the provided string values. */
  CONTAINS_ANY = 'CONTAINS_ANY',
}

Copy link
Contributor

Choose a reason for hiding this comment

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

What I dont like is the duplication part, so would it be a problem if we just keep a generic one? are we expecting them to differ at some point or do we have some knowledge at this time of some condition that justifies having an exact copy just with diff enum names?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, we can keep a generic one ! I will just need to export it publicly. So if I export the common/types file above, does that work ?

Copy link
Contributor

Choose a reason for hiding this comment

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

btw, I think tthe re-export part will also be ok and will work, I just want to avoid potential JSII problems by doing that, but it seems safe, based on the initial research I did

Copy link
Contributor

Choose a reason for hiding this comment

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

No, we can keep a generic one ! I will just need to export it publicly. So if I export the common/types file above, does that work ?

Yep, that works

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok thanks ! I'll do the changes, that will also remove the re-export

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done in 003c6e3

@aws-cdk-automation aws-cdk-automation removed the pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member. label Jan 30, 2026
@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 Jan 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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. valued-contributor [Pilot] contributed between 6-12 PRs to the CDK

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants