ldap

package module
v0.9.12 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2020 License: MIT Imports: 13 Imported by: 0

README

LDAP / Active Directory

Golang LDAP/Active Directory API wrapper around https://github.com/go-ldap/ldap. WS Agent and Server for LDAP RPC

Why
  • This repo has high level wrapper around some main functions https://github.com/go-ldap/ldap
  • Because it allows you to serve LDAP RPC for this function from the box
Contribute
  • Create tests_conf.json with data
  • { "ldap": { "url": "ldap://corp.test.com", "dn": "dc=corp,dc=test,dc=com", "user": "corp\\test.user", "pass": "testPass" }, "tests" : { "client": { "auth": { "dn": "CN=Test User,OU=Users,OU=St-Petersburg,OU=Staff,DC=corp,DC=test,DC=com" }, "groupUsers": { "nodeDN": "CN=Clients,OU=Products,OU=Service Accounts,DC=corp,DC=test,DC=com" }, "ouUsers": { "nodeDN": "TestGroup", "wantNames": ["Test 1", "Test 2"] } }, "server": { "auth": { "data": "{\"Name\":\"Test User\",\"DN\":\"CN=Test User,OU=Users,OU=St-Petersburg,OU=Staff,DC=corp,DC=test,DC=com\",\"CN\":\"Test User\",\"Mail\":\"test.user@test.com\",\"Phone\":\"\",\"Logon\":\"test.user\"}", "params": "{\"login\":\"corp\\\\test.user\",\"pass\":\"testPass\"}" } } } }
  • Run tests in real ldap network

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GroupsSetter

func GroupsSetter(gs *[]Group) func(res interface{})

func UnitsSetter

func UnitsSetter(us *[]Unit) func(res interface{})

func UsersSetter

func UsersSetter(us *[]User) func(res interface{})

func WithAdmin

func WithAdmin(usr, pass string) func(*opt)

func WithBaseDN

func WithBaseDN(dn string) func(*opt)

func WithDebug

func WithDebug() func(*opt)

func WithTimeout

func WithTimeout(t time.Duration) func(*opt)

func WithURL

func WithURL(url string) func(*opt)

Types

type Client

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

func New

func New(ctx context.Context, fs ...optF) (*Client, error)

func (*Client) Auth

func (c *Client) Auth(usr, pass string) (user User, err error)

func (*Client) Close

func (c *Client) Close()

func (*Client) GroupUsers

func (c *Client) GroupUsers(nodeDN string, pageSize uint32) (ResultsScanner, error)

func (*Client) Groups

func (c *Client) Groups(pageSize uint32) (ResultsScanner, error)

func (*Client) OUUsers

func (c *Client) OUUsers(pageSize uint32, ouNames ...string) (ResultsScanner, error)

func (*Client) OrganizationalUnits

func (c *Client) OrganizationalUnits(pageSize uint32) (ResultsScanner, error)

func (*Client) Ping added in v0.9.2

func (c *Client) Ping() error

func (*Client) Search

func (c *Client) Search(query string) ([]map[string]interface{}, error)

func (*Client) SearchByLogon

func (c *Client) SearchByLogon(loginName string) (user User, err error)

type Group

type Group struct {
	Name   string
	Desc   string
	DN     string
	CN     string
	Member string
}

type ResultsScanner

type ResultsScanner interface {
	Next() bool
	LastErr() error
	Scan(setter func(res interface{}))
}

type Unit

type Unit struct {
	Name string
	DN   string
}

type User

type User struct {
	Name     string
	DN       string
	CN       string
	Mail     string
	Phone    string
	Logon    string
	MemberOf string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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