yodel

package
v0.0.0-...-27f1df0 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CNToGroupName

func CNToGroupName(cn string) string

CNToGroupName will transform a full CN string ("cn=adminUser,ou=groups,dc=org,dc=example") to a group name ("adminUser").

func OutputYaml

func OutputYaml(groups mapset.Set, annotate func(string) string) (string, error)

OutputYaml outputs a set of groups as yaml :)

Types

type Directory

type Directory interface {
	Search(lookup string) (GroupSet, error)
	Sync() error
}

Directory is an interface which represents a queryable directory service, such as LDAP.

type GroupSet

type GroupSet mapset.Set

GroupSet represents a set of groups, on which we can perform set operations (difference, intersection, etc).

type LdapConfig

type LdapConfig struct {
	HostURL        string
	BindDN         string
	BindPassword   string
	GroupAttribute string
	BaseDN         string // Base DN on which to search
	Filter         string // Filter which uniquely identifies the user
}

LdapConfig represents all the configuration required to connect to an LDAP server and run queries.

func GenerateLdapConfig

func GenerateLdapConfig() LdapConfig

GenerateLdapConfig generates an LDAP config object from external config files or environment variables.

type LdapDirectory

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

LdapDirectory represents a queryable LDAP directory service,

func NewLdapDirectory

func NewLdapDirectory(config LdapConfig) *LdapDirectory

NewLdapDirectory acts as a constructor for LdapDirectory

func (LdapDirectory) Search

func (l LdapDirectory) Search(lookup string) (GroupSet, error)

Search performs a search against the configured LDAP server by substituting the `lookup` argument into the configured filter.

func (LdapDirectory) Sync

func (l LdapDirectory) Sync() error

Sync gets this directory service ready to issue searches. In the case of LDAP, this method does nothing.

type YamlDirectory

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

YamlDirectory exposes the group database file as a query directory service.

func NewYamlDirectory

func NewYamlDirectory(filepath string) *YamlDirectory

NewYamlDirectory acts as a constructor for YamlDirectory

func (YamlDirectory) AnnotationFunction

func (y YamlDirectory) AnnotationFunction(string) string

AnnotationFunction can be used to associate groups with descriptions present in the group database file. Useful to make a list of groups more human readable in program output.

func (*YamlDirectory) Search

func (y *YamlDirectory) Search(lookup string) (GroupSet, error)

Search performs a search on the in-memory group database by finding roles which match the given `lookup` string.

func (*YamlDirectory) Sync

func (y *YamlDirectory) Sync() error

Sync gets this directory service ready to issue searches. In the case of YAML, this method reads the database file into memory.

type YamlGroup

type YamlGroup struct {
	Name string
	Desc string
}

YamlGroup is used when deserializing group database files.

type YamlGroupFile

type YamlGroupFile struct {
	SchemaVersion string `yaml:"schema_version"`
	Roles         []YamlRole
	Groups        []YamlGroup
}

YamlGroupFile is the in-memory representation of a group database file.

type YamlRole

type YamlRole struct {
	Name   string
	Groups []string
	Roles  []string
}

YamlRole is used when deserializing group database files.

Jump to

Keyboard shortcuts

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