Docker test

This commit is contained in:
2021-09-15 19:11:17 +00:00
parent eef066b179
commit 9128b4aa0c
3 changed files with 13 additions and 12 deletions

View File

@ -7,7 +7,7 @@ import (
"errors"
"io/ioutil"
"net/http"
"os"
// "os"
"github.com/HelloWorld/goProductAPI/entity"
"github.com/gorilla/mux"
@ -150,8 +150,10 @@ func AuthHandler(h http.Handler) http.HandlerFunc {
return func(rw http.ResponseWriter, r *http.Request) {
user, pass, ok := r.BasicAuth()
if ok {
username := sha256.Sum256([]byte(os.Getenv("USER_NAME")))
password := sha256.Sum256([]byte(os.Getenv("USER_PASS")))
// username := sha256.Sum256([]byte(os.Getenv("USER_NAME")))
// password := sha256.Sum256([]byte(os.Getenv("USER_PASS")))
username := sha256.Sum256([]byte("1234"))
password := sha256.Sum256([]byte("1234"))
userHash := sha256.Sum256([]byte(user))
passHash := sha256.Sum256([]byte(pass))
validUser := subtle.ConstantTimeCompare(userHash[:],username[:]) == 1