PostgreSQL Source Code git master
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
fail_validator.c
Go to the documentation of this file.
1/*-------------------------------------------------------------------------
2 *
3 * fail_validator.c
4 * Test module for serverside OAuth token validation callbacks, which is
5 * guaranteed to always fail in the validation callback
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/test/modules/oauth_validator/fail_validator.c
11 *
12 *-------------------------------------------------------------------------
13 */
14
15#include "postgres.h"
16
17#include "fmgr.h"
18#include "libpq/oauth.h"
19
21
22static bool fail_token(const ValidatorModuleState *state,
23 const char *token,
24 const char *role,
25 ValidatorModuleResult *result);
26
27/* Callback implementations (we only need the main one) */
30
31 .validate_cb = fail_token,
32};
33
36{
37 return &validator_callbacks;
38}
39
40static bool
42 const char *token, const char *role,
44{
45 elog(FATAL, "fail_validator: sentinel error");
47}
#define pg_unreachable()
Definition: c.h:332
#define FATAL
Definition: elog.h:41
#define elog(elevel,...)
Definition: elog.h:225
const OAuthValidatorCallbacks * _PG_oauth_validator_module_init(void)
static bool fail_token(const ValidatorModuleState *state, const char *token, const char *role, ValidatorModuleResult *result)
PG_MODULE_MAGIC
static const OAuthValidatorCallbacks validator_callbacks
#define PG_OAUTH_VALIDATOR_MAGIC
Definition: oauth.h:74
Definition: regguts.h:323