ldap

package
v0.17.1 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2023 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package ldap implements a basic LDAP authentication plugin.

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidCredentials = fmt.Errorf("invalid credentials")

ErrInvalidCredentials is returned when the credentials are invalid.

View Source
var ErrUserDisabled = fmt.Errorf("user disabled")

ErrUserDisabled is returned when the user is disabled.

Functions

func NewCreds

func NewCreds(username, password string) grpc.DialOption

NewCreds returns a DialOption that sets the LDAP credentials.

Types

type Config

type Config struct {
	// Server is the LDAP server to connect to. Specify as ldap[s]://host[:port].
	Server string `mapstructure:"server" koanf:"server"`
	// BindDN is the DN to bind with.
	BindDN string `mapstructure:"bind-dn" koanf:"bind-dn"`
	// BindPassword is the password to bind with.
	BindPassword string `mapstructure:"bind-password" koanf:"bind-password"`
	// CAFile is the path to a CA file to use to verify the LDAP server's certificate.
	CAFile string `mapstructure:"ca-file" koanf:"ca-file"`
	// UserBaseDN is the base DN to use to search for users. If empty, the entire
	// directory will be searched.
	UserBaseDN string `mapstructure:"user-base-dn" koanf:"user-base-dn"`
	// UserIDAttribute is the attribute to use to identify the user.
	UserIDAttribute string `mapstructure:"user-id-attribute" koanf:"user-id-attribute"`
	// NodeIDAttribute is the attribute to use to identify the node. If not specified, the
	// UserIDAttribute will be used.
	NodeIDAttribute string `mapstructure:"node-id-attribute" koanf:"node-id-attribute"`
	// UserDisabledAttribute is the attribute to use to determine if the user is disabled.
	// If not specified, all user's will be considered active.
	UserDisabledAttribute string `mapstructure:"user-status-attribute" koanf:"user-status-attribute"`
	// UserDisabledValue is the value of the UserStatusAttribute that indicates the user is disabled.
	// If not specified, any non-empty value of the UserDisabledAttribute will be considered disabled.
	UserDisabledValue string `mapstructure:"user-disabled-value" koanf:"user-disabled-value"`
}

Config is the configuration for the LDAP plugin.

func (*Config) AsMapStructure added in v0.3.1

func (c *Config) AsMapStructure() map[string]any

func (*Config) BindFlags added in v0.3.1

func (c *Config) BindFlags(prefix string, fs *pflag.FlagSet)

BindFlags binds the flags to the config.

func (*Config) DefaultOptions added in v0.3.1

func (c *Config) DefaultOptions() *Config

DefaultOptions returns the default options for the plugin.

func (*Config) SetMapStructure added in v0.8.0

func (c *Config) SetMapStructure(in map[string]any)

type Plugin

type Plugin struct {
	v1.UnimplementedPluginServer
	v1.UnimplementedAuthPluginServer
	// contains filtered or unexported fields
}

Plugin is the ldap plugin.

func (*Plugin) Authenticate

func (*Plugin) Close

func (p *Plugin) Close(ctx context.Context, req *emptypb.Empty) (*emptypb.Empty, error)

func (*Plugin) Configure

func (p *Plugin) Configure(ctx context.Context, req *v1.PluginConfiguration) (*emptypb.Empty, error)

func (*Plugin) GetInfo

func (p *Plugin) GetInfo(context.Context, *emptypb.Empty) (*v1.PluginInfo, error)

Jump to

Keyboard shortcuts

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