Debian Codegraph @

src/interfaces/libpq/fe-auth-oauth.h

raw
1 /*-------------------------------------------------------------------------
2 *
3 * fe-auth-oauth.h
4 *
5 * Definitions for OAuth authentication implementations
6 *
7 * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group
8 * Portions Copyright (c) 1994, Regents of the University of California
9 *
10 * src/interfaces/libpq/fe-auth-oauth.h
11 *
12 *-------------------------------------------------------------------------
13 */
14
15 #ifndef FE_AUTH_OAUTH_H
16 #define FE_AUTH_OAUTH_H
17
18 #include "fe-auth-sasl.h"
19 #include "libpq-fe.h"
20
21
22 enum fe_oauth_step
23 {
24 FE_OAUTH_INIT,
25 FE_OAUTH_BEARER_SENT,
26 FE_OAUTH_REQUESTING_TOKEN,
27 FE_OAUTH_SERVER_ERROR,
28 };
29
30 /*
31 * This struct is exported to the libpq-oauth module. If changes are needed
32 * during backports to stable branches, please keep ABI compatibility (no
33 * changes to existing members, add new members at the end, etc.).
34 */
35 typedef struct
36 {
37 enum fe_oauth_step step;
38
39 PGconn *conn;
40 void *async_ctx;
41
42 void *builtin_flow;
43 } fe_oauth_state;
44
45 extern void pqClearOAuthToken(PGconn *conn);
46 extern bool oauth_unsafe_debugging_enabled(void);
47 extern bool use_builtin_flow(PGconn *conn, fe_oauth_state *state);
48
49 /* Mechanisms in fe-auth-oauth.c */
50 extern const pg_fe_sasl_mech pg_oauth_mech;
51
52 #endif /* FE_AUTH_OAUTH_H */