ldap

package
v1.10.3 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2021 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ILDAPService

type ILDAPService interface {
	Connect() error
	Close()
	Authenticate(username, password string) (bool, map[string]string, error)
	GetGroupsOfUser(userDN string) ([]string, error)
	IsAvailable() bool
}

func NewLDAPClient

func NewLDAPClient() ILDAPService

type ILdapClient

type ILdapClient interface {
	Start()
	Close()
	SetTimeout(timeout time.Duration)
	StartTLS(config *tls.Config) error
	Search(searchRequest *ldap.SearchRequest) (*ldap.SearchResult, error)
	Bind(username, password string) error
}

type Mock

type Mock struct {
	mock.Mock
}

func (*Mock) Authenticate

func (m *Mock) Authenticate(username, password string) (bool, map[string]string, error)

func (*Mock) Close

func (m *Mock) Close()

func (*Mock) Connect

func (m *Mock) Connect() error

func (*Mock) GetGroupsOfUser

func (m *Mock) GetGroupsOfUser(userDN string) ([]string, error)

func (*Mock) IsAvailable added in v1.7.0

func (m *Mock) IsAvailable() bool

type Service

type Service struct {
	Host               string
	Port               int
	Base               string
	BindDN             string
	BindPassword       string
	ServerName         string
	InsecureSkipVerify bool
	UseSSL             bool
	SkipTLS            bool
	ClientCertificates []tls.Certificate
	Conn               ILdapClient
	UserFilter         string
}

func (*Service) Authenticate

func (s *Service) Authenticate(username, password string) (bool, map[string]string, error)

func (*Service) Close

func (s *Service) Close()

func (*Service) Connect

func (s *Service) Connect() error

func (*Service) GetGroupsOfUser

func (s *Service) GetGroupsOfUser(userDN string) ([]string, error)

func (*Service) IsAvailable added in v1.7.0

func (s *Service) IsAvailable() bool

Jump to

Keyboard shortcuts

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