ldap

package
v0.8.4 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2025 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultLdapSyncDuration = 10 * time.Minute
View Source
var ErrExceedPasswordRetryLimit = errors.New("exceed password retry limit")

Functions

This section is empty.

Types

type Conn

type Conn = ldap.Conn

type Group

type Group struct {
	BaseDN     string   `cfg:"base_dn"`
	Filter     string   `cfg:"filter"`
	Attributes []string `cfg:"attributes"`
}

type Ldap

type Ldap struct {
	DisableFirstConnect bool     `cfg:"disable_first_connect"`
	Addr                string   `cfg:"addr"`
	Bind                LdapBind `cfg:"bind"`

	Group      []Group `cfg:"group"`
	UserBaseDN string  `cfg:"user_base_dn"`

	SyncDuration time.Duration `cfg:"sync_duration"`
	DisableSync  bool          `cfg:"disable_sync"`
	// contains filtered or unexported fields
}

func (*Ldap) CheckPassword added in v0.8.3

func (l *Ldap) CheckPassword(username, password string) (bool, error)

func (*Ldap) Connect

func (l *Ldap) Connect() (*ldap.Conn, error)

func (*Ldap) ConnectWithCheck

func (l *Ldap) ConnectWithCheck() (*ldap.Conn, error)

func (*Ldap) Groups

func (l *Ldap) Groups(conn *ldap.Conn) ([]LdapGroup, error)

func (*Ldap) StartSync

func (l *Ldap) StartSync(ctx context.Context, fn func(bool, string) error)

func (*Ldap) Users

func (l *Ldap) Users(conn *ldap.Conn, uids []string) ([]LdapUser, error)

type LdapBind

type LdapBind struct {
	Simple Simple `cfg:"simple"`
}

type LdapGroup

type LdapGroup struct {
	Name        string   `json:"name"`
	Members     []string `json:"members"`
	Description string   `json:"description"`
}

type LdapMap

type LdapMap struct {
	Name string `json:"name" db:"name"`
	Map  string `json:"map"  db:"map"`
}

type LdapUser

type LdapUser struct {
	UID   string `json:"uid"`
	Email string `json:"email"`
	Name  string `json:"name"`
}

type Simple

type Simple struct {
	Username string `cfg:"username"`
	Password string `cfg:"password"`
}

Jump to

Keyboard shortcuts

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