ldapusersystem

package
v0.0.0-...-be25ffa Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2021 License: MIT Imports: 7 Imported by: 0

README

ldapuser 通过 ldap 实现的用户模块驱动

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DirectiveFactory = func(loader func(v interface{}) error) (usersystem.Directive, error) {
	s := &Service{}
	err := loader(s)
	if err != nil {
		return nil, err
	}
	return s, nil
}

DirectiveFactory factory to create ldapuser directive

Functions

This section is empty.

Types

type Config

type Config struct {
	Net          string
	Addr         string
	UserPattern  string
	BindDN       string
	BindPass     string
	SearchDN     string
	SearchFilter string
	GroupDN      string
	GroupIDField string
	GroupFilter  string
}

Config ldap user config struct example: Net: "tcp", Addr: "127.0.0.1:389", UserPattern: "uid=%s,ou=People,dc=example", BindDN: "cn=admin,dc=example", BindPass: "password", SearchDN: "ou=People,dc=example", SearchFilter: "(uid=%s)", GroupDN: "ou=Group,dc=example", GroupFilter: "(member=%s)", GroupIDField: "cn",

func (*Config) BindUser

func (c *Config) BindUser(uid, password string) (*ldap.Conn, error)

func (*Config) Dial

func (c *Config) Dial() (*ldap.Conn, error)

func (*Config) DialBound

func (c *Config) DialBound() (*ldap.Conn, error)

func (*Config) SearchUser

func (c *Config) SearchUser(id string, fields ...string) (map[string][]string, error)

func (*Config) SearchUserGroups

func (c *Config) SearchUserGroups(id string) ([]string, error)

func (*Config) UpdatePassword

func (c *Config) UpdatePassword(uid string, password string) error

UpdatePassword update user password Return any error if raised

type Service

type Service struct {
	LDAP          *Config
	ProfileFields []string
	ServePassword bool
}

func (*Service) Execute

func (s *Service) Execute(us *usersystem.UserSystem) error

func (*Service) MustGetProfile

func (s *Service) MustGetProfile(id string) *profile.Profile

func (*Service) MustUpdatePassword

func (s *Service) MustUpdatePassword(uid string, password string)

func (*Service) MustUpdateProfile

func (s *Service) MustUpdateProfile(id string, p *profile.Profile)

func (*Service) MustVerifyPassword

func (s *Service) MustVerifyPassword(uid string, password string) bool

func (*Service) PasswordChangeable

func (s *Service) PasswordChangeable() bool

PasswordChangeable return password changeable

func (*Service) Purge

func (s *Service) Purge(string) error

Purge purge user data cache

func (*Service) Start

func (s *Service) Start() error

Start start service

func (*Service) Stop

func (s *Service) Stop() error

Stop stop service

Jump to

Keyboard shortcuts

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