1 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>50.2. Initialization Functions</title><link rel="stylesheet" type="text/css" href="stylesheet.css" /><link rev="made" href="pgsql-docs@lists.postgresql.org" /><meta name="generator" content="DocBook XSL Stylesheets Vsnapshot" /><link rel="prev" href="oauth-validator-design.html" title="50.1. Safely Designing a Validator Module" /><link rel="next" href="oauth-validator-callbacks.html" title="50.3. OAuth Validator Callbacks" /></head><body id="docContent" class="container-fluid col-10"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="5" align="center">50.2. Initialization Functions</th></tr><tr><td width="10%" align="left"><a accesskey="p" href="oauth-validator-design.html" title="50.1. Safely Designing a Validator Module">Prev</a> </td><td width="10%" align="left"><a accesskey="u" href="oauth-validators.html" title="Chapter 50. OAuth Validator Modules">Up</a></td><th width="60%" align="center">Chapter 50. OAuth Validator Modules</th><td width="10%" align="right"><a accesskey="h" href="index.html" title="PostgreSQL 18.0 Documentation">Home</a></td><td width="10%" align="right"> <a accesskey="n" href="oauth-validator-callbacks.html" title="50.3. OAuth Validator Callbacks">Next</a></td></tr></table><hr /></div><div class="sect1" id="OAUTH-VALIDATOR-INIT"><div class="titlepage"><div><div><h2 class="title" style="clear: both">50.2. Initialization Functions <a href="#OAUTH-VALIDATOR-INIT" class="id_link">#</a></h2></div></div></div><a id="id-1.8.17.7.2" class="indexterm"></a><p>
3 OAuth validator modules are dynamically loaded from the shared
4 libraries listed in <a class="xref" href="runtime-config-connection.html#GUC-OAUTH-VALIDATOR-LIBRARIES">oauth_validator_libraries</a>.
5 Modules are loaded on demand when requested from a login in progress.
6 The normal library search path is used to locate the library. To
7 provide the validator callbacks and to indicate that the library is an OAuth
8 validator module a function named
9 <code class="function">_PG_oauth_validator_module_init</code> must be provided. The
10 return value of the function must be a pointer to a struct of type
11 <code class="structname">OAuthValidatorCallbacks</code>, which contains a magic
12 number and pointers to the module's token validation functions. The returned
13 pointer must be of server lifetime, which is typically achieved by defining
14 it as a <code class="literal">static const</code> variable in global scope.
15 </p><pre class="programlisting">
16 typedef struct OAuthValidatorCallbacks
18 uint32 magic; /* must be set to PG_OAUTH_VALIDATOR_MAGIC */
20 ValidatorStartupCB startup_cb;
21 ValidatorShutdownCB shutdown_cb;
22 ValidatorValidateCB validate_cb;
23 } OAuthValidatorCallbacks;
25 typedef const OAuthValidatorCallbacks *(*OAuthValidatorModuleInit) (void);
28 Only the <code class="function">validate_cb</code> callback is required, the others
30 </p></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="oauth-validator-design.html" title="50.1. Safely Designing a Validator Module">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="oauth-validators.html" title="Chapter 50. OAuth Validator Modules">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="oauth-validator-callbacks.html" title="50.3. OAuth Validator Callbacks">Next</a></td></tr><tr><td width="40%" align="left" valign="top">50.1. Safely Designing a Validator Module </td><td width="20%" align="center"><a accesskey="h" href="index.html" title="PostgreSQL 18.0 Documentation">Home</a></td><td width="40%" align="right" valign="top"> 50.3. OAuth Validator Callbacks</td></tr></table></div></body></html>