PostgreSQL Source Code: src/test/modules/oauth_validator/validator.c Source File (original) (raw)

1

2

3

4

5

6

7

8

9

10

11

12

13

15

21

23

27 const char *token,

28 const char *role,

30

31

34

38};

39

40

43

44

45

46

47

48

49

50

51

52

53

54

55void

57{

59 "Authenticated identity to use for future connections",

60 NULL,

62 NULL,

64 0,

65 NULL, NULL, NULL);

67 "Should tokens be marked valid?",

68 NULL,

70 true,

72 0,

73 NULL, NULL, NULL);

74

76}

77

78

79

80

83{

85}

86

87#define PRIVATE_COOKIE ((void *) 13579)

88

89

90

91

92static void

94{

95

96

97

98

99 if (state->sversion != PG_VERSION_NUM)

100 elog(ERROR, "oauth_validator: sversion set to %d", state->sversion);

101

103}

104

105

106

107

108static void

110{

111

113 elog(PANIC, "oauth_validator: private state cookie changed to %p in shutdown",

114 state->private_data);

115}

116

117

118

119

120

121static bool

123 const char *token, const char *role,

125{

126

128 elog(ERROR, "oauth_validator: private state cookie changed to %p in validate",

129 state->private_data);

130

131 elog(LOG, "oauth_validator: token=\"%s\", role=\"%s\"", token, role);

132 elog(LOG, "oauth_validator: issuer=\"%s\", scope=\"%s\"",

135

139 else

141

142 return true;

143}

void DefineCustomStringVariable(const char *name, const char *short_desc, const char *long_desc, char **valueAddr, const char *bootValue, GucContext context, int flags, GucStringCheckHook check_hook, GucStringAssignHook assign_hook, GucShowHook show_hook)

void DefineCustomBoolVariable(const char *name, const char *short_desc, const char *long_desc, bool *valueAddr, bool bootValue, GucContext context, int flags, GucBoolCheckHook check_hook, GucBoolAssignHook assign_hook, GucShowHook show_hook)

void MarkGUCPrefixReserved(const char *className)

char * pstrdup(const char *in)

#define PG_OAUTH_VALIDATOR_MAGIC

const OAuthValidatorCallbacks * _PG_oauth_validator_module_init(void)

static bool authorize_tokens

static void validator_startup(ValidatorModuleState *state)

static void validator_shutdown(ValidatorModuleState *state)

static const OAuthValidatorCallbacks validator_callbacks

static bool validate_token(const ValidatorModuleState *state, const char *token, const char *role, ValidatorModuleResult *res)