ldap

package
v0.0.0-...-9c6c125 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2017 License: Apache-2.0 Imports: 10 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
}

Client is an LDAP client

func NewClient

func NewClient(cfg *Config) (*Client, error)

NewClient creates an LDAP client

func (*Client) DeleteGroup

func (lc *Client) DeleteGroup(name string) error

DeleteGroup deletes an affiliation group

func (*Client) DeleteUser

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

DeleteUser deletes a user

func (*Client) GetGroup

func (lc *Client) GetGroup(name string) (spi.Group, error)

GetGroup returns an affiliation group

func (*Client) GetRootGroup

func (lc *Client) GetRootGroup() (spi.Group, error)

GetRootGroup 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) InsertGroup

func (lc *Client) InsertGroup(name string, parentID string) error

InsertGroup 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 {
	// URL is of the form: ldap://adminDN:adminPassword@host:port/base
	URL         string `json:"url"`
	Base        string `json:"base,omitempty"`
	UserFilter  string `json:"userfilter,omitempty"`
	GroupFilter string `json:"groupfilter,omitempty"`
}

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