From 09b4f7daac52b5aa6cebaa9c147a9086b105aac9 Mon Sep 17 00:00:00 2001 From: tv Date: Sat, 7 Nov 2026 01:59:38 +0100 Subject: access first users --- src/api/auth.rs | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/api/auth.rs') diff --git a/src/api/auth.rs b/src/api/auth.rs index 400feed..f85b64e 100644 --- a/src/api/auth.rs +++ b/src/api/auth.rs @@ -52,6 +52,13 @@ fn load_users(path: &str) -> anyhow::Result> { Ok(users) } +/// The user names of the htpasswd file at `path` (`load_users`), sorted. +pub(crate) fn htpasswd_names(path: &str) -> anyhow::Result> { + let mut names: Vec = load_users(path)?.into_keys().collect(); + names.sort(); + Ok(names) +} + /// Who may use the HTTP API: the users of an htpasswd file (basic authentication), /// and the user a reverse proxy in front names (`--user-header`), if it is one of /// `--trusted-proxies`. -- cgit v1.3.1