Skip to content

feat(agentcore): add identity L2 constructs#37610

Merged
mergify[bot] merged 17 commits intoaws:mainfrom
krokoko:agentcore-identity
May 7, 2026
Merged

feat(agentcore): add identity L2 constructs#37610
mergify[bot] merged 17 commits intoaws:mainfrom
krokoko:agentcore-identity

Conversation

@krokoko
Copy link
Copy Markdown
Contributor

@krokoko krokoko commented Apr 15, 2026

Issue # (if applicable)

Add L2 CDK constructs for:

to the agentcore package. Update also the gateway construct to support the credentials providers when configuring outbound auth for a target

Reason for this change

Feature gap

Description of changes

  • Updated the existing gateway construct
  • Added a new folder with the new L2 constructs for identity
  • BREAKING CHANGE: ICredentialProviderConfig.grantNeededPermissionsToRole parameter renamed from role (IRole) to gateway (IGateway) so the implementation can derive scoped resource ARNs (e.g. workload identity wildcards keyed on gateway name) and attach policies to the gateway's execution role in a single call, rather than requiring callers to pass both separately.

Describe any new or updated permissions being added

Exposed the permissions specific to the identity providers

Description of how you validated changes

  • added unit tests
  • added integration tests
  • deployed couple of examples:

Examples:

  1. Created a cdk stack linking against the custom package

With:

const apiKeyProvider = new agentcore.ApiKeyCredentialProvider(this, 'ApiKeyIdentityTestScoped', {
      apiKeyCredentialProviderName: 'test-scoped-api-key-provider',
      apiKey: cdk.SecretValue.unsafePlainText('integ-placeholder-api-key'),
      tags: { integ: 'gateway-identity-outbound' },
    });

    const oauthProvider = agentcore.OAuth2CredentialProvider.usingGithub(this, 'OAuthIdentityTestScoped', {
      oAuth2CredentialProviderName: 'test-scoped-oauth-provider',
      clientId: 'integ-github-client-id',
      clientSecret: cdk.SecretValue.unsafePlainText('integ-github-client-secret'),
      tags: { integ: 'gateway-identity-outbound' },
    });

    const workloadIdentity = new agentcore.WorkloadIdentity(this, 'WorkloadIdentityTestScoped', {
      workloadIdentityName: 'test-scoped-workload-identity',
      tags: { integ: 'workload-identity-outbound' },
    });

The following resources are deployed:

image
  1. Creating a workload identity
new agentcore.WorkloadIdentity(this, 'WorkloadIdentity', {
      workloadIdentityName: 'integ-workload-identity-outbound',
      tags: { integ: 'workload-identity-outbound' },
    });
image
  1. Deploying a gateway with target
const gateway = new agentcore.Gateway(this, 'Gateway', {
      gatewayName: 'integ-gateway-identity-outbound',
      description: 'Gateway with OpenAPI targets wired to Token Vault L2 identities',
      // Inbound IAM avoids default Cognito domain (global uniqueness); this integ focuses on outbound Token Vault auth.
      authorizerConfiguration: agentcore.GatewayAuthorizer.usingAwsIam(),
    });

    const openApiSchema = agentcore.ApiSchema.fromInline(
      JSON.stringify({
        openapi: '3.0.0',
        info: { title: 'GatewayIdentityOutboundInteg', version: '1.0.0' },
        servers: [{ url: 'https://example.com' }],
        paths: {
          '/ping': {
            get: {
              operationId: 'ping',
              responses: { 200: { description: 'ok' } },
            },
          },
        },
      }),
    );

    const apiKeyProvider = new agentcore.ApiKeyCredentialProvider(this, 'ApiKeyIdentity', {
      apiKeyCredentialProviderName: 'integ-gw-outbound-apikey',
      apiKey: cdk.SecretValue.unsafePlainText('integ-placeholder-api-key'),
      tags: { integ: 'gateway-identity-outbound' },
    });

    gateway.addOpenApiTarget('OpenApiApiKeyTarget', {
      gatewayTargetName: 'integ-openapi-api-key',
      description: 'OpenAPI target with API key Token Vault identity',
      apiSchema: openApiSchema,
      credentialProviderConfigurations: [agentcore.GatewayCredentialProvider.fromApiKeyIdentity(apiKeyProvider)],
    });

Deploys correctly

