Skip to content

feat(sdk): make DPoP discovery cache TTL configurable - #442

Draft
dmihalcik-virtru wants to merge 1 commit into
DSPX-5640-java-sdk-dpop-negotiationfrom
DSPX-5640-java-sdk-dpop-cache-ttl
Draft

dmihalcik-virtru wants to merge 1 commit into
DSPX-5640-java-sdk-dpop-negotiationfrom
DSPX-5640-java-sdk-dpop-cache-ttl

Conversation

@dmihalcik-virtru

Copy link
Copy Markdown
Member

Stacked on #441. Review and merge that first; this PR's base will retarget to main once it lands.

Summary

Adds SDKBuilder.dpopDiscoveryCacheTtl(Duration) to control how long a server's DPoP htu style, discovered in DPoPMode.AUTO, is reused before the SDK discovers it again.

Rationale

The KAS, gateway and IdP can be upgraded or reconfigured on their own schedules. Deployments that change often, or that need answers to be picked up immediately, can shorten the TTL or turn the cache off. Stable deployments can lengthen it to avoid re-running discovery.

This is split out from #441 because #441 is a patch, while this adds public API.

Public API

  • New SDKBuilder.dpopDiscoveryCacheTtl(Duration). The change is additive.

Test plan

  • DPoPModeTest: a new test checks that a zero TTL runs discovery on every request, including after the RFC 9449 mode is recorded from bootstrap. The builder-validation test now also checks that null and negative values are rejected and that ZERO is accepted.
  • Run offline on JDK 21: mvn -o -pl sdk test -Dtest='DPoPModeTest,SDKBuilderTest,TokenSourceTest'. DPoPModeTest: 26 passed. SDKBuilderTest: 12 passed. TokenSourceTest: 22 passed.
  • Not run: the full suite and the coverage profile.

@dmihalcik-virtru
dmihalcik-virtru requested review from a team as code owners November 16, 2026 13:45
@coderabbitai

coderabbitai Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

🗂️ Base branches to auto review: 1

  • main

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: bd13cc60-a7ff-462e-ba1e-8df00b2ec2b8

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Adds SDKBuilder.dpopDiscoveryCacheTtl(Duration) so deployments whose KAS,
gateway, or IdP change on their own schedule can shorten, lengthen, or
disable (Duration.ZERO) the AUTO-mode discovery cache. Null or negative
values are rejected. The default stays at five minutes; the 30 s legacy fallback after an
inconclusive discovery is capped at the TTL.

Verified: DPoPModeTest (42, incl. new zero-TTL and builder validation
checks), SDKBuilderTest (12) and TokenSourceTest (22) pass offline with
JDK 21.

Signed-off-by: Dave Mihalcik <dmihalcik@virtru.com>

Signed-off-by: Dave Mihalcik <dmihalcik@virtru.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant