Documentation ¶
Index ¶
- Constants
- Variables
- func New(modName, instName string, _, inlineArgs []string) (module.Module, error)
- type Auth
- func (a *Auth) AuthPlain(username, password string) error
- func (a *Auth) CreateUser(username, password string) error
- func (a *Auth) DeleteUser(username string) error
- func (a *Auth) Init(cfg *config.Map) error
- func (a *Auth) InstanceName() string
- func (a *Auth) ListUsers() ([]string, error)
- func (a *Auth) Lookup(ctx context.Context, username string) (string, bool, error)
- func (a *Auth) Name() string
- func (a *Auth) SetUserPassword(username, password string) error
- type FuncHashCompute
- type FuncHashVerify
- type HashOpts
Constants ¶
View Source
const ( HashSHA256 = "sha256" HashBcrypt = "bcrypt" HashArgon2 = "argon2" DefaultHash = HashBcrypt Argon2Salt = 16 Argon2Size = 64 )
Variables ¶
View Source
var ( HashCompute = map[string]FuncHashCompute{ HashBcrypt: computeBcrypt, HashArgon2: computeArgon2, } HashVerify = map[string]FuncHashVerify{ HashBcrypt: verifyBcrypt, HashArgon2: verifyArgon2, } Hashes = []string{HashSHA256, HashBcrypt, HashArgon2} )
Functions ¶
Types ¶
type Auth ¶
type Auth struct {
// contains filtered or unexported fields
}
func (*Auth) CreateUser ¶ added in v0.3.0
func (*Auth) DeleteUser ¶ added in v0.3.0
func (*Auth) InstanceName ¶
func (*Auth) SetUserPassword ¶ added in v0.3.0
type FuncHashVerify ¶
type HashOpts ¶
type HashOpts struct { // Bcrypt cost value to use. Should be at least 10. BcryptCost int Argon2Time uint32 Argon2Memory uint32 Argon2Threads uint8 }
HashOpts is the structure that holds additional parameters for used hash functions. They are used for new passwords.
These parameters should be stored together with the hashed password so it can be verified independently of the used HashOpts.
Click to show internal directories.
Click to hide internal directories.