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:35 +0000
Message-ID: <gh-pgjdbc-pgjdbc-4251-rc3970363222@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/core/v3/ConnectionFactoryImpl.java)
`oauthOffered` means "offered by the server and configured by the client", while `scramOffered` next to it means only "offered by the server". The correctness of the `else` branch below rests on that asymmetry, and a reader who trusts the names reads the branch wrong. `oauthUsable` for the first one, or moving `isOAuthConfigured(info)` into the `if`, would make the pair readable.
This decision table is also the part of the change with the widest blast radius and no test at all. Seven columns are reachable, and the one I would most want pinned is `requireAuth=!oauth` against a server that offers both mechanisms: by the code the driver falls through to SCRAM, and a regression here breaks the user who disabled OAuth deliberately. `readMechanisms` and `validateOAuthIssuer` are already package-private for testing, so extracting the selection into a package-private static method fits what the change already does, and `pgjdbc-mockito-test` already mocks `PGStream` in this package.