gousuldap

package module
v2.0.0-...-b942c1c Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const ServiceName = "ldap"

ServiceName defines the name of ldap service used for dependency injection

Variables

This section is empty.

Functions

func NewService

func NewService(ctx gousu.IContext) gousu.IService

NewService is the ServiceFactory for ldap service

Types

type IService

type IService interface {
	gousu.IService

	Reconnect() error
	SimpleLogin(username string, password string, attributes []string) (*map[string][]string, error)
}

IService defines all public functions of the ldap service

type MockService

type MockService struct {
	gousu.MockService

	SimpleLoginFunc       func(username string, password string, attributes []string) (*map[string][]string, error)
	ReconnectFunc         func() error
	SimpleLoginFuncCalled int
	ReconnectFuncCalled   int
}

MockService for simply mocking ldap IService

func NewMockService

func NewMockService() *MockService

NewMockService creates a new initialized instance of MockService

func (*MockService) Reconnect

func (s *MockService) Reconnect() error

Reconnect calls ReconnectFunc and increases ReconnectFuncCalled

func (*MockService) SimpleLogin

func (s *MockService) SimpleLogin(username string, password string, attributes []string) (*map[string][]string, error)

SimpleLogin calls SimpleLoginFunc and increases SimpleLoginFuncCalled

type Service

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

Service is the basic struct for the ldap service

func (*Service) Health

func (s *Service) Health() error

Health checks if the ldap connection is healthy by executing a bind against ldap If the connectuing is not healthy a reconnect is triggered

func (*Service) Name

func (s *Service) Name() string

Name returns the name of ldap service from ServiceName

func (*Service) Reconnect

func (s *Service) Reconnect() error

Reconnect reconnects the ldap connection

func (*Service) SimpleLogin

func (s *Service) SimpleLogin(username string, password string, attributes []string) (*map[string][]string, error)

SimpleLogin check a user against ldap and executes a bind with it's credentials

All attributes requested are returned for the matching user, else an error is returned

func (*Service) Start

func (s *Service) Start() error

Start starts the ldap service by compiling the ldap patterns and etablishing the ldap connection

func (*Service) Stop

func (s *Service) Stop() error

Stop closes the ldap connection

Jump to

Keyboard shortcuts

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