Skip to content

Document Basic auth header caching, guard against stale copies#2286

Merged
hyperxpro merged 1 commit into
mainfrom
fix/basic-auth-header-cache-followups
Jul 24, 2026
Merged

Document Basic auth header caching, guard against stale copies#2286
hyperxpro merged 1 commit into
mainfrom
fix/basic-auth-header-cache-followups

Conversation

@hyperxpro

Copy link
Copy Markdown
Member

Motivation:

#2267 introduced Realm.getBasicAuthHeader() to cache the computed HTTP Basic authorization header on immutable Realm instances. Two follow-ups remained: its Javadoc did not clarify that it always generates a Basic header regardless of the configured AuthScheme, and there was no test verifying that the cached header is scoped to each Realm instance rather than shared across instances.

Modification:

Update the Realm.getBasicAuthHeader() Javadoc to explicitly document that it always encodes credentials as a Basic authorization header, regardless of the configured scheme. Add a test verifying that two distinct Realm instances with identical credentials produce equal but distinct cached header instances.

Result:

The behavior of Realm.getBasicAuthHeader() is now explicitly documented, and its per-instance caching is protected by a regression test against accidental cache sharing.

@hyperxpro
hyperxpro merged commit eb7de08 into main Jul 24, 2026
17 checks passed
@hyperxpro
hyperxpro deleted the fix/basic-auth-header-cache-followups branch July 24, 2026 20:14
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