quartzgun/auth/auth.go

32 lines
795 B
Go

package auth
import (
"time"
)
type User struct {
Name string
Pass string
Session string
LoginTime time.Time
LastSeen time.Time
Data map[string]interface{}
}
type UserStore interface {
InitiateSession(user string, password string) (string, error)
ValidateUser(user string, sessionId string) (bool, error)
EndSession(user string) error
AddUser(user string, password string) error
DeleteUser(user string) error
ChangePassword(user string, oldPassword string, newPassword string) error
}
func Login(user string, password string, userStore UserStore) (string, error) {
//ValidateUser (check user exists, hash and compare password)
//InitiateUserSession (generate token and assign it to the user)
//set username in cookie
//return token, nil
return "", nil
}