services

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2019 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IdentityExists

func IdentityExists(i Identity) bool

Types

type ConfigError

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

func (ConfigError) Error

func (e ConfigError) Error() string

type DiffResult added in v0.0.4

type DiffResult struct {
	Rem []User
	Add []User
}

func Diff

func Diff(srcGrp, tarGrp []User, tar string) (DiffResult, error)

type FatalError

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

A wrapper used to let upper layers know the error isn't recoverable.

func (FatalError) Error

func (e FatalError) Error() string

type GitHub

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

func NewGitHub

func NewGitHub(cfg GitHubConfig) *GitHub

func (GitHub) AddMembers

func (g GitHub) AddMembers(teamSlug string, users []User) error

func (GitHub) GroupMembers

func (g GitHub) GroupMembers(group string) ([]User, error)

func (GitHub) RemoveMembers

func (g GitHub) RemoveMembers(teamSlug string, users []User) error

type GitHubConfig

type GitHubConfig struct {
	Token string
	Org   string
}

type GitHubIdentity

type GitHubIdentity struct {
	ID    string
	Login string
}

func (GitHubIdentity) String

func (i GitHubIdentity) String() string

type GitHubSAMLMapping

type GitHubSAMLMapping struct {
	User struct {
		ID    string
		Name  string
		Email string
		Login string
	}
	SamlIdentity struct {
		NameID string `graphql:"nameId"`
	} `graphql:"samlIdentity"`
}

GitHubSAMLMapping represents a mapping of a GitHub identity to a SAML identity.

type GroupIdent added in v0.0.4

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

func ParseGroupIdent added in v0.0.4

func ParseGroupIdent(str string) (GroupIdent, error)

func (*GroupIdent) GetMembers added in v0.0.4

func (i *GroupIdent) GetMembers() error

func (GroupIdent) Members added in v0.0.4

func (i GroupIdent) Members() ([]User, error)

type Identity

type Identity interface {
	String() string
	// contains filtered or unexported methods
}

type LDAP

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

LDAP contains the LDAP config and (once established) the active connection to an LDAP server.

func NewLDAP

func NewLDAP(cfg LDAPConfig) *LDAP

NewLDAP creates a new instance of LDAP with the provided configuration.

func (LDAP) GroupMembers

func (l LDAP) GroupMembers(group string) ([]User, error)

GroupMembers returns the members of group `group` as a slice of User instances. Implements the Service interface.

type LDAPConfig

type LDAPConfig struct {
	// Connection
	Port       int32
	Server     string
	SSL        bool
	SkipVerify bool `mapstructure:"skip_verify"`

	// Auth
	BindUser     string `mapstructure:"bind_user"`
	BindPassword string `mapstructure:"bind_password"`

	// Schema
	UserBaseDN      string `mapstructure:"user_base_dn"`
	GroupBaseDN     string `mapstructure:"group_base_dn"`
	UserClass       string `mapstructure:"user_class"`
	SearchAttribute string `mapstructure:"search_attribute"`
	UserIDAttribute string `mapstructure:"user_id_attribute"`
}

LDAPConfig contains all the ino needed to connect to (and authenticate with) an LDAP instance, as well as how to fetch group membership data from the particular scheme used.

type LDAPIdentity

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

func (LDAPIdentity) String

func (i LDAPIdentity) String() string

type Mapping added in v0.0.4

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

A Mapping is a single Mapping of source group(s) onto a target group.

func NewMapping added in v0.0.4

func NewMapping(src []GroupIdent, tar GroupIdent) Mapping

func (*Mapping) CommitChanges added in v0.0.4

func (m *Mapping) CommitChanges() error

func (*Mapping) Diff added in v0.0.4

func (m *Mapping) Diff() (DiffResult, error)

func (Mapping) String added in v0.0.4

func (m Mapping) String() string

type MockIdentity

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

func (MockIdentity) String

func (i MockIdentity) String() string

type MockService

type MockService struct {
}

func (MockService) AddMembers

func (t MockService) AddMembers(users []User) error

func (MockService) GroupMembers

func (t MockService) GroupMembers(group string) ([]User, error)

func (MockService) RemoveMembers

func (t MockService) RemoveMembers(users []User) error

type NoneIdentity

type NoneIdentity struct{}

func (NoneIdentity) String

func (_ NoneIdentity) String() string

type Service

type Service interface {
	// Get the members of group `group` as a slice of User instances.
	GroupMembers(group string) ([]User, error)
}

Service represents a service that holds information about groups and group memberships.

func SvcFromString

func SvcFromString(name string) (Service, error)

SvcFromString produces a Service object with config taken from the global cfg variable.

type ServiceNotDefined

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

func (ServiceNotDefined) Error

func (e ServiceNotDefined) Error() string

type SourceGroupEmptyError

type SourceGroupEmptyError struct {
}

func (SourceGroupEmptyError) Error

func (e SourceGroupEmptyError) Error() string

type Target

type Target interface {
	AddMembers(team string, users []User) error
	RemoveMembers(team string, users []User) error

	// Target implementors should also implement Service.
	GroupMembers(group string) ([]User, error)
	// contains filtered or unexported methods
}

Target represents a service whose group memberships can be mutated.

func TargetFromString

func TargetFromString(name string) (Target, error)

type TargetNotDefined

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

func (TargetNotDefined) Error

func (e TargetNotDefined) Error() string

type User

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

User is used to identify users by their unique data acquired from services.

func (User) String

func (u User) String() string

type YAMLGroupIdent added in v0.0.4

type YAMLGroupIdent struct {
	Service string
	Group   string
}

YAML

type YAMLMapping added in v0.0.4

type YAMLMapping struct {
	Sources []YAMLGroupIdent
	Users   []string
	Target  YAMLGroupIdent
}

YAMLMapping is a mapping parsed from a YAML mappings file.

func (YAMLMapping) IntoMapping added in v0.0.4

func (y YAMLMapping) IntoMapping() Mapping

Jump to

Keyboard shortcuts

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