AEM and JWT: securing RESTful services for third-party clients

Third-party access to Adobe Experience Manager (AEM) often starts with a partner needing a narrow slice of content or a mobile status lookup. Across that organisational boundary, a shared admin login and broad service account are poor controls. Using AEM and JWT offers a practical foundation through a signed, short-lived bearer token. The token establishes the caller’s identity, but it does not decide what the caller may access.

Authentication and authorisation remain separate duties. Neither replaces TLS, endpoint validation, rate limiting or audit controls. Australian delivery teams add local context: Sydney and Melbourne are fintech and commerce hubs, Brisbane and Perth organisations increasingly connect cloud and partner systems, and consumers expect mobile banking and digital wallets to work without delay. The Privacy Act 1988 and Australian Privacy Principles make data minimisation, security and transparent third-party handling central to API design.

Set the trust boundary before choosing a token

Begin with one endpoint and map its assets, actions, callers and downstream effects. Give each partner a dedicated audience and scope rather than access inherited from a broad integration account. Internal services may have stronger controls, but internal origin alone does not make them safe. This boundary limits the blast radius of a leaked credential and gives reviewers a concrete contract to test.

External calls should normally pass through a gateway or reverse proxy and an AEM authentication filter or Sling component that runs before the servlet. The filter validates the token; the servlet still enforces path-level permissions. Model token theft, replay, confused-deputy access, excessive scopes, forged tenant identifiers and compromised dependencies. Peer discussion can expose overlooked cases, and the developer event programme illustrates the value of sharing concrete failure scenarios among practitioners.

Issue tokens for the client and task

JWT is a credential format, not a complete access-control protocol. Use a dedicated OAuth 2.0 authorisation server: client credentials for confidential server-to-server clients, and Authorization Code with PKCE for mobile apps, browser-based applications and other public clients. Never embed a client secret in distributable software; public clients offer no trustworthy place for one.

Keep claims narrow: issuer, audience, subject or client identifier, tenant, permitted scopes, issue time, expiry, not-before time and a unique token identifier. Five-to-fifteen-minute access-token lifetimes often balance API usability with exposure. A JWT is signed, not encrypted, so do not put secrets or personal information in its payload. Prefer asymmetric signing such as RS256, publish public keys through a trusted JWKS endpoint and rotate them with an overlap. Bind write access to a specific operation. The CIRCUIT explanation of AEM launch workflows shows why broad repository administration is the wrong substitute for task-level permission.

Validate claims and permissions server-side

Read the bearer credential from the Authorization header and use a maintained Java JWT library to validate the signature, expected algorithm, issuer, audience, expiry, not-before time and issue time before business logic runs. Do not trust the token’s alg value as the algorithm choice, reject unsigned tokens, and resolve kid only against known issuer keys. The service should fail closed if required key material is unavailable. Authentication establishes a principal; authorisation still needs scopes, tenant boundaries and object-level checks on the requested AEM path.

A unique jti plus a short replay cache can protect high-value operations, while short lifetimes limit the value of a denylist. Apply a small, documented clock-skew allowance rather than ignoring timestamps. Australian clients may run in Perth while AEM sits in an eastern-state cloud region, and daylight-saving changes make explicit UTC handling important. Run requests under a narrowly permissioned service identity, never an administrator account. Log token ID, client, audience and outcome, but redact tokens and unnecessary claims. Teams can compare API, gateway and platform telemetry through data observability sessions to set useful baselines.

Harden the edge and AEM runtime

Place external REST endpoints behind a TLS-terminating API gateway or hardened reverse proxy, then route requests through the AEM Dispatcher or ingress layer. Edge controls can enforce request-size limits, method and path rules, connection caps and coarse rate limits before expensive application work, but they do not replace JWT validation. Reproducible configuration matters: CIRCUIT’s guide to Docker-based AEM environments shows how to keep dispatcher, filter and gateway behaviour consistent across developer machines and CI workers.

Configure CORS with exact trusted origins, allowed methods and required headers; never reflect arbitrary origins or combine a wildcard with credentials. Browsers do not automatically attach an Authorization header as they do cookies, but permissive CORS can still expose a response to hostile pages holding a token. Set Cache-Control: private, no-store for personalised or tenant-restricted payloads so shared caches cannot retain them. Store keys and gateway credentials in a managed secrets service or HSM-backed key store, never in source control, images or AEM content packages. For Australian buyers, document where keys, logs and payloads are processed; contractual data-residency commitments are common even though the Privacy Act has no universal residency rule.

Build repeatable security testing

Build a test pyramid around the token contract. Unit tests should cover claim validation, key rotation, clock skew and replay controls. Contract tests should ensure the issuer and AEM agree on claims, scopes and error responses. Integration tests must traverse the real gateway and servlet path, covering missing, malformed, expired, future-dated, wrongly signed and wrong-audience tokens, as well as incorrect tenant or action. Direct repository access in a test is not evidence that the public API is safe.

End-to-end checks should prove that a legitimate partner can complete the agreed journey while a user lacking the relevant scope cannot. Patterns such as AEM Selenium testing clients show the value of reusable fixtures and test clients; the same discipline applies to API payloads, rotated keys and tenant data. Run these checks in CI with short-lived credentials and keep raw tokens out of reports. Monitor malformed-token spikes, repeated jti values and unexpected clients, then rehearse key compromise. Under the Privacy Act, determine whether notifiable harm is likely and follow the mandatory breach-notification process with privacy and legal advisers.

Production readiness recommendations

Roll out gradually: a non-production environment first, then one read-only integration with a monitored pilot before adding writes or partners. Version the API and claims, publish revocation procedures and set an expiry date for temporary compatibility. Existing clients need a migration window, but compatibility must not make the security boundary broader simply to avoid rework. Name owners for the issuer, gateway, AEM filter, key lifecycle and audit evidence.

Review scopes and retained claims against the Privacy Act 1988, Australian Privacy Principles, data minimisation and contractual security schedules. An APRA-regulated financial client may require CPS 234 controls to extend to third parties, while many Australian organisations adopt the Australian Signals Directorate’s Essential Eight. Treat those frameworks as a way to organise evidence and responsibilities, not as a substitute for the endpoint’s actual threat model.

  • Issue short-lived, audience-bound tokens through a dedicated OAuth 2.0 issuer, with narrow tenant and action scopes.
  • Pin the signing algorithm, rotate asymmetric keys through a trusted JWKS process, and keep private material outside AEM packages.
  • Validate registered claims and enforce object-level permissions in AEM using dedicated service identities.
  • Restrict CORS origins, rate-limit exposed endpoints, prevent shared caching of personalised responses, and exclude tokens from logs.
  • Exercise expiry, rotation, replay, revocation and client-compromise scenarios in CI and operational drills.

Launch a secure first integration

Choose one low-risk, read-only endpoint and one accountable third-party client. Define the business owner, token issuer, AEM service identity, permitted content, logging owner and incident contacts before exchanging credentials. Use synthetic tenant data in testing, then a small live dataset for the pilot. Agree support coverage for Australian business hours without weakening expiry or key-rotation rules.

Observe the pilot across a normal trading cycle. Review rejected requests, latency, cache behaviour, support volume and evidence available for a key-compromise response. Require the API owner and security lead to approve each new partner rather than copying the first configuration blindly.

Publish the integration guide with token requirements, sample requests, expiry handling, rotation contacts and support procedures. Give the first client a sandbox issuer, test tenant and clear route for reporting credential problems. Enable additional permissions one at a time, with a recorded review before writes or broader content access. Start by naming the endpoint and its owner, then use that bounded pilot as the reference pattern for every future third-party AEM integration.