aboutsummaryrefslogtreecommitdiff
path: root/src/interfaces/libpq/fe-auth-oauth.h
blob: 0d59e91605bbe5dec73d07c8f79670e2e37a3dc2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/*-------------------------------------------------------------------------
 *
 * fe-auth-oauth.h
 *
 *	  Definitions for OAuth authentication implementations
 *
 * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group
 * Portions Copyright (c) 1994, Regents of the University of California
 *
 * src/interfaces/libpq/fe-auth-oauth.h
 *
 *-------------------------------------------------------------------------
 */

#ifndef FE_AUTH_OAUTH_H
#define FE_AUTH_OAUTH_H

#include "fe-auth-sasl.h"
#include "libpq-fe.h"


enum fe_oauth_step
{
	FE_OAUTH_INIT,
	FE_OAUTH_BEARER_SENT,
	FE_OAUTH_REQUESTING_TOKEN,
	FE_OAUTH_SERVER_ERROR,
};

/*
 * This struct is exported to the libpq-oauth module. If changes are needed
 * during backports to stable branches, please keep ABI compatibility (no
 * changes to existing members, add new members at the end, etc.).
 */
typedef struct
{
	enum fe_oauth_step step;

	PGconn	   *conn;
	void	   *async_ctx;

	void	   *builtin_flow;
} fe_oauth_state;

extern void pqClearOAuthToken(PGconn *conn);
extern bool oauth_unsafe_debugging_enabled(void);
extern bool use_builtin_flow(PGconn *conn, fe_oauth_state *state);

/* Mechanisms in fe-auth-oauth.c */
extern const pg_fe_sasl_mech pg_oauth_mech;

#endif							/* FE_AUTH_OAUTH_H */