1package oauth
2
3import (
4 "net/http"
5)
6
7type AuthService interface {
8 // inits the login flow for the service
9 HandleLogin(w http.ResponseWriter, r *http.Request)
10 // handles the callback for the provider. is responsible for inserting
11 // sessions in the db
12 HandleCallback(w http.ResponseWriter, r *http.Request) (int64, error)
13
14 HandleLogout(w http.ResponseWriter, r *http.Request)
15}
16
17// optional but recommended
18type TokenReceiver interface {
19 // stores the access token in the db
20 // if there is a session, will associate the token with the session
21 SetAccessToken(token string, refreshToken string, currentId int64, hasSession bool) (int64, error)
22}