ldap

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2024 License: MIT Imports: 12 Imported by: 1

Documentation

Index

Constants

View Source
const (
	TimeLayout = "20060102150405Z"
	DateLayout = "20060102"

	DefaultPageSize = 100
	DefaultPoolSize = 10
)

consts

Variables

View Source
var (
	ErrEmptyAddr   = errors.New("ldap addr is empty")
	ErrEmptyBase   = errors.New("ldap base is empty")
	ErrEmptyCN     = errors.New("ldap cn is empty")
	ErrEmptyDN     = errors.New("ldap dn is empty")
	ErrEmptyFilter = errors.New("ldap filter is empty")
	ErrEmptyPwd    = errors.New("ldap passwd is empty")
	ErrEmptyUID    = errors.New("ldap uid is empty")
	ErrInvalidUID  = errors.New("ldap uid is invalid")
	ErrLogin       = errors.New("Incorrect Username/Password")
	ErrNotFound    = errors.New("Not Found")
	ErrUnsupport   = errors.New("Unsupported")
)

nolint

Functions

This section is empty.

Types

type Config

type Config struct {
	Addr     string `json:"addr"`
	Base     string `json:"base"`
	Bind     string `json:"bind"`
	Passwd   string `json:"-"`
	Domain   string `json:"domain"`
	PageSize int    `json:"-"`
}

Config LDAP config

func NewConfig

func NewConfig() *Config

NewConfig return default Config from Environment

func (*Config) CopyFrom

func (c *Config) CopyFrom(o Config)

CopyFrom ...

type Group

type Group = model.Group

Group ...

type People

type People = model.People

People ...

type Peoples

type Peoples = model.Peoples

Peoples ...

type PoolStats

type PoolStats = pool.Stats

PoolStats ...

type Spec

type Spec = model.Spec

Spec ...

type Store

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

Store ..

func NewStore

func NewStore(cfg *Config) (*Store, error)

NewStore ...

func (*Store) All

func (s *Store) All(spec *Spec) (staffs Peoples)

All ...

func (*Store) AllGroup

func (s *Store) AllGroup() (data []Group, err error)

AllGroup ...

func (*Store) Authenticate

func (s *Store) Authenticate(uid, passwd string) (staff *People, err error)

Authenticate verify uid and password from one of sources, return valid DN and error

func (*Store) Close

func (s *Store) Close()

Close ...

func (*Store) Delete

func (s *Store) Delete(uid string) (err error)

Delete ...

func (*Store) EraseGroup

func (s *Store) EraseGroup(name string) error

EraseGroup ...

func (*Store) Get

func (s *Store) Get(uid string) (staff *People, err error)

Get return People with uid

func (*Store) GetByDN

func (s *Store) GetByDN(dn string) (staff *People, err error)

GetByDN ...

func (*Store) GetGroup

func (s *Store) GetGroup(name string) (group *Group, err error)

GetGroup ...

func (*Store) ModifyBySelf

func (s *Store) ModifyBySelf(uid, password string, staff *People) (err error)

ModifyBySelf ...

func (*Store) PasswordChange

func (s *Store) PasswordChange(uid, oldPasswd, newPasswd string) (err error)

PasswordChange ...

func (*Store) PasswordReset

func (s *Store) PasswordReset(uid, passwd string) (err error)

PasswordReset ...

func (*Store) PoolStats

func (s *Store) PoolStats() *PoolStats

PoolStats ...

func (*Store) Ready

func (s *Store) Ready() error

Ready ...

func (*Store) Rename added in v0.2.1

func (s *Store) Rename(oldUID, newUID string) (err error)

Rename ...

func (*Store) Save

func (s *Store) Save(staff *People) (isNew bool, err error)

Save ...

func (*Store) SaveGroup

func (s *Store) SaveGroup(group *Group) error

SaveGroup ...

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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