all repos — quartzgun @ b17fa798b7e3c2ef80cd774f00158b7e2c3c4fa6

lightweight web framework in go

auth/auth.go (raw)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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
}