people

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2024 License: MIT Imports: 13 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"`
}

type Person

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

type Store

type Store interface {
	Authenticate(userID, password string) (string, error)
	IsSessionActive(r *http.Request, sessionName string) (string, bool)
	SaveSession(r *http.Request, w http.ResponseWriter, authTime time.Time, userID, sessionName string) error
	Lookup(userID string) (*Person, error)
	Ping() error
	ReadOnly() bool
	Put(userID string, person *Person) error
	SetPassword(userID, password string) error
}

func NewEmbeddedStore

func NewEmbeddedStore(sessionStore sessions.Store, users map[string]AuthenticPerson, sessionTTL int64) Store

func NewLdapStore

func NewLdapStore(sessionStore sessions.Store, users map[string]AuthenticPerson, sessionTTL int64, settings *StoreSettings) (Store, error)

func NewSqlStore

func NewSqlStore(sessionStore sessions.Store, users map[string]AuthenticPerson, sessionTTL int64, 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"`
	SetPassword      string            `json:"set_password,omitempty"`
}

Jump to

Keyboard shortcuts

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