Refresh Token Support and package refactor based on best practice docs #18

Merged
jtom38 merged 15 commits from features/restructure-go-recommendations into main 2024-04-21 10:30:52 -07:00
Showing only changes of commit 8d8781eac4 - Show all commits

View File

@ -17,6 +17,16 @@ const (
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
type UserService struct {
repo repositories.IUserTable
@ -111,7 +121,7 @@ func (us UserService) doesScopeExist(scopes []string, target string) bool {
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)
if err != nil {
return domain.UserEntity{}, err