Experiment with Authentication and Websockets
Some checks failed
build-docker-imge / Build the docker container (push) Failing after 2m24s
Some checks failed
build-docker-imge / Build the docker container (push) Failing after 2m24s
This commit is contained in:
36
repository/auth.go
Normal file
36
repository/auth.go
Normal file
@ -0,0 +1,36 @@
|
||||
package repository
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/google/uuid"
|
||||
)
|
||||
|
||||
type LoginParams struct {
|
||||
LoginName string `json:"loginname"`
|
||||
Password string `json:"password"`
|
||||
}
|
||||
|
||||
type RegisterParams struct {
|
||||
Username string `json:"username"`
|
||||
FirstName string `json:"firstname"`
|
||||
LastName string `json:"lastname"`
|
||||
LoginName string `json:"loginname"`
|
||||
EmailAddress string `json:"emailaddress"`
|
||||
Password string `json:"password"`
|
||||
}
|
||||
|
||||
type User struct {
|
||||
Username string `json:"username"`
|
||||
FirstName string `json:"firstname"`
|
||||
LastName string `json:"lastname"`
|
||||
LoginName string `json:"loginname"`
|
||||
EmailAddress string `json:"email"`
|
||||
Password []byte
|
||||
}
|
||||
|
||||
type AuthRepository interface {
|
||||
GetUserByToken(ctx context.Context, userId uuid.UUID) (User, error)
|
||||
Login(ctx context.Context, loginParams *LoginParams) (uuid.UUID, error)
|
||||
Register(ctx context.Context, registerParams *RegisterParams) (bool, error)
|
||||
}
|
Reference in New Issue
Block a user