ldap

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2017 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

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
}

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) error

DeleteAffiliation deletes an affiliation group

func (*Client) DeleteUser

func (lc *Client) DeleteUser(id string) error

DeleteUser deletes a user

func (*Client) GetAffiliation

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

GetAffiliation returns an affiliation group

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) (spi.User, error)

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

func (*Client) GetUserInfo

func (lc *Client) GetUserInfo(id string) (spi.UserInfo, error)

GetUserInfo gets user information from database

func (*Client) InsertAffiliation

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

InsertAffiliation adds an affiliation group

func (*Client) InsertUser

func (lc *Client) InsertUser(user spi.UserInfo) error

InsertUser inserts a user

func (*Client) UpdateUser

func (lc *Client) UpdateUser(user spi.UserInfo) 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"`
	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"`
	TLS         ctls.ClientTLSConfig
}

Config is the configuration object for this LDAP client

type User

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

User represents a single user

func (*User) GetAffiliationPath

func (u *User) GetAffiliationPath() []string

GetAffiliationPath returns the affiliation path for this user

func (*User) GetAttribute

func (u *User) GetAttribute(name string) string

GetAttribute returns the value of an attribute, or "" if not found

func (*User) GetName

func (u *User) GetName() string

GetName returns the user's enrollment ID, which is the DN (Distinquished Name)

func (*User) Login

func (u *User) Login(password string, caMaxEnrollment int) error

Login logs a user in using password

Jump to

Keyboard shortcuts

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