public inbox for [email protected]
help / color / mirror / Atom feedFrom: Daniel Gustafsson <[email protected]>
To: Tom Lane <[email protected]>
Cc: Jacob Champion <[email protected]>
Cc: Peter Eisentraut <[email protected]>
Cc: Antonin Houska <[email protected]>
Cc: PostgreSQL Hackers <[email protected]>
Subject: Re: [PoC] Federated Authn/z with OAUTHBEARER
Date: Mon, 24 Feb 2025 00:45:32 +0100
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>
<CAOYmi+kHXMG2Z2KR7y36Cbsop_7t-YugrpfCnOXuXz8BpfaXaw@mail.gmail.com>
<[email protected]>
<CAOYmi+=ee8H=GaGNH_gZvBE+YPtmK9eqUdXqemk=zKDnO8YXRw@mail.gmail.com>
<CAOYmi+kLTJ1wZ6gxRbgtR52E=EyiCpmp6J3mmSvtc1a6i7sZ3Q@mail.gmail.com>
<CAOYmi+=ceXepXOrQXsxca-u57GxM+x_q34fpyNJ8PLmbUWPwEQ@mail.gmail.com>
<[email protected]>
<CAOYmi+=vJQ8EUiVf-iHYBwz4-tLHLrvp8rYDoNicB2yJrBKraw@mail.gmail.com>
<CAOYmi+=FzVg+C-pQHCwjW0qU-POHmzZaD2z3CdsACj==14H8kQ@mail.gmail.com>
<[email protected]>
<CAOYmi+kjPLfT7iFqNMVV44sAUJ9m10TfrSMRPUYU2OgH5j0AYg@mail.gmail.com>
<[email protected]>
<CAOYmi+kn0_FioLpDqctn97a_W8n90XLt_OmU1xL6ZdK8DP8ufA@mail.gmail.com>
<[email protected]>
<CAOYmi+mEkXu9Jfg9v-5z9DmBCRCMS2dt43Z=TCbgVkbrqJXxRg@mail.gmail.com>
<06102deb-00ef-431d-a3ea-65afb24! [email protected]>
<CAOYmi+kZAka0sdxCOBxsQc2ozEZGZKHWU_9nrPXg3sG1NJ-zJw@mail.gmail.com>
<[email protected]>
<CAOYmi+kQFrKGmC0=Um-QryU1fvCAOC2bpjcz-4rxgLrp69mSOg@mail.gmail.com>
<[email protected]>
<CAOYmi+=K3BBRXwvJpt5D_4nK_EimCJBj7a42maACszsQC3=t9w@mail.gmail.com>
<[email protected]>
<CAOYmi+kJqzo6XsR9TEhvVfeVNQ-TyFM5LATypm9yoQVYk=4Wrw@mail.gmail.com>
<[email protected]>
<[email protected]>
<CAOYmi+nHG7oy+ybHH72WjiXAQG3tE6v_at-K9ebRy2oqo92V+A@mail.gmail.com>
<[email protected]>
<CAOYmi+mFZsExAYWy-bS9=yki_fWC+MC0MufpEZ_SycrbCAJrEg@mail.gmail.com>
<[email protected]>
<CAOYmi+=zgJinCoqdQ70fvKmvyrLekd9-supkuj57Poa1FmX8bw@mail.gmail.com>
<[email protected]>
<CAOYmi+=1_AqPL0Y7qdqg1ER0-bBjCUKUZfrLcgob5bHjzSsvbA@mail.gmail.com>
<CAOYmi+nP8AM9xm+xUW5kDz7XDF7M! [email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
>> IMO, the set of cases where it's legitimate to mark individual struct
>> fields as const is negligibly small, and this doesn't seem to be one
>> of them.
>
> Thanks for the report, will fix.
>
>> BTW, as another nitpicky style matter: why do PGoauthBearerRequest
>> etc. spell their struct tag names differently from their typedef names
>> (that is, with/without an underscore)? That is not our project style
>> anywhere else, and I'm failing to detect a good reason to do it here.
>
> Indeed it isn't, the only explanation is that I missed it. Will fix.
The attached diff passes CI and works for me, will revisit in the morning.
--
Daniel Gustafsson
Attachments:
[application/octet-stream] structfixups.diff (2.8K, ../[email protected]/2-structfixups.diff)
download | inline diff:
diff --git a/doc/src/sgml/libpq.sgml b/doc/src/sgml/libpq.sgml
index ddb3596df83..8fa0515c6a0 100644
--- a/doc/src/sgml/libpq.sgml
+++ b/doc/src/sgml/libpq.sgml
@@ -10318,21 +10318,21 @@ typedef struct _PGpromptOAuthDevice
of <symbol>PGoauthBearerRequest</symbol>, which should be filled in
by the implementation:
<synopsis>
-typedef struct _PGoauthBearerRequest
+typedef struct PGoauthBearerRequest
{
/* Hook inputs (constant across all calls) */
- const char *const openid_configuration; /* OIDC discovery URL */
- const char *const scope; /* required scope(s), or NULL */
+ const char *openid_configuration; /* OIDC discovery URL */
+ const char *scope; /* required scope(s), or NULL */
/* Hook outputs */
/* Callback implementing a custom asynchronous OAuth flow. */
PostgresPollingStatusType (*async) (PGconn *conn,
- struct _PGoauthBearerRequest *request,
+ struct PGoauthBearerRequest *request,
SOCKTYPE *altsock);
/* Callback to clean up custom allocations. */
- void (*cleanup) (PGconn *conn, struct _PGoauthBearerRequest *request);
+ void (*cleanup) (PGconn *conn, struct PGoauthBearerRequest *request);
char *token; /* acquired Bearer token */
void *user; /* hook-defined allocated data */
diff --git a/src/interfaces/libpq/libpq-fe.h b/src/interfaces/libpq/libpq-fe.h
index b7399dee58e..34ddfdb1831 100644
--- a/src/interfaces/libpq/libpq-fe.h
+++ b/src/interfaces/libpq/libpq-fe.h
@@ -745,11 +745,11 @@ typedef struct _PGpromptOAuthDevice
#define SOCKTYPE int
#endif
-typedef struct _PGoauthBearerRequest
+typedef struct PGoauthBearerRequest
{
/* Hook inputs (constant across all calls) */
- const char *const openid_configuration; /* OIDC discovery URI */
- const char *const scope; /* required scope(s), or NULL */
+ const char *openid_configuration; /* OIDC discovery URI */
+ const char *scope; /* required scope(s), or NULL */
/* Hook outputs */
@@ -770,7 +770,7 @@ typedef struct _PGoauthBearerRequest
* request->token must be set by the hook.
*/
PostgresPollingStatusType (*async) (PGconn *conn,
- struct _PGoauthBearerRequest *request,
+ struct PGoauthBearerRequest *request,
SOCKTYPE * altsock);
/*
@@ -780,7 +780,7 @@ typedef struct _PGoauthBearerRequest
* This is technically optional, but highly recommended, because there is
* no other indication as to when it is safe to free the token.
*/
- void (*cleanup) (PGconn *conn, struct _PGoauthBearerRequest *request);
+ void (*cleanup) (PGconn *conn, struct PGoauthBearerRequest *request);
/*
* The hook should set this to the Bearer token contents for the
view thread (101+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected], [email protected], [email protected], [email protected]
Subject: Re: [PoC] Federated Authn/z with OAUTHBEARER
In-Reply-To: <[email protected]>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox