{"Entry":{"collection":"hook","key":"clientauthentication_hook","name":"ClientAuthentication_hook","aliases":[],"metadata":{"aliases":[],"category":"Authentication and connections","content_hash":"ffb7f90abd6354eec46a90a9341b34dc08a1bace366c386eef1a70dbfd87c0b7","derived_content_hash":"b1b6d654c340d3dce786ad594b0b22792ed240687542435e7e35d87ac2683bcf","imported_at":"2026-09-27T17:57:58.826579+08:00","name":"ClientAuthentication_hook","name_zh":"ClientAuthentication_hook","repair_provenance":{"original_source_revision":"","receipt_sha256":"864db801791cffce5556396e7d5842a152311c9f0a14ddd8bd86087097ed19b9","repair":"wiki-repair-20261023"},"slug":"clientauthentication_hook","source_rev":"wiki-repair-20261023:7897307044d4a105cd08f216375bc04e7c6de74e96e49e73dc03be6f3f4f02b3","summary":"Hook for plugins to get control in ClientAuthentication()"}},"Definition":{"Collection":"hook","Key":"clientauthentication_hook","SourceDatabase":"center","Version":"18","SourceTable":"hook","SourceKey":"clientauthentication_hook","SourceRevision":"753057e340da8f22e57c9a409ea7a235fd6a46bd","Facts":{"description":["Hook for plugins to get control in ClientAuthentication()"],"description_zh":"供插件在 ClientAuthentication() 中接管处理的钩子。","description_zh_html":"\u003cp\u003e供插件在 ClientAuthentication() 中接管处理的钩子。\u003c/p\u003e\u003cp\u003e以下中文为本站依据所列 PostgreSQL 源码注释编译的说明。\u003c/p\u003e\u003ch3\u003e接口声明\u003c/h3\u003e\u003cpre\u003etypedef void (*ClientAuthentication_hook_type) (Port *, int);\nextern PGDLLIMPORT ClientAuthentication_hook_type ClientAuthentication_hook;\u003c/pre\u003e\u003ch3\u003e源码说明\u003c/h3\u003e\u003cp\u003e此钩子允许插件在客户端认证完成之后、认证结果告知用户之前接管处理。它可用于记录登录事件、在认证失败后增加延迟等。\u003c/p\u003e\u003ch3\u003e调用位置\u003c/h3\u003e\u003cul\u003e\u003cli\u003e\u003ccode\u003esrc/backend/libpq/auth.c:664\u003c/code\u003e\u003c/li\u003e\u003c/ul\u003e\u003ch3\u003e核心调用上下文：src/backend/libpq/auth.c:658–672\u003c/h3\u003e\u003cpre\u003e\t\t\t\t\t   \u0026quot;(%s:%d)\u0026quot;,\n\t\t\t\t\t   port-\u0026gt;user_name, hba_authname(port-\u0026gt;hba-\u0026gt;auth_method),\n\t\t\t\t\t   port-\u0026gt;hba-\u0026gt;sourcefile, port-\u0026gt;hba-\u0026gt;linenumber));\n\t}\n\n\tif (ClientAuthentication_hook)\n\t\t(*ClientAuthentication_hook) (port, status);\n\n\tif (status == STATUS_OK)\n\t\tsendAuthRequest(port, AUTH_REQ_OK, NULL, 0);\n\telse\n\t\tauth_failed(port, status, logdetail);\n}\n\n\u003c/pre\u003e","facts":[{"label":"Interface type","value":"ClientAuthentication_hook_type"},{"label":"Header","value":"src/include/libpq/auth.h"},{"label":"Subsystem","value":"Authentication and connections"},{"label":"Initial value","value":"NULL (no hook installed)"}],"related":[],"release":{"channel":"stable","label":"18","major":"18","ref":"REL_18_STABLE","revision":"753057e340da8f22e57c9a409ea7a235fd6a46bd"},"sections":[{"paragraphs":["This hook allows plugins to get control following client authentication, but before the user has been informed about the results. It could be used to record login events, insert a delay after failed authentication, etc."],"title":"Core source comments"},{"paragraphs":["src/backend/libpq/auth.c:664"],"title":"Call sites"},{"code":"\t\t\t\t\t   \"(%s:%d)\",\n\t\t\t\t\t   port-\u003euser_name, hba_authname(port-\u003ehba-\u003eauth_method),\n\t\t\t\t\t   port-\u003ehba-\u003esourcefile, port-\u003ehba-\u003elinenumber));\n\t}\n\n\tif (ClientAuthentication_hook)\n\t\t(*ClientAuthentication_hook) (port, status);\n\n\tif (status == STATUS_OK)\n\t\tsendAuthRequest(port, AUTH_REQ_OK, NULL, 0);\n\telse\n\t\tauth_failed(port, status, logdetail);\n}\n\n","paragraphs":[],"title":"Core call context: src/backend/libpq/auth.c:658–672"}],"signature":"typedef void (*ClientAuthentication_hook_type) (Port *, int);\nextern PGDLLIMPORT ClientAuthentication_hook_type ClientAuthentication_hook;","sources":[{"label":"Interface declaration","path":"src/include/libpq/auth.h","sha256":"976773a9612d289da53c43129ef0438a57904cdd19ffa2ca3d6d2b00104ec241","url":"https://github.com/postgres/postgres/blob/753057e340da8f22e57c9a409ea7a235fd6a46bd/src/include/libpq/auth.h#L45"},{"label":"Core definition","path":"src/backend/libpq/auth.c","sha256":"94252cb1e2c49b0ddb15f6596d0abf8056c84493de07cc81439da4c5b07018f1","url":"https://github.com/postgres/postgres/blob/753057e340da8f22e57c9a409ea7a235fd6a46bd/src/backend/libpq/auth.c#L223"},{"label":"Call sites","path":"src/backend/libpq/auth.c","sha256":"94252cb1e2c49b0ddb15f6596d0abf8056c84493de07cc81439da4c5b07018f1","url":"https://github.com/postgres/postgres/blob/753057e340da8f22e57c9a409ea7a235fd6a46bd/src/backend/libpq/auth.c#L664"}],"translation_provenance":{"inputs":[{"label":"Interface declaration","path":"src/include/libpq/auth.h","sha256":"976773a9612d289da53c43129ef0438a57904cdd19ffa2ca3d6d2b00104ec241","url":"https://github.com/postgres/postgres/blob/753057e340da8f22e57c9a409ea7a235fd6a46bd/src/include/libpq/auth.h#L45"},{"label":"Core definition","path":"src/backend/libpq/auth.c","sha256":"94252cb1e2c49b0ddb15f6596d0abf8056c84493de07cc81439da4c5b07018f1","url":"https://github.com/postgres/postgres/blob/753057e340da8f22e57c9a409ea7a235fd6a46bd/src/backend/libpq/auth.c#L223"},{"label":"Call sites","path":"src/backend/libpq/auth.c","sha256":"94252cb1e2c49b0ddb15f6596d0abf8056c84493de07cc81439da4c5b07018f1","url":"https://github.com/postgres/postgres/blob/753057e340da8f22e57c9a409ea7a235fd6a46bd/src/backend/libpq/auth.c#L664"}],"kind":"authored-source-translation","locale":"zh-Hans","source_revision":"753057e340da8f22e57c9a409ea7a235fd6a46bd","translated_source_sha256":"3a8aedbcfa3ca2e22cf96972ed842adbf966dd5024577ea8f35639bb850b8c6c","version":"18"},"zh_from":"authored-source-translation"},"ManualEvidence":{"release":{"channel":"stable","label":"18","major":"18","ref":"REL_18_STABLE","revision":"753057e340da8f22e57c9a409ea7a235fd6a46bd"},"sources":[{"label":"Interface declaration","path":"src/include/libpq/auth.h","sha256":"976773a9612d289da53c43129ef0438a57904cdd19ffa2ca3d6d2b00104ec241","url":"https://github.com/postgres/postgres/blob/753057e340da8f22e57c9a409ea7a235fd6a46bd/src/include/libpq/auth.h#L45"},{"label":"Core definition","path":"src/backend/libpq/auth.c","sha256":"94252cb1e2c49b0ddb15f6596d0abf8056c84493de07cc81439da4c5b07018f1","url":"https://github.com/postgres/postgres/blob/753057e340da8f22e57c9a409ea7a235fd6a46bd/src/backend/libpq/auth.c#L223"},{"label":"Call sites","path":"src/backend/libpq/auth.c","sha256":"94252cb1e2c49b0ddb15f6596d0abf8056c84493de07cc81439da4c5b07018f1","url":"https://github.com/postgres/postgres/blob/753057e340da8f22e57c9a409ea7a235fd6a46bd/src/backend/libpq/auth.c#L664"}]},"MeasuredEvidence":{}},"Text":{"Collection":"hook","Key":"clientauthentication_hook","SourceDatabase":"center","Version":"18","Locale":"en","Title":"ClientAuthentication_hook","Summary":"Hook for plugins to get control in ClientAuthentication()","BodyHTML":"\u003cp\u003eHook for plugins to get control in ClientAuthentication()\u003c/p\u003e","SourceRevision":"753057e340da8f22e57c9a409ea7a235fd6a46bd","ContentHash":"20360f5144e687f2af3cc976350717a44c42a6a1b0a7172ee415166576967061","Payload":{"description":["Hook for plugins to get control in ClientAuthentication()"],"related":[],"sections":[{"paragraphs":["This hook allows plugins to get control following client authentication, but before the user has been informed about the results. It could be used to record login events, insert a delay after failed authentication, etc."],"title":"Core source comments"},{"paragraphs":["src/backend/libpq/auth.c:664"],"title":"Call sites"},{"code":"\t\t\t\t\t   \"(%s:%d)\",\n\t\t\t\t\t   port-\u003euser_name, hba_authname(port-\u003ehba-\u003eauth_method),\n\t\t\t\t\t   port-\u003ehba-\u003esourcefile, port-\u003ehba-\u003elinenumber));\n\t}\n\n\tif (ClientAuthentication_hook)\n\t\t(*ClientAuthentication_hook) (port, status);\n\n\tif (status == STATUS_OK)\n\t\tsendAuthRequest(port, AUTH_REQ_OK, NULL, 0);\n\telse\n\t\tauth_failed(port, status, logdetail);\n}\n\n","paragraphs":[],"title":"Core call context: src/backend/libpq/auth.c:658–672"}]}},"RequestedLocale":"en","Fallback":false,"Versions":["10","11","12","13","14","15","16","17","18","19","20"],"Locales":["en","zh-Hans"],"Signatures":null,"Spellings":null,"SQLState":null,"Evidence":null}
