diff options
| author | tv <tv@krebsco.de> | 2026-11-07 22:35:09 +0100 |
|---|---|---|
| committer | tv <tv@krebsco.de> | 2026-11-07 22:35:09 +0100 |
| commit | a8ee17b7513c0367b5a9e5a30ae290fe53dad88b (patch) | |
| tree | f565f2271818a0b3ff86645f6bcf9039a468833a /src/api | |
| parent | 7dbb95d6c1dd7245e50d3aaadd26ee24f3506ba1 (diff) | |
access: first users at genesis
--bootstrap-users gives a new swarm a registry from its first change,
each first user with everything; other users may do nothing until
added. Without it the swarm has no registry and works as before.
Auth plan M1.
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`. |
