Documentation
¶
Index ¶
Constants ¶
View Source
const ( TypeInvalid = Type(iota) TypeSecurityOfficer = Type(iota) TypeUser = Type(iota) )
View Source
const DefaultSecurityOfficer = "default_security_officer"
View Source
const DefaultUser = "default"
Variables ¶
Functions ¶
This section is empty.
Types ¶
type Repository ¶
type Repository interface { GetUser(ctx context.Context, username string) (*User, error) RecordLoginAttempt(ctx context.Context, userId int64, succeeded bool) error }
func NewRepository ¶
func NewRepository(logger *logrus.Logger, db *sqlx.DB) Repository
type Service ¶
type Service interface {
Authenticate(ctx context.Context, userType Type, username string, password string) error
}
func NewService ¶
func NewService(repository Repository) Service
type User ¶
type User struct { ID int64 `json:"id" db:"id"` Type Type `json:"type" db:"type"` Username string `json:"username" db:"username"` HashedPassword string `json:"-" db:"hashed_password"` LastSucceededLoginAt *time.Time `json:"last_succeeded_login_at" db:"last_succeeded_login_at"` LastFailedLoginAt *time.Time `json:"last_failed_login_at" db:"last_failed_login_at"` PasswordExpiredAt time.Time `json:"password_expired_at" db:"password_expired_at"` CreatedAt time.Time `json:"created_at" db:"created_at"` UpdatedAt time.Time `json:"updated_at" db:"updated_at"` }
Click to show internal directories.
Click to hide internal directories.