20 lines
531 B
Go
20 lines
531 B
Go
|
package auth
|
||
|
|
||
|
import (
|
||
|
//nilfm.cc/git/goldbug/cookie
|
||
|
)
|
||
|
|
||
|
type UserStore interface {
|
||
|
InitiateSession(user string, sessionId string) error
|
||
|
ValidateUser(user string, password string, sessionId string) (bool, error)
|
||
|
EndSession(user 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
|
||
|
}
|