client

package
v0.12.1 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2024 License: MPL-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SchemaOpenLDAP = "openldap"
	SchemaAD       = "ad"
	SchemaRACF     = "racf"
)

Variables

View Source
var FieldRegistry = newFieldRegistry()

FieldRegistry is designed to look and feel like an enum from another language like Python.

Example: Accessing constants

FieldRegistry.AccountExpires
FieldRegistry.BadPasswordCount

Example: Utility methods

FieldRegistry.List()
FieldRegistry.Parse("givenName")

Functions

func GetSchemaFieldRegistry added in v0.1.1

func GetSchemaFieldRegistry(schema string, newPassword string) (map[*Field][]string, error)

GetSchemaFieldRegistry type switches field registries depending on the configured schema. For example, IBM RACF has a custom LDAP schema so the password is stored in a different attribute.

func SupportedSchemas added in v0.1.1

func SupportedSchemas() []string

SupportedSchemas returns a slice of different LDAP schemas supported by the plugin. This is used to change the FieldRegistry when modifying user passwords and to set the default user attribute (userattr).

func ValidSchema added in v0.1.1

func ValidSchema(schema string) bool

ValidSchema checks if the configured schema is supported by the plugin.

Types

type Client

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

func New

func New(logger hclog.Logger) Client

func NewWithClient added in v0.11.3

func NewWithClient(logger hclog.Logger, ldap ldaputil.LDAP) Client

func (*Client) Execute added in v0.4.0

func (c *Client) Execute(cfg *Config, entries []*ldif.Entry, continueOnFailure bool) (err error)

func (*Client) Search

func (c *Client) Search(cfg *Config, baseDN string, scope int, filters map[*Field][]string) ([]*Entry, error)

func (*Client) UpdateEntry

func (c *Client) UpdateEntry(cfg *Config, baseDN string, scope int, filters map[*Field][]string, newValues map[*Field][]string) error

func (*Client) UpdatePassword

func (c *Client) UpdatePassword(cfg *Config, baseDN string, scope int, newValues map[*Field][]string, filters map[*Field][]string) error

UpdatePassword uses a Modify call under the hood instead of LDAP change password function. This allows AD and OpenLDAP schemas to use the same api without changes to the interface.

type Config

type Config struct {
	*ldaputil.ConfigEntry
	LastBindPassword         string    `json:"last_bind_password"`
	LastBindPasswordRotation time.Time `json:"last_bind_password_rotation"`
	Schema                   string    `json:"schema"`
}

type Entry

type Entry struct {
	*ldap.Entry
	// contains filtered or unexported fields
}

func NewEntry

func NewEntry(ldapEntry *ldap.Entry) *Entry

Entry is an LDAP-specific construct to make knowing and grabbing fields more convenient, while retaining all original information.

func (*Entry) Get

func (e *Entry) Get(field *Field) ([]string, bool)

func (*Entry) GetJoined

func (e *Entry) GetJoined(field *Field) (string, bool)

type Field

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

func (*Field) String

func (f *Field) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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