Commit eb7de08
authored
Document Basic auth header caching, guard against stale copies (#2286)
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.1 parent 9f4926c commit eb7de08
2 files changed
Lines changed: 16 additions & 1 deletion
File tree
- client/src
- main/java/org/asynchttpclient
- test/java/org/asynchttpclient/util
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
249 | 249 | | |
250 | 250 | | |
251 | 251 | | |
252 | | - | |
| 252 | + | |
| 253 | + | |
253 | 254 | | |
254 | 255 | | |
255 | 256 | | |
| |||
Lines changed: 14 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
| 42 | + | |
42 | 43 | | |
43 | 44 | | |
44 | 45 | | |
| |||
66 | 67 | | |
67 | 68 | | |
68 | 69 | | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
69 | 83 | | |
70 | 84 | | |
71 | 85 | | |
| |||
0 commit comments