ldap

package
v1.4.6 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2020 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AttrConfig

type AttrConfig struct {
	Names      []string             `help:"The names of LDAP attributes to request on an LDAP search"`
	Converters []NameVal            // Used to convert an LDAP entry into a fabric-ca-server attribute
	Maps       map[string][]NameVal // Use to map an LDAP response to fabric-ca-server names
}

AttrConfig is attribute configuration information

type Client

type Client struct {
	Host          string
	Port          int
	UseSSL        bool
	AdminDN       string
	AdminPassword string
	Base          string
	UserFilter    string // e.g. "(uid=%s)"
	GroupFilter   string // e.g. "(memberUid=%s)"

	AdminConn *ldap.Conn
	TLS       *ctls.ClientTLSConfig
	CSP       bccsp.BCCSP
	// contains filtered or unexported fields
}

Client is an LDAP client

func NewClient

func NewClient(cfg *Config, csp bccsp.BCCSP) (*Client, error)

NewClient creates an LDAP client

func (*Client) DeleteAffiliation

func (lc *Client) DeleteAffiliation(name string, force, identityRemoval, isRegistrar bool) (*causer.DbTxResult, error)

DeleteAffiliation deletes an affiliation group

func (*Client) DeleteUser

func (lc *Client) DeleteUser(id string) (causer.User, error)

DeleteUser deletes a user

func (*Client) GetAffiliation

func (lc *Client) GetAffiliation(name string) (spi.Affiliation, error)

GetAffiliation returns an affiliation group

func (*Client) GetAffiliationTree

func (lc *Client) GetAffiliationTree(name string) (*causer.DbTxResult, error)

GetAffiliationTree returns the requested affiliations and all affiliations below it

func (*Client) GetAllAffiliations

func (lc *Client) GetAllAffiliations(name string) (*sqlx.Rows, error)

GetAllAffiliations gets affiliation and any sub affiliation from the database

func (*Client) GetFilteredUsers

func (lc *Client) GetFilteredUsers(affiliation, types string) (*sqlx.Rows, error)

GetFilteredUsers returns all identities that fall under the affiliation and types

func (*Client) GetRootAffiliation

func (lc *Client) GetRootAffiliation() (spi.Affiliation, error)

GetRootAffiliation returns the root affiliation group

func (*Client) GetUser

func (lc *Client) GetUser(username string, attrNames []string) (causer.User, error)

GetUser returns a user object for username and attribute values for the requested attribute names

func (*Client) GetUserLessThanLevel

func (lc *Client) GetUserLessThanLevel(version int) ([]causer.User, error)

GetUserLessThanLevel returns all identities that are less than the level specified

func (*Client) InsertAffiliation

func (lc *Client) InsertAffiliation(name string, prekey string, version int) error

InsertAffiliation adds an affiliation group

func (*Client) InsertUser

func (lc *Client) InsertUser(user *causer.Info) error

InsertUser inserts a user

func (*Client) ModifyAffiliation

func (lc *Client) ModifyAffiliation(oldAffiliation, newAffiliation string, force, isRegistrar bool) (*causer.DbTxResult, error)

ModifyAffiliation renames the affiliation and updates all identities to use the new affiliation

func (*Client) UpdateUser

func (lc *Client) UpdateUser(user *causer.Info, updatePass bool) error

UpdateUser updates a user

type Config

type Config struct {
	Enabled     bool   `def:"false" help:"Enable the LDAP client for authentication and attributes"`
	URL         string `help:"LDAP client URL of form ldap://adminDN:adminPassword@host[:port]/base" mask:"url"`
	UserFilter  string `def:"(uid=%s)" help:"The LDAP user filter to use when searching for users"`
	GroupFilter string `def:"(memberUid=%s)" help:"The LDAP group filter for a single affiliation group"`
	Attribute   AttrConfig
	TLS         ctls.ClientTLSConfig
}

Config is the configuration object for this LDAP client

func (Config) String

func (c Config) String() string

Implements Stringer interface for ldap.Config Calls util.StructToString to convert the Config struct to string.

type NameVal

type NameVal struct {
	Name  string
	Value string
}

NameVal is a name and value pair

Jump to

Keyboard shortcuts

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