feat(cli): add server user set-password-hash command (#3974)

Objectives:
- Facilitate the generation of valid password hashes that can be used with
  the `server user --user-password` CLI command.
- Encapsulate implementation details of password hashing in
  the `user` package.

Adds a new `server user hash-password` CLI command to generate the
hash from a supplied password.

Modifies the `server user set/add --user-password-hash` CLI command
to accept the password hash generated using the `hash-password`
command.

Adds `GetNewProfile(ctx, rep, username)` helper to move implementation
details to the `user` package.

Includes CLI and unit tests.

Cleans up and removes unused functions.
This commit is contained in:
Julio López authored and GitHub committed 2024-07-11 19:29:06 -07:00
1 parent d0bff3004d
commit 9c5fc842a1
14 files changed
+456 -111

No files matched your search

+2
View File
@@ -4,6 +4,7 @@ type commandServerUser struct {
add commandServerUserAddSet
set commandServerUserAddSet
delete commandServerUserDelete
hash commandServerUserHashPassword
info commandServerUserInfo
list commandServerUserList
}
@@ -14,6 +15,7 @@ func (c *commandServerUser) setup(svc appServices, parent commandParent) {
c.add.setup(svc, cmd, true)
c.set.setup(svc, cmd, false)
c.delete.setup(svc, cmd)
c.hash.setup(svc, cmd)
c.info.setup(svc, cmd)
c.list.setup(svc, cmd)
}