ldapctl

package
v0.17.2 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package ldapctl provides a simple ldap client to authenticate, retrieve basic information and groups for a user.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Command

func Command() *cobra.Command

Command adds all ldap commands

func LdapCheckCmd

func LdapCheckCmd(cmd *cobra.Command, args []string) error

Types

type LDAPClient

type LDAPClient struct {
	*ldap.Conn

	Attributes         []string
	Base               string
	BindDN             string
	BindPassword       string
	GroupFilter        string // e.g. "(memberUid=%s)"
	Host               string
	ServerName         string
	UserFilter         string // e.g. "(uid=%s)"
	Port               int
	InsecureSkipVerify bool
	UseSSL             bool
	SkipTLS            bool
	ClientCertificates []tls.Certificate // Adding client certificates
}

func (*LDAPClient) Authenticate

func (lc *LDAPClient) Authenticate(username, password string) (bool, map[string]string, error)

Authenticate authenticates the user against the ldap backend.

func (*LDAPClient) Bind

func (lc *LDAPClient) Bind() error

func (*LDAPClient) Close

func (lc *LDAPClient) Close()

Close closes the ldap backend connection.

func (*LDAPClient) Connect

func (lc *LDAPClient) Connect() error

Connect connects to the ldap backend.

func (*LDAPClient) GetGroupsOfUser

func (lc *LDAPClient) GetGroupsOfUser(username string) ([]string, error)

GetGroupsOfUser returns the group for a user.

func (LDAPClient) LogValue

func (lc LDAPClient) LogValue() slog.Value

Jump to

Keyboard shortcuts

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