move authmiddleware to auth package

This commit is contained in:
Nazar Kanaev
2021-03-17 16:38:21 +00:00
parent 0b1c90718d
commit eb0ad7f22e
2 changed files with 18 additions and 20 deletions

View File

@@ -18,15 +18,14 @@ import (
func (s *Server) handler() http.Handler {
r := router.NewRouter(BasePath)
// TODO: auth, base, security
if s.Username != "" && s.Password != "" {
a := &authMiddleware{
basepath: BasePath,
username: s.Username,
password: s.Password,
public: "/static",
a := &auth.Middleware{
BasePath: BasePath,
Username: s.Username,
Password: s.Password,
Public: "/static",
}
r.Use(a.handler)
r.Use(a.Handler)
}
r.For("/", s.handleIndex)