Documentation ¶
Index ¶
- func MakeDBCred(str string) string
- type DB
- type RKSyncCADB
- type RKSyncCATx
- type User
- func (u *User) GetAttribute(name string) (*api.Attribute, error)
- func (u *User) GetAttributes(attrNames []string) ([]api.Attribute, error)
- func (u *User) GetFailedLoginAttempts() int
- func (u *User) GetMaxEnrollments() int
- func (u *User) GetName() string
- func (u *User) IncrementIncorrectPasswordAttempts() error
- func (u *User) Login(pass string, caMaxEnrollment int) error
- func (u *User) LoginComplete() error
- type UserRecord
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MakeDBCred ¶
MakeDBCred hides DB credential in connection string
Types ¶
type DB ¶
DB is an adopter for sqlx.DB and implements
func NewUserRegistryMySQL ¶
NewUserRegistryMySQL opens a connection to a MySQL database
func NewUserRegistryPostgres ¶
NewUserRegistryPostgres opens a connection to a postgres database
func (*DB) BeginTx ¶
func (db *DB) BeginTx() RKSyncCATx
BeginTx implements BeginTx method of RKSyncCADB interface
func (*DB) IsInitialized ¶
IsInitialized returns true if db is initialized, else false
type RKSyncCADB ¶
type RKSyncCADB interface { IsInitialized() bool Select(dest interface{}, query string, args ...interface{}) error Exec(query string, args ...interface{}) (sql.Result, error) NamedExec(query string, arg interface{}) (sql.Result, error) Rebind(query string) string MustBegin() *sqlx.Tx BeginTx() RKSyncCATx }
RKSyncCADB is the interface with functions implemented by sqlx.DB object that are used by rksync CA server
type RKSyncCATx ¶
type RKSyncCATx interface { Queryx(query string, args ...interface{}) (*sqlx.Rows, error) Select(dest interface{}, query string, args ...interface{}) error Rebind(query string) string Exec(query string, args ...interface{}) (sql.Result, error) Commit() error Rollback() error }
RKSyncCATx is the interface with functions implemented by sqlx.Tx object that are used by rksync CA server
type User ¶
User is the database representation of a user
func NewDBUser ¶
func NewDBUser(userRec *UserRecord, db *DB) *User
NewDBUser creates a User object from the DB user record
func (*User) GetAttribute ¶
GetAttribute returns the value for an attribute name
func (*User) GetAttributes ¶
GetAttributes returns the requested attributes.
func (*User) GetFailedLoginAttempts ¶
GetFailedLoginAttempts returns the number of times the user has entered an incorrect password
func (*User) GetMaxEnrollments ¶
GetMaxEnrollments returns the max enrollments of the user
func (*User) IncrementIncorrectPasswordAttempts ¶
IncrementIncorrectPasswordAttempts updates the incorrect password count of user
func (*User) LoginComplete ¶
LoginComplete completes the login process by incrementing the state of the user