users

package
v0.1.15 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2018 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package users implements support for retrieving Users and their labels from external sources (LDAP, File).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type UserLoader

type UserLoader interface {
	// LoadUsersAll should load all users
	LoadUsersAll() *lang.GlobalUsers

	// LoadUserByName should load a single user by name. Name is not case sensitive.
	LoadUserByName(name string) *lang.User

	// Authenticate should authenticate a user by username/password. Name is not case sensitive.
	// If user exists and username/password is correct, it should be returned.
	// If a user doesn't exist or username/password is not correct, then nil should be returned together with an error.
	Authenticate(name, password string) (*lang.User, error)

	// Summary returns summary for the loader as string
	Summary() string
}

UserLoader is an interface which allows aptomi to load user data from different sources (e.g. file, LDAP, AD, etc)

func NewUserLoaderFromFile

func NewUserLoaderFromFile(fileName string, domainAdminOverrides map[string]bool) UserLoader

NewUserLoaderFromFile returns new UserLoaderFromFile

func NewUserLoaderFromLDAP

func NewUserLoaderFromLDAP(cfg config.LDAP, domainAdminOverrides map[string]bool) UserLoader

NewUserLoaderFromLDAP returns new UserLoaderFromLDAP, given location with LDAP configuration file (with host/port and mapping)

type UserLoaderFromFile

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

UserLoaderFromFile allows aptomi to load users from a file

func (*UserLoaderFromFile) Authenticate

func (loader *UserLoaderFromFile) Authenticate(name, password string) (*lang.User, error)

Authenticate should authenticate a user by username/password. If user exists and username/password is correct, it should be returned. If a user doesn't exist or username/password is not correct, then nil should be returned together with an error.

func (*UserLoaderFromFile) LoadUserByName

func (loader *UserLoaderFromFile) LoadUserByName(name string) *lang.User

LoadUserByName loads a single user by name

func (*UserLoaderFromFile) LoadUsersAll

func (loader *UserLoaderFromFile) LoadUsersAll() *lang.GlobalUsers

LoadUsersAll loads all users

func (*UserLoaderFromFile) Summary

func (loader *UserLoaderFromFile) Summary() string

Summary returns summary as string

type UserLoaderFromLDAP

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

UserLoaderFromLDAP allows aptomi to load users from LDAP

func (*UserLoaderFromLDAP) Authenticate

func (loader *UserLoaderFromLDAP) Authenticate(name, password string) (*lang.User, error)

Authenticate should authenticate a user by username/password. If user exists and username/password is correct, it should be returned. If a user doesn't exist or username/password is not correct, then nil should be returned together with an error.

func (*UserLoaderFromLDAP) LoadUserByName

func (loader *UserLoaderFromLDAP) LoadUserByName(name string) *lang.User

LoadUserByName loads a single user by name

func (*UserLoaderFromLDAP) LoadUsersAll

func (loader *UserLoaderFromLDAP) LoadUsersAll() *lang.GlobalUsers

LoadUsersAll loads all users

func (*UserLoaderFromLDAP) Summary

func (loader *UserLoaderFromLDAP) Summary() string

Summary returns summary as string

type UserLoaderMock

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

UserLoaderMock allows to mock user loader and use in-memory user storage. It also allows to emulate panics

func NewUserLoaderMock

func NewUserLoaderMock() *UserLoaderMock

NewUserLoaderMock returns new UserLoaderMock

func (*UserLoaderMock) AddUser

func (loader *UserLoaderMock) AddUser(user *lang.User)

AddUser adds a user into the mock structure

func (*UserLoaderMock) Authenticate

func (loader *UserLoaderMock) Authenticate(name, password string) (*lang.User, error)

Authenticate does nothing for mock

func (*UserLoaderMock) LoadUserByName

func (loader *UserLoaderMock) LoadUserByName(name string) *lang.User

LoadUserByName loads a single user by Name

func (*UserLoaderMock) LoadUsersAll

func (loader *UserLoaderMock) LoadUsersAll() *lang.GlobalUsers

LoadUsersAll loads all users

func (*UserLoaderMock) SetPanic added in v0.1.2

func (loader *UserLoaderMock) SetPanic(panicFlag bool)

SetPanic controls whether user loader should panic or return users

func (*UserLoaderMock) Summary

func (loader *UserLoaderMock) Summary() string

Summary returns summary as string

type UserLoaderMultipleSources

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

UserLoaderMultipleSources allows to combine different user sources into a single loader

func NewUserLoaderMultipleSources

func NewUserLoaderMultipleSources(loaders []UserLoader) *UserLoaderMultipleSources

NewUserLoaderMultipleSources returns new UserLoaderMultipleSources

func (*UserLoaderMultipleSources) Authenticate

func (loader *UserLoaderMultipleSources) Authenticate(name, password string) (*lang.User, error)

Authenticate authenticate a user by username/password by trying all available user data sources.

func (*UserLoaderMultipleSources) LoadUserByName

func (loader *UserLoaderMultipleSources) LoadUserByName(name string) *lang.User

LoadUserByName loads a single user by name

func (*UserLoaderMultipleSources) LoadUsersAll

func (loader *UserLoaderMultipleSources) LoadUsersAll() *lang.GlobalUsers

LoadUsersAll loads all users

func (*UserLoaderMultipleSources) Summary

func (loader *UserLoaderMultipleSources) Summary() string

Summary returns summary as string

Jump to

Keyboard shortcuts

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