Refresh Token Support and package refactor based on best practice docs #18
@ -17,6 +17,16 @@ const (
|
|||||||
ErrInvalidPassword = "invalid password"
|
ErrInvalidPassword = "invalid password"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
type Users interface {
|
||||||
|
DoesUserExist(username string) error
|
||||||
|
DoesPasswordMatchHash(username, password string) error
|
||||||
|
GetUser(username string) (domain.UserEntity, error)
|
||||||
|
AddScopes(username string, scopes []string) error
|
||||||
|
RemoveScopes(username string, scopes []string) error
|
||||||
|
Create(name, password, scope string) (domain.UserEntity, error)
|
||||||
|
CheckPasswordForRequirements(password string) error
|
||||||
|
}
|
||||||
|
|
||||||
// This will handle operations that are user related, but one layer higher then the repository
|
// This will handle operations that are user related, but one layer higher then the repository
|
||||||
type UserService struct {
|
type UserService struct {
|
||||||
repo repositories.IUserTable
|
repo repositories.IUserTable
|
||||||
@ -111,7 +121,7 @@ func (us UserService) doesScopeExist(scopes []string, target string) bool {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
func (us UserService) CreateNewUser(name, password, scope string) (domain.UserEntity, error) {
|
func (us UserService) Create(name, password, scope string) (domain.UserEntity, error) {
|
||||||
err := us.CheckPasswordForRequirements(password)
|
err := us.CheckPasswordForRequirements(password)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return domain.UserEntity{}, err
|
return domain.UserEntity{}, err
|
||||||
|
Loading…
Reference in New Issue
Block a user