Skip to content

Bedrock AgentCore Runtime: authenticate multi-tenant browser calls using each tenant's existing app JWTs (no Cognito, no shared secrets)

0

We want one Amazon Bedrock AgentCore Runtime, a Strands agent with Knowledge Base search and per-user AgentCore Memory, shared by several tenants. Logged-in users call it from each tenant's web frontend.

Each tenant runs its own backend (for example tenant1.example.com, tenant2.example.com) with its own users, login and JWTs. Every call to the runtime has to be authenticated and tied to the correct tenant and user.

Constraints

No AWS credentials in the browser. User data can't be exported to Cognito or any other IdP. Each tenant backend stays the source of truth. Tenant signing keys and secrets can't be copied to AWS, and the tenants' JWT issuing can't change. The frontend keeps using its existing app JWT. It gets no new token to manage. One runtime serves all tenants, with isolation of memory, KB results and logs by tenant and user. Tenants can be enabled or disabled without redeploying the runtime.

Why customJWTAuthorizer alone doesn't fit

It needs an OIDC discovery URL and verifies signatures with the keys it publishes. Our tenant tokens may be HS256 with no discovery endpoint. It takes one discovery URL (one issuer) per runtime. We have one issuer per tenant. It has no concept of enabled or disabled tenants. A runtime accepts either IAM or JWT, not both.

3 Answers
0
EXPERT

answered a month ago

0

Short answer: You can't get the runtime to validate those JWTs directly — and under your constraints you don't need it to. Keep JWT validation in each tenant's backend, and let the backends call the one runtime with IAM.

Why customJWTAuthorizer can't do it: a runtime takes one inbound auth configuration — either SigV4 or CUSTOM_JWT, not both. CUSTOM_JWT takes a single OIDC discovery URL and validates tokens against the JWKS it publishes. That rules out HS256 tokens with no discovery endpoint, and it rules out N issuers on one runtime. It also has no tenant registry, so tenant enable/disable has to live somewhere else anyway.

Pattern that fits your constraints:

  1. Browser → tenant backend, exactly as today. The frontend token, the login flow, and the signing keys don't change, and no secret is copied anywhere.
  2. The tenant backend validates its own JWT locally. It issued the token, so it's the only party that can verify an HS256 signature without the secret leaving the tenant.
  3. The backend calls InvokeAgentRuntime with SigV4, using a dedicated IAM role per tenant backend, scoped to invoking that single runtime. Tenant identity now comes from the verified AWS caller, not from a claim the client controls.
  4. Pass the user ID in the invocation payload. In the agent, namespace Memory with actorId = the user and a session ID namespaced per tenant + user, and apply a per-tenant metadata filter on Knowledge Base retrieval, so memory, KB results, and logs stay isolated.
  5. Tenant on/off: keep an allowlist (a DynamoDB table works) checked in the call path. Disabling a tenant is a config flip — nothing redeploys.

One trade-off to accept: with IAM inbound auth, user identity is asserted by the backend rather than verified by AgentCore, which is why scoping each tenant role to the one runtime matters. I use the same per-agent scoped-role approach in my own work: https://doi.org/10.5281/zenodo.23420912

answered 20 days ago

0

The IAM-based backend-to-runtime architecture proposed above is a good fit for this scenario. I would add a few security controls before considering it production-ready.

1. Establish a trusted user identity

The tenant backend should validate the existing application JWT and derive the user identity from its verified subject (sub) claim.

Never accept a user ID or tenant ID supplied independently by the browser as the source of authorization.

Amazon Bedrock AgentCore also supports user identity delegation through the X-Amzn-Bedrock-AgentCore-Runtime-User-Id header and the bedrock-agentcore:InvokeAgentRuntimeForUser permission.

This can improve user-level identity propagation and auditing. The backend must still ensure that the delegated user ID corresponds to the authenticated application user.

2. Derive tenant identity from the authenticated caller

Use a dedicated IAM role for each tenant backend, with permission scoped to the intended AgentCore Runtime.

The runtime should maintain a trusted mapping between the authenticated IAM principal and its tenant identifier.

Do not derive tenant identity exclusively from the invocation payload.

3. Enforce isolation at every data access boundary

For AgentCore Memory:

  • Use a tenant-aware actor identifier.
  • Namespace session IDs using tenant and user identifiers.
  • Prevent users from accessing sessions belonging to other tenants.

For Knowledge Base retrieval:

  • Apply tenant-specific metadata filters.
  • Derive the filter from trusted backend identity.
  • Enforce the filter inside the retrieval tool rather than relying on the agent prompt.

4. Treat observability as a separate isolation requirement

A shared runtime may produce centralized CloudWatch logs. Memory isolation does not automatically provide log isolation.

Include tenant ID, user ID, authenticated IAM principal, session ID, and authorization decision in structured audit events.

Apply appropriate IAM permissions and retention controls to prevent unauthorized access to another tenant's audit data.

5. Make tenant onboarding and offboarding dynamic

Maintain a tenant registry, for example in DynamoDB, containing:

  • Tenant identifier
  • IAM role or principal mapping
  • Enabled/disabled status
  • Allowed resources and configuration

Check the tenant status before every invocation. Disabling a tenant should immediately prevent new requests, without requiring a runtime redeployment.

Overall, I would use three independent security boundaries: backend authentication, IAM-based runtime invocation, and tenant-aware authorization at every data access point.

This provides defense in depth while allowing tenants to retain ownership of their existing identity systems.

answered 9 days ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.