htpasswd

package
v1.0.47 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 27, 2021 License: Apache-2.0 Imports: 10 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	GroupPrefix = "@"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type HashAlgorithm

type HashAlgorithm int
const (
	BCrypt HashAlgorithm = iota
	MD5
	SHA
)

func (HashAlgorithm) String

func (a HashAlgorithm) String() string

type Htgroups added in v1.0.24

type Htgroups struct {
	// contains filtered or unexported fields
}

func NewGroups added in v1.0.24

func NewGroups() *Htgroups

func ReadGroups added in v1.0.24

func ReadGroups(r io.Reader) (*Htgroups, error)

func (*Htgroups) AddUserToGroup added in v1.0.24

func (this *Htgroups) AddUserToGroup(user, group string) error

Add user to a group

func (*Htgroups) Groups added in v1.0.24

func (this *Htgroups) Groups() []string

Return all groups

func (*Htgroups) GroupsForUser added in v1.0.24

func (this *Htgroups) GroupsForUser(user string) []string

Return groups for a user

func (*Htgroups) RemoveUserFromGroup added in v1.0.24

func (this *Htgroups) RemoveUserFromGroup(user, group string) error

Remove user from a group

func (*Htgroups) String added in v1.0.24

func (this *Htgroups) String() string

func (*Htgroups) UserInGroup added in v1.0.24

func (this *Htgroups) UserInGroup(user, group string) bool

Return true if a user is a member of a group

func (*Htgroups) UsersForGroup added in v1.0.24

func (this *Htgroups) UsersForGroup(group string) []string

Return users for a group

func (*Htgroups) Write added in v1.0.24

func (this *Htgroups) Write(w io.Writer) error

Write out group file

type Htpasswd

type Htpasswd struct {
	// contains filtered or unexported fields
}

func New

func New() *Htpasswd

func Read

func Read(r io.Reader) (*Htpasswd, error)

func (*Htpasswd) Delete

func (this *Htpasswd) Delete(name string)

Delete a password by user

func (*Htpasswd) Exists added in v1.0.24

func (this *Htpasswd) Exists(user string) bool

Return true if a user exists

func (*Htpasswd) Set

func (this *Htpasswd) Set(name, passwd string, hash HashAlgorithm) error

Set a password for a user with a named hashing algorithm

func (*Htpasswd) String

func (this *Htpasswd) String() string

func (*Htpasswd) Users

func (this *Htpasswd) Users() []string

Return with usernames

func (*Htpasswd) Verify

func (this *Htpasswd) Verify(name, passwd string) bool

Validate a password for a user

func (*Htpasswd) Write

func (this *Htpasswd) Write(w io.Writer) error

Write out passwords

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL