mirror of
https://github.com/muety/wakapi.git
synced 2023-08-10 21:12:56 +03:00
15 lines
322 B
Go
15 lines
322 B
Go
|
package middlewares
|
||
|
|
||
|
import (
|
||
|
"net/http"
|
||
|
)
|
||
|
|
||
|
type RequireBasicAuthMiddleware struct{}
|
||
|
|
||
|
func (m *RequireBasicAuthMiddleware) Init() {}
|
||
|
|
||
|
func (m *RequireBasicAuthMiddleware) Handle(w http.ResponseWriter, r *http.Request, next http.HandlerFunc) {
|
||
|
w.Header().Set("WWW-Authenticate", `Basic realm="Restricted"`)
|
||
|
next(w, r)
|
||
|
}
|