5.1 Enterprise Integration Patterns, AuthN/Z & Secrets Management

Key Takeaways

  • Use synchronous requests for measured interactive deadlines, durable asynchronous jobs for long workflows, and eligible Message Batches for asynchronous bulk inference with 50% base token-rate discounts and 24-hour expiry.

  • Use an Adapter and Anti-Corruption Layer (ACL) to isolate Claude's canonical JSON tool contracts from volatile SAP, SOAP, and legacy REST schemas

  • Authenticate callers using the appropriate identity protocol; validate API access tokens and establish scoped downstream identity and authorization rather than forwarding a shared admin key.

  • Enforce authorization deterministically in middleware outside the LLM context window—never depend on system prompt instructions to isolate tenant or record access

  • Keep credentials in approved secret stores, use workload identity and authorized short-lived credentials where possible, and exclude secrets from prompts, tool schemas and telemetry.

Last updated: December 2026

Enterprise Integration Patterns, AuthN/Z & Secrets Management

Enterprise integration represents the single heaviest operational surface in production Claude architectures. Connecting foundation models to SAP, Salesforce, ServiceNow, and proprietary databases requires disciplined topology selection, schema isolation, deterministic identity propagation, and secret handling that minimizes exposure.

Choosing the Right Integration Topology

Every enterprise workflow imposes distinct latency, concurrency, and cost constraints. Selecting the wrong invocation pattern creates gateway timeouts, downstream rate-limit exhaustion, or unnecessary token spend.

PatternLatency / SLACost & ThroughputBest-Fit Enterprise Use CasesCommon Anti-Pattern
Synchronous Request-ResponseInteractive; measure end-to-end deadline and gateway configurationStandard per-token pricing; tight concurrencyLive support copilots, single-record CRM lookup, interactive IDE assistanceRunning multi-minute ERP workflows behind a synchronous HTTP load balancer
Async Queues & WebhooksLong-running work; decoupled worker poolSmooths burst traffic via SQS/Kafka backpressureMulti-step IT provisioning, human-in-the-loop approvals, slow SOAP backendsHolding a blocking connection for the whole job or losing completion events
Message Batches APIBest-effort asynchronous; expires after 24 hours50% discount on input/output tokens; up to 100,000 requests or 256 MB per batchNightly contract extraction, bulk ticket classification, compliance auditsCalling real-time endpoints in tight loops for offline overnight jobs

Synchronous vs. Event-Driven Trade-Offs

Use the synchronous Messages API (typically with streaming enabled) when interactive timing is required and measured end-to-end performance fits the deadline. Once a workflow fans out across multiple legacy systems, requires human sign-off, or risks exceeding the actual gateway/client timeout, decouple ingress behind a durable queue (Amazon SQS, Apache Kafka, or Temporal). Ingress returns 202 Accepted with a job identifier, workers execute tool loops at a rate safe for downstream CRM limits (for example, staying below Salesforce burst caps), and a signed webhook or authorized status endpoint reports completion. Store status durably, authenticate callbacks, and make duplicate delivery safe.

For non-interactive bulk pipelines—such as classifying 75,000 approved non-sensitive support records or extracting clauses from 20,000 permitted vendor documents—the Message Batches API uses separate batch limits and halves standard model input/output token rates. If those charges for an identical workload would be $1,200 at synchronous rates, batch token charges would be $600 before additional costs. Batches may expire, have their own quotas and size caps, and are not ZDR/HIPAA eligible on the Claude API. Plan submission and result processing accordingly.


The Adapter and Anti-Corruption Layer (ACL) Pattern

Legacy systems of record rarely expose clean, LLM-ready APIs. SAP S/4HANA OData services, SOAP/XML mainframes, and custom Oracle views routinely return 120+ cryptic fields (KUNNR, BUKRS, ZZ_STAT_CD), deeply nested XML envelopes, and inconsistent fault codes.

Exposing raw backend schemas directly as Claude tools introduces three production failures:

  1. Token Bloat: Dumping 8 KB of raw XML or unused ERP attributes into tool_result balloons input token costs and crowds the context window.
  2. Reasoning Errors: Cryptic field codes degrade model accuracy compared to explicit domain terminology.
  3. Fragile Coupling: An upstream ERP column rename or API version bump breaks system prompts and tool-call parsers across every deployed agent.

An Adapter and Anti-Corruption Layer (ACL) eliminates this coupling. The ACL sits between the agent runtime and legacy systems, translating Claude's clean, domain-centric JSON tool contract (such as get_customer_credit_status returning credit_limit_usd, past_due_balance_usd, and account_standing) into the backend's SOAP, OData, or SQL dialect. The ACL strips irrelevant fields, normalizes units, currency codes and timestamps without inventing values, and maps legacy fault codes into consistent error structures. When SAP migrates an endpoint, engineers can often update the adapter while preserving the domain contract; test compatibility and version the contract if business semantics change.


AuthN/AuthZ Propagation and Deterministic Enforcement

A frequent architectural failure is treating the language model as an authorization boundary. Relying on a system prompt rule such as "Only query records where department matches the user's team" fails under adversarial prompt injection, multi-turn context drift, or subtle reasoning mistakes.

