↑↓ 选择 ↵ 打开 ⌫ 改范围 完整检索页

pgsql.cc 提供对 postgresql.org 官网内容的中文翻译,由 Pigsty 团队维护。

百科 / 扩展钩子 / 认证与连接

ClientAuthentication_hook

客户端认证结果

供插件在 ClientAuthentication() 中接管处理的钩子。

当前查看 PostgreSQL 18。

中文定义与说明

供插件在 ClientAuthentication() 中接管处理的钩子。

以下中文为本站依据所列 PostgreSQL 源码注释编译的说明。

接口声明

typedef void (*ClientAuthentication_hook_type) (Port *, int);
extern PGDLLIMPORT ClientAuthentication_hook_type ClientAuthentication_hook;

源码说明

此钩子允许插件在客户端认证完成之后、认证结果告知用户之前接管处理。它可用于记录登录事件、在认证失败后增加延迟等。

调用位置

  • src/backend/libpq/auth.c:664

核心调用上下文:src/backend/libpq/auth.c:658–672

					   "(%s:%d)",
					   port->user_name, hba_authname(port->hba->auth_method),
					   port->hba->sourcefile, port->hba->linenumber));
	}

	if (ClientAuthentication_hook)
		(*ClientAuthentication_hook) (port, status);

	if (status == STATUS_OK)
		sendAuthRequest(port, AUTH_REQ_OK, NULL, 0);
	else
		auth_failed(port, status, logdetail);
}

说明

供插件在 ClientAuthentication() 中接管处理的钩子。

接口类型
ClientAuthentication_hook_type
声明头文件
src/include/libpq/auth.h
调用阶段
认证与连接
初始值
NULL(未安装钩子)

接口签名

typedef void (*ClientAuthentication_hook_type) (Port *, int);
extern PGDLLIMPORT ClientAuthentication_hook_type ClientAuthentication_hook;

调用位置

src/backend/libpq/auth.c:664

文档与源码

查看来源构建
版本
18
构建
REL_18_STABLE
来源指纹
753057e340da8f22e57c9a409ea7a235fd6a46bd

同类条目

返回扩展钩子 · 此条目的收录范围为 PostgreSQL 10 至 20;起点不一定是实际引入版本。