Implement IMAP auth provider

This commit is contained in:
Drew DeVault 2022-02-21 10:55:02 +01:00
parent 96ef5f9b2a
commit 5a641ceca1
7 changed files with 100 additions and 1 deletions

View file

@ -8,6 +8,8 @@ import (
"github.com/go-chi/chi/v5"
"github.com/go-chi/chi/v5/middleware"
"git.sr.ht/~sircmpwn/tokidoki/auth"
)
func main() {
@ -25,6 +27,10 @@ func main() {
mux := chi.NewRouter()
mux.Use(middleware.Logger)
// TODO: Configurable
authProvider := auth.NewIMAP("imap.migadu.com:993", true)
mux.Use(authProvider.Middleware())
mux.Get("/", func (w http.ResponseWriter, r *http.Request) {
w.Write([]byte("Hello world!\n"))
})