Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type UserService ¶
UserService stores all the users in memory and implements auth.UserService interface.
func New ¶
func New() *UserService
New returns a new UserService. It initialises the underlying storage which in this case is map.
func (*UserService) Authenticate ¶
Authenticates a user by validating that it exists and hash of the provided password matches. On success returns a JWT token. While this method returns different errors for different failures the end user should only see a generic "invalid credentials" message.
func (*UserService) Create ¶
func (s *UserService) Create(u api.UserRegister) error
Create creates a new user. Returns an error if user with the same username or the same email already exist or if passwords do not match.
Click to show internal directories.
Click to hide internal directories.