Re: SET ROLE x NO RESET - Mailing list pgsql-hackers

From Nico Williams
Subject Re: SET ROLE x NO RESET
Date
Msg-id ZZXwe/DzMqhFCDai@ubby
Whole thread Raw
In response to SET ROLE x NO RESET  (Eric Hanson <eric@aquameta.com>)
List pgsql-hackers
On Sat, Dec 30, 2023 at 10:16:59AM -0600, Eric Hanson wrote:
> What do you think of adding a NO RESET option to the SET ROLE command?

I've wanted this forever.  Consider using this to implement user
authentication mechanisms in user-defined SQL functions that use `SET
ROLE` with `NO RESET` to "login" the user.  One could implement JWT (or
whatever bearer token schemes) on the server side in PlPgSQL w/ pgcrypto
this way, with zero changes to PG itself, no protocol changes, etc.

For bearer token schemes one could acquire the token externally to the
client and then just `SELECT login(?)`, bind the token, and execute to
login.

Nico
-- 



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Add a perl function in Cluster.pm to generate WAL
Next
From: Nico Williams
Date:
Subject: Re: SET ROLE x NO RESET