Documentation ¶
Overview ¶
** An implementation of the Databaser interface as an in-memory map for testing
Index ¶
- type Databaser
- type Db
- func (db *Db) Add(req model.YubiUser) error
- func (db *Db) Get(ykid string) (*model.YubiUser, error)
- func (db *Db) GetAll() ([]*model.YubiUser, error)
- func (db *Db) SetSecretColumnKeyFunc(kf model.SecretColumnKeyT)
- func (db *Db) UpdateCounts(user model.YubiUser) error
- func (db *Db) UpdateUser(user model.YubiUser) error
- type MapDb
- func (db *MapDb) Add(user model.YubiUser) error
- func (db *MapDb) Get(ykid string) (*model.YubiUser, error)
- func (db *MapDb) GetAll() ([]*model.YubiUser, error)
- func (db *MapDb) SetSecretColumnKeyFunc(kf model.SecretColumnKeyT)
- func (db *MapDb) UpdateCounts(rec model.YubiUser) error
- func (db *MapDb) UpdateUser(rec model.YubiUser) error
- type RegistrationError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Databaser ¶
type Databaser interface { Add(user model.YubiUser) error Get(ykid string) (*model.YubiUser, error) GetAll() ([]*model.YubiUser, error) UpdateCounts(user model.YubiUser) error UpdateUser(user model.YubiUser) error SetSecretColumnKeyFunc(model.SecretColumnKeyT) }
Databaser interface to the underlying database that manages known Yubi keys
type Db ¶
type Db struct {
// contains filtered or unexported fields
}
Db implements Databaser interface
func NewDb ¶
NewDb creates a new interface to the database identified by `dsn`. Supports the following types to select the proper dialect:
- sqlite -> "file:/home/user/data.db"
- mysql -> "mysql://user@pass/dbname?charset=utf8&parseTime=True&loc=Local"
func (*Db) SetSecretColumnKeyFunc ¶
func (db *Db) SetSecretColumnKeyFunc(kf model.SecretColumnKeyT)
SetSecretColumnKeyFunc specifies the func to call to acquire the application's secret key for DB column encryption
func (*Db) UpdateCounts ¶
UpdateCounts update counters for the YubiKey
type MapDb ¶
type MapDb struct {
// contains filtered or unexported fields
}
MapDb implements Databaser interface. This should be a real database that stores known user yubikey IDs and their secrets.
func (*MapDb) SetSecretColumnKeyFunc ¶
func (db *MapDb) SetSecretColumnKeyFunc(kf model.SecretColumnKeyT)
SetSecretColumnKeyFunc specifies the func to call to acquire the application's secret key for DB column encryption
func (*MapDb) UpdateCounts ¶
Intent is we are updating the usage count for the yubikey
type RegistrationError ¶
type RegistrationError struct {
// contains filtered or unexported fields
}
func (*RegistrationError) Error ¶
func (e *RegistrationError) Error() string