Files
goSam/auth.go

34 lines
763 B
Go
Raw Normal View History

2024-11-13 14:39:08 -05:00
package gosam
2022-04-28 11:23:54 -04:00
// SetupAuth sends the AUTH ENABLE command and immediately sets up a new Username and
// Password from the arguments
func (c *Client) SetupAuth(user, password string) error {
2025-03-07 01:35:21 +00:00
_, err := c.sendCmd("AUTH ENABLE\n")
2022-04-28 11:23:54 -04:00
if err != nil {
return err
}
2025-03-07 01:35:21 +00:00
_, err = c.sendCmd("AUTH %s %s\n", user, password)
2022-04-28 11:23:54 -04:00
if err != nil {
return err
}
return nil
}
// TeardownAuth sends the AUTH DISABLE command but does not remove the Username and
// Password from the client PasswordManager
func (c *Client) TeardownAuth() error {
2025-03-07 01:35:21 +00:00
_, err := c.sendCmd("AUTH DISABLE\n")
2022-04-28 11:23:54 -04:00
if err != nil {
return err
}
return nil
}
func (c *Client) RemoveAuthUser(user string) error {
2025-03-07 01:35:21 +00:00
_, err := c.sendCmd("AUTH REMOVE %s\n", user)
2022-04-28 11:23:54 -04:00
if err != nil {
return err
}
return nil
}