Documentation
¶
Index ¶
- Constants
- Variables
- type Interface
- type Options
- type Pool
- type PoolConn
- func (p *PoolConn) Add(addRequest *ldap.AddRequest) error
- func (p *PoolConn) Bind(username, password string) error
- func (p *PoolConn) Close()
- func (p *PoolConn) Compare(dn, attribute, value string) (bool, error)
- func (p *PoolConn) Del(delRequest *ldap.DelRequest) error
- func (p *PoolConn) MarkUnusable()
- func (p *PoolConn) Modify(modifyRequest *ldap.ModifyRequest) error
- func (p *PoolConn) ModifyDN(modifyDNRequest *ldap.ModifyDNRequest) error
- func (p *PoolConn) PasswordModify(passwordModifyRequest *ldap.PasswordModifyRequest) (*ldap.PasswordModifyResult, error)
- func (p *PoolConn) Search(searchRequest *ldap.SearchRequest) (*ldap.SearchResult, error)
- func (p *PoolConn) SearchWithPaging(searchRequest *ldap.SearchRequest, pagingSize uint32) (*ldap.SearchResult, error)
- func (p *PoolConn) SetTimeout(t time.Duration)
- func (p *PoolConn) SimpleBind(simpleBindRequest *ldap.SimpleBindRequest) (*ldap.SimpleBindResult, error)
- func (p *PoolConn) Start()
- func (p *PoolConn) StartTLS(config *tls.Config) error
- type PoolFactory
Constants ¶
View Source
const FAKE_HOST string = "FAKE"
Variables ¶
View Source
var ( // ErrClosed is the error resulting if the pool is closed via pool.Close(). ErrClosed = errors.New("pool is closed") )
View Source
var ErrInvalidCredentials = errors.New("invalid credentials")
View Source
var ErrUserAlreadyExisted = errors.New("user already existed")
View Source
var ErrUserNotExists = errors.New("user not exists")
Functions ¶
This section is empty.
Types ¶
type Interface ¶
type Interface interface {
// Create create a new user in ldap
Create(user *iamv1alpha2.User) error
// Update updates a user information, return error if user not exists
Update(user *iamv1alpha2.User) error
// Delete deletes a user from ldap, return nil if user not exists
Delete(name string) error
// Get gets a user by its username from ldap, return ErrUserNotExists if user not exists
Get(name string) (*iamv1alpha2.User, error)
// Authenticate checks if (name, password) is valid, return ErrInvalidCredentials if not
Authenticate(name string, password string) error
List(query *query.Query) (*api.ListResult, error)
}
Interface defines CRUD behaviors of manipulating users
func NewLdapClient ¶
func NewSimpleLdap ¶
func NewSimpleLdap() Interface
type Options ¶
type Options struct {
Host string `json:"host,omitempty" yaml:"host"`
ManagerDN string `json:"managerDN,omitempty" yaml:"managerDN"`
ManagerPassword string `json:"managerPassword,omitempty" yaml:"managerPassword"`
UserSearchBase string `json:"userSearchBase,omitempty" yaml:"userSearchBase"`
GroupSearchBase string `json:"groupSearchBase,omitempty" yaml:"groupSearchBase"`
InitialCap int `json:"initialCap,omitempty" yaml:"initialCap"`
MaxCap int `json:"maxCap,omitempty" yaml:"maxCap"`
PoolName string `json:"poolName,omitempty" yaml:"poolName"`
}
func NewOptions ¶
func NewOptions() *Options
NewOptions return a default option which host field point to nowhere.
type Pool ¶
type Pool interface {
// Get returns a new connection from the pool. Closing the connections puts
// it back to the Pool. Closing it when the pool is destroyed or full will
// be counted as an error.
Get() (*PoolConn, error)
// Close closes the pool and all its connections. After Close() the pool is
// no longer usable.
Close()
// Len returns the current number of connections of the pool.
Len() int
}
Pool interface describes a pool implementation. A pool should have maximum capacity. An ideal pool is threadsafe and easy to use.
type PoolConn ¶
PoolConn implements Client to override the Close() method
func (*PoolConn) Close ¶
func (p *PoolConn) Close()
Close() puts the given connects back to the pool instead of closing it.
func (*PoolConn) MarkUnusable ¶
func (p *PoolConn) MarkUnusable()
MarkUnusable() marks the connection not usable any more, to let the pool close it instead of returning it to pool.
func (*PoolConn) ModifyDN ¶
func (p *PoolConn) ModifyDN(modifyDNRequest *ldap.ModifyDNRequest) error
func (*PoolConn) PasswordModify ¶
func (p *PoolConn) PasswordModify(passwordModifyRequest *ldap.PasswordModifyRequest) (*ldap.PasswordModifyResult, error)
func (*PoolConn) Search ¶
func (p *PoolConn) Search(searchRequest *ldap.SearchRequest) (*ldap.SearchResult, error)
func (*PoolConn) SearchWithPaging ¶
func (p *PoolConn) SearchWithPaging(searchRequest *ldap.SearchRequest, pagingSize uint32) (*ldap.SearchResult, error)
func (*PoolConn) SetTimeout ¶
func (*PoolConn) SimpleBind ¶
func (p *PoolConn) SimpleBind(simpleBindRequest *ldap.SimpleBindRequest) (*ldap.SimpleBindResult, error)
Click to show internal directories.
Click to hide internal directories.