ldap

package
v0.11.6 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2025 License: BSD-3-Clause-Clear Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ScopeBaseObject   = 0
	ScopeSingleLevel  = 1
	ScopeWholeSubtree = 2
	NeverDerefAliases = 0
)

LDAP constants (stubs)

Variables

This section is empty.

Functions

func EscapeFilter

func EscapeFilter(filter string) string

Types

type Attribute

type Attribute struct {
	Name   string
	Values []string
}

type Config

type Config struct {
	// Connection settings
	Host       string        `mapstructure:"host"`
	Port       int           `mapstructure:"port"`
	UseTLS     bool          `mapstructure:"use_tls"`
	SkipVerify bool          `mapstructure:"skip_verify"`
	Timeout    time.Duration `mapstructure:"timeout"`

	// Authentication
	BindDN       string `mapstructure:"bind_dn"`
	BindPassword string `mapstructure:"bind_password"`

	// Connection pool settings
	MaxConnections int           `mapstructure:"max_connections"`
	IdleTimeout    time.Duration `mapstructure:"idle_timeout"`
	ConnectTimeout time.Duration `mapstructure:"connect_timeout"`
	RequestTimeout time.Duration `mapstructure:"request_timeout"`

	// Health check settings
	HealthCheckBindTest bool          `mapstructure:"health_check_bind_test"`
	HealthCheckTimeout  time.Duration `mapstructure:"health_check_timeout"`

	// Description for this LDAP provider instance
	Description string `mapstructure:"description"`
}

LDAPConfig defines configuration for LDAP directory providers

func DefaultConfig

func DefaultConfig() Config

DefaultConfig returns a default LDAP configuration

type Conn

type Conn struct{}

LDAP types (stubs)

func Dial

func Dial(_, _ string) (*Conn, error)

LDAP functions (stubs)

func DialTLS

func DialTLS(_, _ string, _ *tls.Config) (*Conn, error)

func (*Conn) Bind

func (c *Conn) Bind(_, _ string) error

func (*Conn) Close

func (c *Conn) Close() error

func (*Conn) Search

func (c *Conn) Search(_ *SearchRequest) (*SearchResult, error)

func (*Conn) SetTimeout

func (c *Conn) SetTimeout(_ interface{})

type Entry

type Entry struct {
	DN         string
	Attributes []*Attribute
}

type Mapper

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

Mapper handles mapping for LDAP providers

func NewMapper

func NewMapper() *Mapper

NewMapper creates a new LDAP mapper

func (*Mapper) ApplyTransformation

func (m *Mapper) ApplyTransformation(value interface{}, transformationName string) (interface{}, error)

ApplyTransformation applies LDAP-specific transformations

func (*Mapper) ExtractParameters

func (m *Mapper) ExtractParameters(jwtClaims types.JWTClaims, inputMapping []types.InputMapping) (map[string]interface{}, error)

ExtractParameters extracts parameters for LDAP queries with proper validation

func (*Mapper) GetSupportedTransformations

func (m *Mapper) GetSupportedTransformations() []string

GetSupportedTransformations returns LDAP-specific transformations

func (*Mapper) TransformResults

func (m *Mapper) TransformResults(rawData map[string]interface{}, outputMapping []types.OutputMapping) (map[string]interface{}, error)

TransformResults transforms LDAP search results to standardized claims

func (*Mapper) ValidateInputMapping

func (m *Mapper) ValidateInputMapping(inputMapping []types.InputMapping) error

ValidateInputMapping validates LDAP-specific input mapping requirements

func (*Mapper) ValidateOutputMapping

func (m *Mapper) ValidateOutputMapping(outputMapping []types.OutputMapping) error

ValidateOutputMapping validates LDAP-specific output mapping requirements

type Provider

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

Provider implements the Provider interface for LDAP directories

func NewProvider

func NewProvider(ctx context.Context, name string, config Config) (*Provider, error)

NewProvider creates a new LDAP provider

func (*Provider) Close

func (p *Provider) Close() error

Close closes LDAP connections

func (*Provider) GetMapper

func (p *Provider) GetMapper() types.Mapper

GetMapper returns the provider's mapper implementation

func (*Provider) HealthCheck

func (p *Provider) HealthCheck(_ context.Context) error

HealthCheck verifies the LDAP server is accessible

func (*Provider) Name

func (p *Provider) Name() string

Name returns the provider instance name

func (*Provider) ResolveEntity

func (p *Provider) ResolveEntity(ctx context.Context, strategy types.MappingStrategy, params map[string]interface{}) (*types.RawResult, error)

ResolveEntity executes LDAP search to resolve entity information

func (*Provider) Type

func (p *Provider) Type() string

Type returns the provider type

type SearchRequest

type SearchRequest struct{}

LDAP types (stubs)

func NewSearchRequest

func NewSearchRequest(_ string, _, _, _, _ int, _ bool, _ string, _ []string, _ []interface{}) *SearchRequest

type SearchResult

type SearchResult struct {
	Entries []*Entry
}

LDAP types (stubs)

Jump to

Keyboard shortcuts

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