Age Owner Branch data TLA Line data Source code
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 : :
198 dgustafsson@postgres 20 :CBC 2 : PG_MODULE_MAGIC;
21 : :
22 : : static bool fail_token(const ValidatorModuleState *state,
23 : : const char *token,
24 : : const char *role,
25 : : ValidatorModuleResult *res);
26 : :
27 : : /* Callback implementations (we only need the main one) */
28 : : static const OAuthValidatorCallbacks validator_callbacks = {
29 : : PG_OAUTH_VALIDATOR_MAGIC,
30 : :
31 : : .validate_cb = fail_token,
32 : : };
33 : :
34 : : const OAuthValidatorCallbacks *
35 : 2 : _PG_oauth_validator_module_init(void)
36 : : {
37 : 2 : return &validator_callbacks;
38 : : }
39 : :
40 : : static bool
41 : 1 : fail_token(const ValidatorModuleState *state,
42 : : const char *token, const char *role,
43 : : ValidatorModuleResult *res)
44 : : {
45 [ + - ]: 1 : elog(FATAL, "fail_validator: sentinel error");
46 : : pg_unreachable();
47 : : }
|