diff options
| author | tv <tv@krebsco.de> | 2026-11-07 01:59:38 +0100 |
|---|---|---|
| committer | tv <tv@krebsco.de> | 2026-11-07 01:59:38 +0100 |
| commit | 09b4f7daac52b5aa6cebaa9c147a9086b105aac9 (patch) | |
| tree | 2e18e044e9e1c6b690fe1cfd1f95517a4fcf503c /src/api | |
| parent | 4479bb89595958721a2dfef57dbcb89b255a7ad8 (diff) | |
access first usersauth
Diffstat (limited to 'src/api')
| -rw-r--r-- | src/api/auth.rs | 7 |
1 files changed, 7 insertions, 0 deletions
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<HashMap<String, String>> { Ok(users) } +/// The user names of the htpasswd file at `path` (`load_users`), sorted. +pub(crate) fn htpasswd_names(path: &str) -> anyhow::Result<Vec<String>> { + let mut names: Vec<String> = 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`. |
