From faa296075f5ea2d8e01004b46b036997f9529d99 Mon Sep 17 00:00:00 2001 From: Brian Picciano Date: Sun, 26 May 2024 22:06:44 +0200 Subject: Clean out Get/SetRequestLogger from apiutil --- src/http/auth.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/http/auth.go') diff --git a/src/http/auth.go b/src/http/auth.go index eac73b7..70d33fb 100644 --- a/src/http/auth.go +++ b/src/http/auth.go @@ -5,7 +5,7 @@ import ( "net/http" "time" - "dev.mediocregopher.com/mediocre-blog.git/src/http/apiutil" + "dev.mediocregopher.com/mediocre-go-lib.git/mlog" "golang.org/x/crypto/bcrypt" ) @@ -65,12 +65,12 @@ func (a *auther) Allowed(ctx context.Context, username, password string) bool { return err == nil } -func authMiddleware(auther Auther) middleware { +func authMiddleware(logger *mlog.Logger, auther Auther) middleware { respondUnauthorized := func(rw http.ResponseWriter, r *http.Request) { rw.Header().Set("WWW-Authenticate", `Basic realm="NOPE"`) rw.WriteHeader(http.StatusUnauthorized) - apiutil.GetRequestLogger(r).WarnString(r.Context(), "unauthorized") + logger.WarnString(r.Context(), "unauthorized") } return func(h http.Handler) http.Handler { -- cgit v1.2.3