Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrDuplicatedUserName = errors.New("duplicated username") ErrUserNotFound = errors.New("user not found") )
View Source
var (
ErrAuthenticationFailed = errors.New("authentication failed")
)
View Source
var (
ErrInvalidRequest = errors.New("invalid request")
)
Functions ¶
func MakeHandler ¶
func MakeHandler(svc AuthService) http.Handler
func NscAddOperator ¶
func NscAddUser ¶
Types ¶
type AuthService ¶
type AuthService interface { AddUser(ctx context.Context, userName, password string) (User, error) GetUser(ctx context.Context, userName string) (User, error) AddForbiddenDevice(ctx context.Context, userId string, deviceId int) error Login(ctx context.Context, userName, password string) (User, error) }
func NewAuthService ¶
func NewAuthService(r Repository) AuthService
type InMemoryRepository ¶
type Repository ¶
type Repository interface { AddUser(userName, password string) (User, error) GetUser(userName string) (User, error) DeleteUser(userName string) error AddForbiddenDevice(userId string, deviceId int) error FindUser(userName, password string) (User, error) }
func NewRepository ¶
func NewRepository() Repository
Click to show internal directories.
Click to hide internal directories.