Reference Identity Flow

  1. Ingress Termination: Use OpenID Connect (OIDC) to establish user identity, and an appropriate access token to authorize API calls; an ID token is not an API access token. For JWT access tokens, validate the signature, expected issuer, audience, expiry, and applicable scopes. Mutual TLS (mTLS) can authenticate service-to-service connections but does not itself establish end-user authorization.
  2. Scoped Token Exchange (OBO): Never equip the agent backend with a shared static superuser service key (such as a global Salesforce admin token). Shared static keys create a confused-deputy vulnerability because actions may execute with privileges the requesting user does not have; user attribution also requires trusted application audit evidence. Instead, where supported, use the identity provider’s delegated token exchange (for example, Microsoft’s OAuth On-Behalf-Of flow) to obtain a downstream access token scoped for its intended resource and permissions. Token exchange is not available on every backend; alternatively use a narrow service identity plus enforced user-level access checks. Token lifetime and scopes follow the provider and risk policy, not a universal TTL.
  3. Out-of-Band Enforcement: Inject verified identity context (sub, tenant_id, roles) directly into the tool execution middleware—never as a model-editable tool parameter. If Claude calls list_invoices(status="overdue"), the tool executor reads tenant_id from the server-side request context and appends WHERE tenant_id = :verified_tenant_id deterministically before hitting the database.

Runtime Secrets Management and Zero-Leakage Hygiene

Enterprise agents require Anthropic API keys, OAuth client secrets, database passwords, and webhook signing keys. Every credential must follow strict isolation rules across the entire lifecycle:

  • Runtime Secret Retrieval: Fetch secrets dynamically at service startup or per-lease from a dedicated secret manager, for example AWS Secrets Manager or HashiCorp Vault using workload identities (AWS IAM Roles for Service Accounts or GCP Workload Identity). Never bake secrets into Docker images, Terraform state outputs, or committed .env files.
  • Four Zero-Leakage Zones: Credentials must never appear in:
    1. System prompts or few-shot examples (reducing model-context exposure).
    2. Tool parameter schemas or descriptions (so Claude never receives or generates secret values).
    3. Conversation histories and session checkpoints (preventing persistence in Redis or Postgres).
    4. Telemetry logs and traces (configuring log scrubbers to mask Authorization, x-api-key, and bearer tokens before export).

Worked Enterprise Scenario

An enterprise IT service desk deploys a Claude agent integrating Workday (HR) and Jira (ticketing) for 12,000 employees. Instead of passing a Workday superuser credential to the agent container, the gateway validates the employee’s identity and appropriate API token; an authorized adapter uses delegated access where the provider supports it, enforcing that employee’s profile scope independently, and routes tool calls through a Workday ACL that strips sensitive payroll attributes. Secrets for Jira webhook verification reside in Vault and are injected solely inside the adapter pod, keeping credentials out of model context and configured telemetry; verify the actual execution and logging boundaries.

Primary references

Test Your Knowledge

A legal operations team has approved non-sensitive contract metadata for asynchronous batch processing. It plans to extract 14 fields from 60,000 documents with slack for retries before Monday morning. Which integration pattern should it evaluate to reduce model token charges?

A

Synchronous Messages API calls triggered sequentially from a web server

B

Streaming Messages API calls wrapped behind an interactive API gateway

C

Message Batches for eligible asynchronous inference, with completion/expiry tracking, size limits and separate quotas.

D

A single long-lived WebSocket connection processing one contract per turn

Test Your Knowledge

An enterprise order-management agent calls an SAP S/4HANA backend whose OData payloads contain 110 cryptic fields and undergo quarterly field renames. Which pattern protects Claude's tool contracts and system prompts from breaking during SAP upgrades?

A

Introducing an Adapter and Anti-Corruption Layer (ACL) translating stable domain JSON schemas to SAP OData

B

Embedding the full 110-field SAP OData specification directly in the system prompt

C

Instructing Claude in tool descriptions to guess renamed fields when errors occur

D

Passing raw XML envelopes straight from SAP into conversation history for the model to parse

Test Your Knowledge

During a security audit of a multi-tenant CRM assistant, reviewers discover the agent backend uses a single static CRM admin API key and relies on a system prompt rule telling Claude to filter queries by the user's organization ID. Why does this fail enterprise security requirements?

A

Static admin keys automatically expire every five minutes in multi-tenant CRMs

B

System prompts are stripped by Anthropic's API before tool execution

C

CRM APIs cannot process JSON tool payloads unless mTLS is disabled

D

Prompt instructions are not a deterministic authorization boundary and a shared admin key creates a confused-deputy risk without user-level audit attribution

Test Your Knowledge

Where should an MCP adapter obtain OAuth client secrets and database credentials needed to execute authenticated enterprise tool calls?

A

Passed by Claude as an obfuscated parameter inside each tool_use call

B

Injected at runtime from a secret manager such as AWS Secrets Manager or HashiCorp Vault into the adapter process outside model context

C

Stored in the system prompt's developer configuration block so the model can authenticate directly

D

Hardcoded inside a committed project .env file for fast container startup

Sections you finish are checked off in the contents.