fixed JWT token auth

This commit is contained in:
Ubuntu
2021-04-20 01:50:58 +00:00
parent e4ed11d744
commit fa3faf778d
4 changed files with 7 additions and 5 deletions

View File

@@ -9,7 +9,7 @@ import (
"net/http"
"strings"
"time"
"os"
"github.com/gorilla/mux"
"github.com/gravitl/netmaker/config"
"github.com/gravitl/netmaker/functions"
@@ -83,7 +83,7 @@ func securityCheck(next http.Handler) http.HandlerFunc {
//Consider a more secure way of setting master key
func authenticateMaster(tokenString string) bool {
if tokenString == config.Config.Server.MasterKey {
if tokenString == config.Config.Server.MasterKey || (tokenString == os.Getenv("MASTER_KEY") && tokenString != "") {
return true
}
return false