Loading config/configure-secrets.py +1 −1 Original line number Diff line number Diff line Loading @@ -22,7 +22,7 @@ def usage(): # Parse secrets file def parse(fname): print '\n>>> Parsing secrets file' print ('\n>>> Parsing secrets file') with open(fname, 'r') as stream: secrets = {} try: Loading go-apps/meep-auth-svc/server/auth-svc.go +12 −8 Original line number Diff line number Diff line Loading @@ -66,6 +66,7 @@ const moduleNamespace = "default" const postgisUser = "postgres" const postgisPwd = "pwd" const pfmCtrlBasepath = "http://meep-platform-ctrl/platform-ctrl/v1" const providerModeSecure = "secure" // Permission Configuration types type Permission struct { Loading Loading @@ -110,6 +111,7 @@ type AuthRoute struct { type LoginRequest struct { provider string createSandbox string timer *time.Timer } Loading Loading @@ -771,8 +773,7 @@ func asAuthorize(w http.ResponseWriter, r *http.Request) { } metric.User = userId createSandboxStr := request.createSandbox createSandbox, err := strconv.ParseBool(createSandboxStr) createSandbox, err := strconv.ParseBool(request.createSandbox) if err != nil { createSandbox = false } Loading @@ -792,8 +793,7 @@ func asAuthorize(w http.ResponseWriter, r *http.Request) { _ = authSvc.metricStore.SetSessionMetric(met.SesMetTypeLogin, metric) // Redirect user to sandbox // http.Redirect(w, r, authSvc.uri+"?sbox="+sandboxName+"&user="+userId+"&role="+userRole, http.StatusFound) http.Redirect(w, r, authSvc.uri+"?user="+userId+"&role="+userRole, http.StatusFound) http.Redirect(w, r, authSvc.uri+"?sbox="+sandboxName+"&user="+userId+"&role="+userRole, http.StatusFound) metricSessionSuccess.Inc() if isNew { metricSessionActive.Inc() Loading @@ -808,7 +808,7 @@ func asLogin(w http.ResponseWriter, r *http.Request) { // Retrieve query parameters query := r.URL.Query() provider := query.Get("provider") createSandbox := query.Get("createSandbox") createSandbox := query.Get("sbox") metric.Provider = provider // Get provider-specific OAuth config Loading Loading @@ -927,12 +927,16 @@ func startSession(provider string, username string, w http.ResponseWriter, r *ht } // Get requested sandbox name & role from user profile, if any providerMode := strings.TrimSpace(os.Getenv("MEEP_OAUTH_GITHUB_PROVIDER_MODE")) role := users.RoleUser user, err := authSvc.userStore.GetUser(provider, username) if err == nil { sandboxName = user.Sboxname role = user.Role } if err != nil && providerMode == providerModeSecure { return "", false, "", err, http.StatusPreconditionFailed } // Create sandbox if createSandbox { Loading Loading @@ -969,7 +973,7 @@ func startSession(provider string, username string, w http.ResponseWriter, r *ht if err != nil { log.Error("Failed to set session with err: ", err.Error()) // Remove newly created sandbox on failure if session.ID == "" { if session.ID == "" && createSandbox { _, _ = authSvc.pfmCtrlClient.SandboxControlApi.DeleteSandbox(context.TODO(), sandboxName) } return "", false, "", err, code Loading Loading
config/configure-secrets.py +1 −1 Original line number Diff line number Diff line Loading @@ -22,7 +22,7 @@ def usage(): # Parse secrets file def parse(fname): print '\n>>> Parsing secrets file' print ('\n>>> Parsing secrets file') with open(fname, 'r') as stream: secrets = {} try: Loading
go-apps/meep-auth-svc/server/auth-svc.go +12 −8 Original line number Diff line number Diff line Loading @@ -66,6 +66,7 @@ const moduleNamespace = "default" const postgisUser = "postgres" const postgisPwd = "pwd" const pfmCtrlBasepath = "http://meep-platform-ctrl/platform-ctrl/v1" const providerModeSecure = "secure" // Permission Configuration types type Permission struct { Loading Loading @@ -110,6 +111,7 @@ type AuthRoute struct { type LoginRequest struct { provider string createSandbox string timer *time.Timer } Loading Loading @@ -771,8 +773,7 @@ func asAuthorize(w http.ResponseWriter, r *http.Request) { } metric.User = userId createSandboxStr := request.createSandbox createSandbox, err := strconv.ParseBool(createSandboxStr) createSandbox, err := strconv.ParseBool(request.createSandbox) if err != nil { createSandbox = false } Loading @@ -792,8 +793,7 @@ func asAuthorize(w http.ResponseWriter, r *http.Request) { _ = authSvc.metricStore.SetSessionMetric(met.SesMetTypeLogin, metric) // Redirect user to sandbox // http.Redirect(w, r, authSvc.uri+"?sbox="+sandboxName+"&user="+userId+"&role="+userRole, http.StatusFound) http.Redirect(w, r, authSvc.uri+"?user="+userId+"&role="+userRole, http.StatusFound) http.Redirect(w, r, authSvc.uri+"?sbox="+sandboxName+"&user="+userId+"&role="+userRole, http.StatusFound) metricSessionSuccess.Inc() if isNew { metricSessionActive.Inc() Loading @@ -808,7 +808,7 @@ func asLogin(w http.ResponseWriter, r *http.Request) { // Retrieve query parameters query := r.URL.Query() provider := query.Get("provider") createSandbox := query.Get("createSandbox") createSandbox := query.Get("sbox") metric.Provider = provider // Get provider-specific OAuth config Loading Loading @@ -927,12 +927,16 @@ func startSession(provider string, username string, w http.ResponseWriter, r *ht } // Get requested sandbox name & role from user profile, if any providerMode := strings.TrimSpace(os.Getenv("MEEP_OAUTH_GITHUB_PROVIDER_MODE")) role := users.RoleUser user, err := authSvc.userStore.GetUser(provider, username) if err == nil { sandboxName = user.Sboxname role = user.Role } if err != nil && providerMode == providerModeSecure { return "", false, "", err, http.StatusPreconditionFailed } // Create sandbox if createSandbox { Loading Loading @@ -969,7 +973,7 @@ func startSession(provider string, username string, w http.ResponseWriter, r *ht if err != nil { log.Error("Failed to set session with err: ", err.Error()) // Remove newly created sandbox on failure if session.ID == "" { if session.ID == "" && createSandbox { _, _ = authSvc.pfmCtrlClient.SandboxControlApi.DeleteSandbox(context.TODO(), sandboxName) } return "", false, "", err, code Loading