Commit 7ba71a7
Add OIDC token-provider tests and cleanups
Address minor code-review findings on the OIDC device flow: fill test
gaps around the token provider and tidy comments and dead code. No
production behavior change beyond simplifying unreachable branches.
Tests:
- Add testRefreshedTokenWithControlCharFallsBackToInteractiveFlow: a
refresh whose 200 response carries a served token with an escaped
control char (JsonLexer now decodes it into a real CR) is rejected by
validateTokenChars, and tryRefresh must fall back to the interactive
flow rather than propagate. Guards the tryRefresh storeTokens catch;
verified to fail without it.
- Add testThrowingProviderOnReconnectIsRetriedAndRecovers and
testPersistentlyThrowingProviderOnReconnectTerminatesTheSender: a
token provider that throws on a WebSocket reconnect (the background
I/O thread) is retried within the reconnect budget and recovers on a
transient failure, or terminates the sender once the budget is
exhausted on a persistent one.
- Replace the vacuous testMalformedEndpointDoesNotLeakNativeMemory
(which fed "not-a-url", rejected before the lexer is allocated) with
testRejectedBuildDoesNotLeakNativeMemory (a parseable-but-rejected
endpoint) and testSuccessfulBuildAndCloseDoNotLeakNativeMemory - the
path that actually allocates and frees the native lexer. The new
guard fails if close() stops freeing the lexer.
- Add @test(timeout=30_000) to
testShortAllDigitStatusNotTreatedAsTransientOrTerminal so a guard
regression fails fast instead of polling to the device-code deadline.
Comments and dead code:
- Reword the writeLockHolder and acquireLock comments to match
releaseLock's honest framing: the read-then-write and
size-check-then-delete narrow, but do not close, the peer-stamp
clobber window; the residual degrades to a double-refresh, never a
torn credential.
- Reduce pathOnly() to return Endpoint.parse(url).path and drop the
now-unreachable ?/# arms in Endpoint.parse's authority terminator and
path construction (Endpoint.parse rejects ? and # up front).
- Expand the refreshUnderLock comment: the equals(refreshToken,
lastPersistedRefreshToken) guard no longer strictly means "unsaved
newer token" once adopt() keeps a live token the file lacked.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent acfa6e6 commit 7ba71a7
4 files changed
Lines changed: 210 additions & 46 deletions
File tree
- core/src
- main/java/io/questdb/client/cutlass/auth
- test/java/io/questdb/client/test/cutlass
- auth
- qwp/client
Lines changed: 12 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
647 | 647 | | |
648 | 648 | | |
649 | 649 | | |
650 | | - | |
651 | | - | |
652 | | - | |
653 | | - | |
654 | | - | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
655 | 658 | | |
656 | 659 | | |
657 | 660 | | |
| |||
679 | 682 | | |
680 | 683 | | |
681 | 684 | | |
682 | | - | |
| 685 | + | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
683 | 689 | | |
684 | 690 | | |
685 | 691 | | |
| |||
Lines changed: 22 additions & 29 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
855 | 855 | | |
856 | 856 | | |
857 | 857 | | |
858 | | - | |
859 | | - | |
860 | | - | |
861 | | - | |
862 | | - | |
863 | | - | |
864 | | - | |
865 | | - | |
866 | | - | |
867 | | - | |
| 858 | + | |
| 859 | + | |
| 860 | + | |
| 861 | + | |
868 | 862 | | |
869 | 863 | | |
870 | 864 | | |
| |||
1334 | 1328 | | |
1335 | 1329 | | |
1336 | 1330 | | |
1337 | | - | |
1338 | | - | |
1339 | | - | |
1340 | | - | |
1341 | | - | |
| 1331 | + | |
| 1332 | + | |
| 1333 | + | |
| 1334 | + | |
| 1335 | + | |
| 1336 | + | |
| 1337 | + | |
| 1338 | + | |
| 1339 | + | |
| 1340 | + | |
| 1341 | + | |
1342 | 1342 | | |
1343 | 1343 | | |
1344 | 1344 | | |
| |||
1982 | 1982 | | |
1983 | 1983 | | |
1984 | 1984 | | |
1985 | | - | |
1986 | | - | |
| 1985 | + | |
| 1986 | + | |
| 1987 | + | |
1987 | 1988 | | |
1988 | 1989 | | |
1989 | | - | |
1990 | | - | |
| 1990 | + | |
1991 | 1991 | | |
1992 | 1992 | | |
1993 | 1993 | | |
1994 | 1994 | | |
1995 | 1995 | | |
1996 | | - | |
1997 | | - | |
1998 | | - | |
1999 | | - | |
2000 | | - | |
2001 | | - | |
2002 | | - | |
2003 | | - | |
2004 | | - | |
2005 | | - | |
| 1996 | + | |
| 1997 | + | |
| 1998 | + | |
2006 | 1999 | | |
2007 | 2000 | | |
2008 | 2001 | | |
| |||
Lines changed: 75 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2043 | 2043 | | |
2044 | 2044 | | |
2045 | 2045 | | |
2046 | | - | |
2047 | | - | |
2048 | | - | |
2049 | | - | |
2050 | | - | |
| 2046 | + | |
| 2047 | + | |
| 2048 | + | |
| 2049 | + | |
| 2050 | + | |
| 2051 | + | |
| 2052 | + | |
| 2053 | + | |
| 2054 | + | |
2051 | 2055 | | |
2052 | 2056 | | |
2053 | 2057 | | |
2054 | | - | |
| 2058 | + | |
2055 | 2059 | | |
2056 | | - | |
| 2060 | + | |
2057 | 2061 | | |
2058 | 2062 | | |
2059 | | - | |
| 2063 | + | |
2060 | 2064 | | |
2061 | | - | |
| 2065 | + | |
2062 | 2066 | | |
2063 | | - | |
| 2067 | + | |
| 2068 | + | |
| 2069 | + | |
| 2070 | + | |
| 2071 | + | |
| 2072 | + | |
| 2073 | + | |
| 2074 | + | |
| 2075 | + | |
| 2076 | + | |
| 2077 | + | |
| 2078 | + | |
| 2079 | + | |
| 2080 | + | |
| 2081 | + | |
| 2082 | + | |
| 2083 | + | |
| 2084 | + | |
| 2085 | + | |
| 2086 | + | |
| 2087 | + | |
| 2088 | + | |
2064 | 2089 | | |
2065 | 2090 | | |
2066 | 2091 | | |
| |||
2502 | 2527 | | |
2503 | 2528 | | |
2504 | 2529 | | |
| 2530 | + | |
| 2531 | + | |
| 2532 | + | |
| 2533 | + | |
| 2534 | + | |
| 2535 | + | |
| 2536 | + | |
| 2537 | + | |
| 2538 | + | |
| 2539 | + | |
| 2540 | + | |
| 2541 | + | |
| 2542 | + | |
| 2543 | + | |
| 2544 | + | |
| 2545 | + | |
| 2546 | + | |
| 2547 | + | |
| 2548 | + | |
| 2549 | + | |
| 2550 | + | |
| 2551 | + | |
| 2552 | + | |
| 2553 | + | |
| 2554 | + | |
| 2555 | + | |
| 2556 | + | |
| 2557 | + | |
| 2558 | + | |
| 2559 | + | |
| 2560 | + | |
| 2561 | + | |
| 2562 | + | |
| 2563 | + | |
| 2564 | + | |
| 2565 | + | |
| 2566 | + | |
| 2567 | + | |
| 2568 | + | |
2505 | 2569 | | |
2506 | 2570 | | |
2507 | 2571 | | |
| |||
3306 | 3370 | | |
3307 | 3371 | | |
3308 | 3372 | | |
3309 | | - | |
| 3373 | + | |
3310 | 3374 | | |
3311 | 3375 | | |
3312 | 3376 | | |
| |||
0 commit comments