added auth method

This commit is contained in:
ston1th 2021-02-10 23:54:31 +01:00
commit a735b9cc5e
8 changed files with 270 additions and 12 deletions

View file

@ -1,6 +1,7 @@
package server
import (
//"golang.org/x/crypto/bcrypt"
"net/http"
)
@ -15,10 +16,14 @@ func (nf *notFoundHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
func authHandler(h ctxHandler) ctxHandler {
return func(ctx *Context) {
// TODO
// test:123456
// test:$2b$10$zNfGTAQ94vifj2wtGsv1W.yZRe4/rDBzQixpB6FbrTed4BnHuNqBS
//bcrypt.CompareHashAndPassword(hash, pw)
h(ctx)
}
}
func healthzHandler(ctx *Context) {
// TODO maybe report etcd/raft stats
ctx.OK()
}