postgresql/src
Daniel Gustafsson f8d8581ed8 require_auth: prepare for multiple SASL mechanisms
Prior to this patch, the require_auth implementation assumed that
the AuthenticationSASL protocol message was using SCRAM-SHA-256.
In preparation for future SASL mechanisms, like OAUTHBEARER, split
the implementation into two tiers: the first checks the acceptable
AUTH_REQ_* codes, and the second checks acceptable mechanisms if
AUTH_REQ_SASL et.al are permitted.

conn->allowed_sasl_mechs contains a list of pointers to acceptable
mechanisms, and pg_SASL_init() will bail if the selected mechanism
isn't contained in this array.

Since there's only one mechansism supported right now, one branch
of the second tier cannot be exercised yet and is protected by an
Assert(false) call.  This assertion will need to be removed when
the next mechanism is added.

This patch is extracted from a larger body of work aimed at adding
support for OAUTHBEARER in libpq.

Author: Jacob Champion <jacob.champion@enterprisedb.com>
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>
Reviewed-by: Peter Eisentraut <peter@eisentraut.org>
Discussion: https://postgr.es/m/CAOYmi+kJqzo6XsR9TEhvVfeVNQ-TyFM5LATypm9yoQVYk=4Wrw@mail.gmail.com
2025-01-31 15:47:28 +01:00
..
backend Move PG_MAX_AUTH_TOKEN_LENGTH to libpq/auth.h 2025-01-31 15:39:35 +01:00
bin Avoid breaking SJIS encoding while de-backslashing Windows paths. 2025-01-29 14:24:36 -05:00
common Add support for Unicode case folding. 2025-01-23 09:06:50 -08:00
fe_utils Fix grammatical typos around possessive "its" 2025-01-29 14:39:14 +07:00
include Move PG_MAX_AUTH_TOKEN_LENGTH to libpq/auth.h 2025-01-31 15:39:35 +01:00
interfaces require_auth: prepare for multiple SASL mechanisms 2025-01-31 15:47:28 +01:00
makefiles Update copyright for 2025 2025-01-01 11:21:55 -05:00
pl Fix grammatical typos around possessive "its" 2025-01-29 14:39:14 +07:00
port Avoid breaking SJIS encoding while de-backslashing Windows paths. 2025-01-29 14:24:36 -05:00
template thread-safety: gmtime_r(), localtime_r() 2024-08-23 07:43:04 +02:00
test require_auth: prepare for multiple SASL mechanisms 2025-01-31 15:47:28 +01:00
timezone Update time zone data files to tzdata release 2025a. 2025-01-20 16:49:15 -05:00
tools Change publication's publish_generated_columns option type to enum. 2025-01-23 15:28:37 +05:30
tutorial Doc: simplify the tutorial's window-function examples. 2025-01-21 14:43:21 -05:00
.gitignore
DEVELOPERS
Makefile Remove distprep 2023-11-06 15:18:04 +01:00
Makefile.global.in Convert sepgsql tests to TAP 2025-01-24 12:39:47 +01:00
Makefile.shlib Remove AIX support 2024-02-28 15:17:23 +04:00
meson.build Update copyright for 2025 2025-01-01 11:21:55 -05:00
nls-global.mk Remove distprep 2023-11-06 15:18:04 +01:00