Skip to content

[ISSUE #22] Reuse configured token membership sets - #52

Merged
mxsm merged 1 commit into
developfrom
mxsm/fix-26-token-sets
Nov 28, 2026
Merged

mxsm merged 1 commit into
developfrom
mxsm/fix-26-token-sets

Conversation

@mxsm

@mxsm mxsm commented Nov 28, 2026 •

Copy link
Copy Markdown
Owner

Closes #22

Build immutable membership sets when each configured role list is bound or replaced. Configuration getters retain the original ordering and duplicate entries. Request authentication reads the current role sets without copying credentials into new hash tables.

Validation

  • Maven server reactor verification on JDK 25 included MySQL 8.4 and PostgreSQL 18. Focused tests cover Spring property binding, immutable membership, copied input lists, normal role decisions, and revoking and replacing credentials on an existing filter instance.
  • A/B measured the real authenticated POST /api/v1/snowflake/uid over HTTP/1.1 loopback with one Spring Boot process at a time, fixed worker ID and an isolated local PostgreSQL 18 writer. Eight client threads reused an HTTP client. Each row follows 3,000 warm-up requests and contains 8,000 verified HTTP 200/SUCCESS responses (0 failures). Each JVM ran 1 then 256 synthetic credentials per role. JVM order was baseline, candidate, candidate, baseline; the shared host limits inference from latency changes.
  • A servlet filter around the authentication/MVC chain measured current server-thread allocated bytes using ThreadMXBean. JFR ObjectAllocationSample recorded allocation stacks at 1,000/s. The final column counts sampled allocations whose HashSet constructor was called by the request authentication filter. Samples do not count all allocations.
JVM run Credentials per role Success/s p99 ms Server bytes/request Filter HashSet samples
base1 1 3873.69 9.605 12072.9 9
base1 256 10450.73 4.145 31520.9 205
candidate1 1 3546.77 15.588 11314.9 0
candidate1 256 17760.52 2.108 10518.7 0
candidate2 1 3121.03 15.564 11570.7 0
candidate2 256 20327.67 1.444 10823.0 0
base2 1 3417.79 16.764 12019.5 12
base2 256 12831.47 3.836 31518.4 174

At 256 credentials per role the candidate reduced measured allocation from about 31.5 kB to 10.5–10.8 kB per successful request. At one credential per role allocation fell modestly and timings were noisy. Compare rows at the same credential count; the JVM was warmer during the second case.

The A/B isolated this change on Spring Boot 4.0.6 in both variants. The merged Spring Boot 4.1.3 baseline and method-level registration guard were separately exercised in the focused authorization, binding and rotation tests. The timing results characterize these synthetic credential counts, this JDK and this loopback workload. No production credentials were used.

@mxsm
mxsm force-pushed the mxsm/fix-26-token-sets branch from 5d5dd50 to e15d902 Compare November 28, 2026 11:32
@mxsm
mxsm merged commit 300e937 into develop Nov 28, 2026
1 check passed
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.

Reuse configured token sets during request authentication

1 participant