image image image

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 valued-contributor [Pilot] contributed between 6-12 PRs to the CDK p2 labels Apr 15, 2026
@aws-cdk-automation aws-cdk-automation requested a review from a team April 15, 2026 23:14
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 15, 2026

⚠️ Experimental Feature: This security report is currently in experimental phase. Results may include false positives and the rules are being actively refined.
This security report is NOT a review blocker. Please try merge from main to avoid findings unrelated to the PR.
To suppress a specific rule, see Suppressing Rules.


TestsPassed ✅SkippedFailed
Security Guardian Results144 ran144 passed
TestResult
No test annotations available

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 15, 2026

⚠️ Experimental Feature: This security report is currently in experimental phase. Results may include false positives and the rules are being actively refined.
This security report is NOT a review blocker. Please try merge from main to avoid findings unrelated to the PR.
To suppress a specific rule, see Suppressing Rules.


TestsPassed ✅SkippedFailed
Security Guardian Results with resolved templates144 ran144 passed
TestResult
No test annotations available

@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 Apr 15, 2026
@aws-cdk-automation
Copy link
Copy Markdown
Collaborator

This PR cannot be merged because it has conflicts. Please resolve them. The PR will be considered stale and closed if it remains in an unmergeable state.

@krokoko krokoko temporarily deployed to deployment-integ-test May 5, 2026 22:37 — with GitHub Actions Inactive
kumvprat
kumvprat previously approved these changes May 6, 2026
@mergify
Copy link
Copy Markdown
Contributor

mergify Bot commented May 6, 2026

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@mergify
Copy link
Copy Markdown
Contributor

mergify Bot commented May 6, 2026

Merge Queue Status

  • Entered queue2026-05-06 10:27 UTC · Rule: default-squash
  • 🚫 Left the queue2026-05-06 10:54 UTC · at a8fe50443cf7b5ff34aab3d20e0bcaa5a5eb4da7

This pull request spent 26 minutes 41 seconds in the queue, with no time running CI.

Reason

The pull request can't be updated

For security reasons, Mergify can't update this pull request. Try updating locally.
GitHub response: refusing to allow a GitHub App to create or update workflow .github/workflows/pr-issue-check.yml without workflows permission

Hint

You should update or rebase your pull request manually. If you do, this pull request will automatically be requeued once the queue conditions match again.
If you think this was a flaky issue, you can requeue the pull request, without updating it, by posting a @mergifyio queue comment.

@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 May 6, 2026
@mergify
Copy link
Copy Markdown
Contributor

mergify Bot commented May 6, 2026

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@kumvprat kumvprat had a problem deploying to deployment-integ-test May 6, 2026 15:14 — with GitHub Actions Failure
@mergify mergify Bot dismissed kumvprat’s stale review May 6, 2026 15:15

Pull request has been modified.

kumvprat
kumvprat previously approved these changes May 6, 2026
@kumvprat kumvprat deployed to deployment-integ-test May 7, 2026 14:28 — with GitHub Actions Active
@alvazjor
Copy link
Copy Markdown
Contributor

alvazjor commented May 7, 2026

@Mergifyio queue

@mergify
Copy link
Copy Markdown
Contributor

mergify Bot commented May 7, 2026

Merge Queue Status

🛑 Queue command has been cancelled

@mergify
Copy link
Copy Markdown
Contributor

mergify Bot commented May 7, 2026

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

1 similar comment
@mergify
Copy link
Copy Markdown
Contributor

mergify Bot commented May 7, 2026

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@mergify
Copy link
Copy Markdown
Contributor

mergify Bot commented May 7, 2026

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@alvazjor
Copy link
Copy Markdown
Contributor

alvazjor commented May 7, 2026

@Mergifyio queue

@mergify
Copy link
Copy Markdown
Contributor

mergify Bot commented May 7, 2026

Merge Queue Status

  • Entered queue2026-05-07 16:19 UTC · Rule: priority-squash
  • Checks skipped · PR is already up-to-date
  • Merged2026-05-07 16:19 UTC · at 732a5084cfed751003f91d0f24ab59e68237cd42 · squash

This pull request spent 27 seconds in the queue, including 3 seconds running CI.

Required conditions to merge

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 7, 2026

Comments on closed issues and PRs are hard for our team to see.
If you need help, please open a new issue that references this one.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

p2 pr/needs-further-review PR requires additional review from our team specialists due to the scope or complexity of changes. priority-pr push the PR to priority squash queue valued-contributor [Pilot] contributed between 6-12 PRs to the CDK

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants