pg.ddx.io  GitHub: pgjdbc/pgjdbc (issues + PRs as email threads)  
help / color / mirror / Atom feed
From: vlsi (@vlsi) <noreply+vlsi@github.com>
To: pgjdbc/pgjdbc <noreply+pgjdbc-pgjdbc@github.com>
Subject: Re: [pgjdbc/pgjdbc] PR #4251: OAuth implementation
Date: Wed, 09 Sep 2026 15:45:36 +0000
Message-ID: <gh-pgjdbc-pgjdbc-4251-rc3970363319@github.com> (raw)
In-Reply-To: <gh-pgjdbc-pgjdbc-4251@github.com>
References: <gh-pgjdbc-pgjdbc-4251@github.com>

(on pgjdbc/src/main/java/org/postgresql/plugin/OAuthTokenProvider.java:39)

`@return the token; must not be null` states half the contract. `resolveOAuthToken` rejects a zero-length array with the same `OAuth token provider returned no token`, so an implementer who returns `new char[0]` hits an exception this comment did not warn about. `@return the token; neither null nor empty` covers it.

`Individual fields may be null when not yet known` describes a staged handshake that does not happen. The rule is checkable: a field is null when the matching connection property is unset.

The wiping paragraph is the interesting one, and it is spread over two paragraphs with the second one entirely in `<b>`. One sentence carries both facts: `The driver zeroes the returned array once it has sent the token, so each call must return a fresh array.` Present tense fits, since this is what the code does rather than something it will do.

The type comment is worth more than it says now. An implementer needs to know that the driver instantiates the class named by `oauthTokenProviderClassName` through `ObjectFactory`, so a `Properties` constructor or a no-arg constructor is required; that `getToken` runs once per connection attempt, which makes it part of the connect path; and that a connection setting `oauthToken` never reaches the provider at all.

Separately, and this is an API question rather than a wording one: `AuthenticationPlugin` already covers `AuthenticationRequestType.SASL` and already does just-in-time `char[]` handling. It is worth a line in the description saying why OAuth gets its own SPI, since `requireAuth=oauth` will lead people with `authenticationPluginClassName` configured to expect their plugin to be called.

view thread (168+ messages)  latest in thread

Message-ID: <gh-pgjdbc-pgjdbc-4251-rc3970363319@github.com>
Permalink:  ../gh-pgjdbc-pgjdbc-4251-rc3970363319@github.com/

 · 


This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox