OAuth validator modules are dynamically loaded from the shared
libraries listed in <xref linkend="guc-oauth-validator-libraries"/>.
Modules are loaded on demand when requested from a login in progress.
The normal library search path is used to locate the library. To
provide the validator callbacks and to indicate that the library is an OAuth
validator module a function named
<function>_PG_oauth_validator_module_init</function> must be provided. The
return value of the function must be a pointer to a struct of type
<structname>OAuthValidatorCallbacks</structname>, which contains a magic
number and pointers to the module's token validation functions. The returned
pointer must be of server lifetime, which is typically achieved by defining
it as a <literal>static const</literal> variable in global scope.
OAuth検証器モジュールは、oauth_validator_librariesにリストされている共有ライブラリから動的にロードされます。
モジュールは、進行中のログインからリクエストされたときにオンデマンドでロードされます。
通常のライブラリ検索パスは、ライブラリの位置を特定するために使用されます。
検証器コールバックを提供し、ライブラリがOAuth検証器モジュールであることを示すには、_PG_oauth_validator_module_initという名前の関数を提供する必要があります。
関数の戻り値は、OAuthValidatorCallbacks型の構造体へのポインタである必要があり、構造体はマジックナンバーとモジュールのトークン検証関数へのポインタを含みます。
戻されるポインタの存続期間はサーバの生存期間である必要があり、これは通常、グローバルスコープのstatic const変数として定義することで実現されます。
typedef struct OAuthValidatorCallbacks
{
uint32 magic; /* must be set to PG_OAUTH_VALIDATOR_MAGIC */
ValidatorStartupCB startup_cb;
ValidatorShutdownCB shutdown_cb;
ValidatorValidateCB validate_cb;
} OAuthValidatorCallbacks;
typedef const OAuthValidatorCallbacks *(*OAuthValidatorModuleInit) (void);
Only the <function>validate_cb</function> callback is required, the others
are optional.
validate_cbコールバックのみ必須、他はオプショナルです。