↑↓ select ↵ open ⌫ change scope Open full search

PG.CENTER connects PostgreSQL documentation, reference, and ecosystem knowledge. Maintained by Pigsty.

Documentation / Extension Hooks / Authentication and connections

check_password_hook

check_password_hook

Hook to check passwords in CreateRole() and AlterRole()

Reading PostgreSQL 18.

Description

Hook to check passwords in CreateRole() and AlterRole()

Interface type
check_password_hook_type
Header
src/include/commands/user.h
Subsystem
Authentication and connections
Initial value
NULL (no hook installed)

C interface

typedef void (*check_password_hook_type) (const char *username, const char *shadow_pass, PasswordType password_type, Datum validuntil_time, bool validuntil_null);
extern PGDLLIMPORT check_password_hook_type check_password_hook;

Call sites

src/backend/commands/user.c:399

src/backend/commands/user.c:849

Core call context: src/backend/commands/user.c:393–407

	}

	/*
	 * Call the password checking hook if there is one defined
	 */
	if (check_password_hook && password)
		(*check_password_hook) (stmt->role,
								password,
								get_password_type(password),
								validUntil_datum,
								validUntil_null);

	/*
	 * Build a tuple to insert
	 */

Core call context: src/backend/commands/user.c:843–857

	}

	/*
	 * Call the password checking hook if there is one defined
	 */
	if (check_password_hook && password)
		(*check_password_hook) (rolename,
								password,
								get_password_type(password),
								validUntil_datum,
								validUntil_null);

	/*
	 * Build an updated tuple, perusing the information just obtained
	 */

Documentation and source

Source build
Version
18
Build
REL_18_STABLE
Source fingerprint
753057e340da8f22e57c9a409ea7a235fd6a46bd

Related entries

Back to Extension Hooks · Recorded in PostgreSQL 10 through 20; the first sample is not necessarily its introduction.