people

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrAuthenticationFailed = errors.New("invalid username and/or password")
	ErrPersonNotFound       = errors.New("person not found in store")
	ErrReadOnly             = errors.New("store is read-only")
)

Functions

This section is empty.

Types

type AuthenticPerson

type AuthenticPerson struct {
	Person
	PasswordHash string `json:"password_hash"`
	OTPAuthURI   string `json:"otpauth_uri,omitempty"`
}

type Person

type Person struct {
	Birthdate     string   `json:"birthdate,omitempty"`
	Department    string   `json:"department,omitempty"`
	Email         string   `json:"email,omitempty"`
	FamilyName    string   `json:"family_name,omitempty"`
	GivenName     string   `json:"given_name,omitempty"`
	Groups        []string `json:"groups,omitempty"`
	PhoneNumber   string   `json:"phone_number,omitempty"`
	RoomNumber    string   `json:"room_number,omitempty"`
	StreetAddress string   `json:"street_address,omitempty"`
	Locality      string   `json:"locality,omitempty"`
	PostalCode    string   `json:"postal_code,omitempty"`
}

type PersonDetails added in v0.7.1

type PersonDetails struct {
	Birthdate     sql.NullString `db:"birthdate"`
	Department    sql.NullString `db:"department"`
	Email         sql.NullString `db:"email"`
	FamilyName    sql.NullString `db:"family_name"`
	GivenName     sql.NullString `db:"given_name"`
	PhoneNumber   sql.NullString `db:"phone_number"`
	RoomNumber    sql.NullString `db:"room_number"`
	StreetAddress sql.NullString `db:"street_address"`
	Locality      sql.NullString `db:"locality"`
	PostalCode    sql.NullString `db:"postal_code"`
}

func (PersonDetails) Person added in v0.7.1

func (p PersonDetails) Person() *Person

type Store

type Store interface {
	Authenticate(userID, password string) (string, error)
	Lookup(userID string) (*Person, error)
	Ping() error
	ReadOnly() bool
	Put(userID string, person *Person) error
	ChangePassword(userID, password string) error
}

func NewInMemoryStore added in v0.8.0

func NewInMemoryStore(users map[string]AuthenticPerson) Store

func NewLdapStore

func NewLdapStore(users map[string]AuthenticPerson, settings *StoreSettings) (Store, error)

func NewSqlStore

func NewSqlStore(users map[string]AuthenticPerson, dbs map[string]*sql.DB, settings *StoreSettings) (Store, error)

type StoreSettings

type StoreSettings struct {
	URI                 string            `json:"uri,omitempty"`
	CredentialsQuery    string            `json:"credentials_query,omitempty"`
	GroupsQuery         string            `json:"groups_query,omitempty"`
	DetailsQuery        string            `json:"details_query,omitempty"`
	Parameters          map[string]string `json:"parameters,omitempty"`
	Update              string            `json:"update,omitempty"`
	ChangePasswordQuery string            `json:"change_password_query,omitempty"`
}

Jump to

Keyboard shortcuts

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