ldap

package
v0.0.0-...-4bcbab6 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrConnectionFailed = newLdapError("connection to ldap failed")
	ErrBindFailed       = newLdapError("user binding failed - possible wrong passsword")
)

Functions

func IsLdapUserDisabled

func IsLdapUserDisabled(userAccountControl string) bool

Types

type Error

type Error struct {
	Context string
	Err     error
}

func (*Error) Error

func (l *Error) Error() string

func (*Error) Wrap

func (l *Error) Wrap(err error) *Error

type Group

type Group struct {
	Name    string
	Members []*User
}

Group : LDAP group struct

type LDAP

type LDAP interface {
	GetUser(username string, recursiveGroup bool) (*User, error)
	FindUser(name string, recursiveGroup bool) (*User, error)
	GetGroup(name string, recursive bool) (*Group, error)
	GetGroupAndUsers(name string, recursive bool) (*Group, error)
	CheckLogin(username string, password string) (bool, error)
}

LDAP : LDAP interface to be implemented

func NewService

func NewService(repo repository.Repository, config *config.Config) (LDAP, error)

NewService : Create an new LDAP Service

type Service

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

Service : Ldap Service struct

func (*Service) CheckLogin

func (s *Service) CheckLogin(username string, password string) (bool, error)

func (*Service) FindUser

func (s *Service) FindUser(name string, recursiveGroup bool) (*User, error)

FindUser : Find an LDAP user by login attributes

func (*Service) GetGroup

func (s *Service) GetGroup(name string, recursive bool) (*Group, error)

GetGroup : Get an LDAP Group by its unique name

func (*Service) GetGroupAndUsers

func (s *Service) GetGroupAndUsers(name string, recursive bool) (*Group, error)

GetGroupAndUsers : Get an LDAP Group with users by its unique name

func (*Service) GetUser

func (s *Service) GetUser(name string, recursiveGroup bool) (*User, error)

GetUser : Get an LDAP User by its unique name

type User

type User struct {
	Username  string
	FirstName string
	LastName  string
	Mail      string
	Groups    []string
}

User : LDAP user struct

Jump to

Keyboard shortcuts

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