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) CreateUserHash(username, password string, hashAlgo string, opts HashOpts) error
- func (a *Auth) CreateUserIfNotExists(username, password string) error
- func (a *Auth) DeleteSetting(key string) error
- func (a *Auth) DeleteUser(username string) error
- func (a *Auth) GetSetting(key string) (string, bool, error)
- func (a *Auth) Init(cfg *config.Map) error
- func (a *Auth) InstanceName() string
- func (a *Auth) IsJitRegistrationEnabled() (bool, error)
- func (a *Auth) IsLoggingDisabled() (bool, error)
- func (a *Auth) IsRegistrationOpen() (bool, error)
- func (a *Auth) IsTurnEnabled() (bool, error)
- 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) SetJitRegistrationEnabled(enabled bool) error
- func (a *Auth) SetLoggingDisabled(disabled bool) error
- func (a *Auth) SetRegistrationOpen(open bool) error
- func (a *Auth) SetSetting(key, value string) error
- func (a *Auth) SetTurnEnabled(enabled bool) error
- func (a *Auth) SetUserPassword(username, password string) error
- type FuncHashCompute
- type FuncHashVerify
- type HashOpts
Constants ¶
const ( HashSHA256 = "sha256" HashBcrypt = "bcrypt" HashArgon2 = "argon2" DefaultHash = HashBcrypt Argon2Salt = 16 Argon2Size = 64 )
Variables ¶
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 ¶
func (*Auth) CreateUserHash ¶
func (*Auth) CreateUserIfNotExists ¶ added in v0.12.2
CreateUserIfNotExists creates a user if they don't already exist. This is optimized for concurrent auto-create scenarios during login. Unlike CreateUser, it doesn't fail if the user already exists - it just returns nil (since the goal is to ensure the user exists). It also skips the initial Lookup to avoid the race condition where multiple concurrent requests all see "user not found" and then all try to create.
func (*Auth) DeleteSetting ¶ added in v0.15.0
DeleteSetting removes a key from the settings table.
func (*Auth) DeleteUser ¶
func (*Auth) GetSetting ¶ added in v0.15.0
GetSetting retrieves a raw string value from the settings table. Returns (value, true, nil) if found, ("", false, nil) if not set.
func (*Auth) InstanceName ¶
func (*Auth) IsJitRegistrationEnabled ¶ added in v0.10.0
func (*Auth) IsLoggingDisabled ¶
func (*Auth) IsRegistrationOpen ¶
func (*Auth) IsTurnEnabled ¶
func (*Auth) SetJitRegistrationEnabled ¶ added in v0.10.0
func (*Auth) SetLoggingDisabled ¶
func (*Auth) SetRegistrationOpen ¶
func (*Auth) SetSetting ¶ added in v0.15.0
SetSetting stores a raw string value in the settings table.
func (*Auth) SetTurnEnabled ¶
func (*Auth) SetUserPassword ¶
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.