util

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2018 License: Apache-2.0 Imports: 6 Imported by: 224

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Close

func Close(c Closer)

Close is a convenience function to close a object that has a Close() method, ignoring any errors Used to satisfy errcheck lint

func HashPassword

func HashPassword(password string) (string, error)

HashPassword hashes against the current preferred hasher.

func VerifyPassword

func VerifyPassword(password, hashedPassword string) (valid, stale bool)

VerifyPassword verifies an entered password against a hashed password and returns whether the hash is "stale" (i.e., was verified using the FIRST preferred hasher above).

Types

type ArgoCDSettings

type ArgoCDSettings struct {
	// LocalUsers holds users local to (stored on) the server.  This is to be distinguished from any potential alternative future login providers (LDAP, SAML, etc.) that might ever be added.
	LocalUsers map[string]string
}

ArgoCDSettings holds in-memory runtime configuration options.

type BcryptPasswordHasher

type BcryptPasswordHasher struct {
	Cost int
}

BcryptPasswordHasher handles password hashing with Bcrypt. Create with `0` as the work factor to default to bcrypt.DefaultCost at hashing time. The Cost field represents work factor.

func (BcryptPasswordHasher) HashPassword

func (h BcryptPasswordHasher) HashPassword(password string) (string, error)

HashPassword creates a one-way digest ("hash") of a password. In the case of Bcrypt, a pseudorandom salt is included automatically by the underlying library. For security reasons, the work factor is always at _least_ bcrypt.DefaultCost.

func (BcryptPasswordHasher) VerifyPassword

func (h BcryptPasswordHasher) VerifyPassword(password, hashedPassword string) bool

VerifyPassword validates whether a one-way digest ("hash") of a password was created from a given plaintext password.

type Closer

type Closer interface {
	Close() error
}

type ConfigManager

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

ConfigManager holds config info for a new manager with which to access Kubernetes ConfigMaps.

func NewConfigManager

func NewConfigManager(clientset kubernetes.Interface, namespace, configMapName string) (mgr *ConfigManager)

NewConfigManager generates a new ConfigManager pointer and returns it

func (*ConfigManager) GetSettings

func (mgr *ConfigManager) GetSettings() (ArgoCDSettings, error)

GetSettings retrieves settings from the ConfigManager.

func (*ConfigManager) SetRootUserCredentials

func (mgr *ConfigManager) SetRootUserCredentials(username string, password string) error

type DummyPasswordHasher

type DummyPasswordHasher struct{}

DummyPasswordHasher is for testing ONLY. DO NOT USE in a production context.

func (DummyPasswordHasher) HashPassword

func (h DummyPasswordHasher) HashPassword(password string) (string, error)

HashPassword creates a one-way digest ("hash") of a password. In the case of Bcrypt, a pseudorandom salt is included automatically by the underlying library.

func (DummyPasswordHasher) VerifyPassword

func (h DummyPasswordHasher) VerifyPassword(password, hashedPassword string) bool

VerifyPassword validates whether a one-way digest ("hash") of a password was created from a given plaintext password.

type KeyLock

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

Allows to lock by string key

func NewKeyLock

func NewKeyLock() *KeyLock

NewKeyLock creates new instance of KeyLock

func (*KeyLock) Lock

func (keyLock *KeyLock) Lock(key string)

Lock blocks goroutine using key specific mutex

func (*KeyLock) Unlock

func (keyLock *KeyLock) Unlock(key string)

Unlock releases key specific mutex

type PasswordHasher

type PasswordHasher interface {
	HashPassword(string) (string, error)
	VerifyPassword(string, string) bool
}

PasswordHasher is an interface type to declare a general-purpose password management tool.

Directories

Path Synopsis
git
mocks
Code generated by mockery v1.0.0
Code generated by mockery v1.0.0

Jump to

Keyboard shortcuts

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