Loading .meepctl-repocfg.yaml +5 −0 Original line number Diff line number Diff line Loading @@ -669,6 +669,11 @@ repo: src: go-packages/meep-sandbox-store # supports linting lint: true meep-sessions: # location of source code src: go-packages/meep-sessions # supports linting lint: true meep-watchdog: # location of source code src: go-packages/meep-watchdog Loading go-apps/meep-platform-ctrl/go.mod +2 −2 Original line number Diff line number Diff line Loading @@ -9,7 +9,7 @@ require ( github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-model v0.0.0 github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-mq v0.0.0 github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-sandbox-store v0.0.0 github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-sessions-manager v0.0.0 github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-sessions v0.0.0 github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-watchdog v0.0.0 github.com/gorilla/handlers v1.4.0 github.com/gorilla/mux v1.7.3 Loading @@ -24,6 +24,6 @@ replace ( github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-mq => ../../go-packages/meep-mq github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-redis => ../../go-packages/meep-redis github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-sandbox-store => ../../go-packages/meep-sandbox-store github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-sessions-manager => ../../go-packages/meep-sessions-manager github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-sessions => ../../go-packages/meep-sessions github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-watchdog => ../../go-packages/meep-watchdog ) go-apps/meep-platform-ctrl/go.sum +6 −1 Original line number Diff line number Diff line github.com/InterDigitalInc/AdvantEDGE v1.5.0 h1:Gv1wxW7kV31reTqxX5TflvvYEEqnxaUlKWvgoandpfI= github.com/KromDaniel/jonson v0.0.0-20180630143114-d2f9c3c389db/go.mod h1:RU+6d0CNIRSp6yo1mXLIIrnFa/3LHhvcDVLVJyovptM= github.com/KromDaniel/rejonson v0.0.0-20180822072824-00b5bcf2b351 h1:1u1XrfCBnY+GijnyU6O1k4odp5TnqZQTsp5v7+n/E4Y= github.com/KromDaniel/rejonson v0.0.0-20180822072824-00b5bcf2b351/go.mod h1:HxwfbuElTuGf+/uKZfjJrCnv0BmmpkPJDI7gBwj1KkM= Loading @@ -8,6 +7,8 @@ github.com/RyanCarrier/dijkstra-1 v0.0.0-20170512020943-0e5801a26345/go.mod h1:O github.com/albertorestifo/dijkstra v0.0.0-20160910063646-aba76f725f72/go.mod h1:o+JdB7VetTHjLhU0N57x18B9voDBQe0paApdEAEoEfw= github.com/blang/semver v3.5.1+incompatible h1:cQNTCjp13qL8KC3Nbxr/y2Bqb63oX6wdnnjpJbkM4JQ= github.com/blang/semver v3.5.1+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnwebNt5EWlYSAyrTnjyyk= github.com/boj/redistore v0.0.0-20180917114910-cd5dcc76aeff h1:RmdPFa+slIr4SCBg4st/l/vZWVe9QJKMXGO60Bxbe04= github.com/boj/redistore v0.0.0-20180917114910-cd5dcc76aeff/go.mod h1:+RTT1BOk5P97fT2CiHkbFQwkK3mjsFAP6zCYV2aXtjw= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/flimzy/kivik v1.8.1 h1:URl7e0OnfSvAu3ZHQ5BkvzRZlCmyYuDyWUCcPWIHlU0= github.com/flimzy/kivik v1.8.1/go.mod h1:S2aPycbG0eDFll4wgXt9uacSNkXISPufutnc9sv+mdA= Loading @@ -18,12 +19,16 @@ github.com/go-kivik/kivik v1.8.1/go.mod h1:nIuJ8z4ikBrVUSk3Ua8NoDqYKULPNjuddjqRv github.com/go-redis/redis v6.15.2+incompatible h1:9SpNVG76gr6InJGxoZ6IuuxaCOQwDAhzyXg+Bs+0Sb4= github.com/go-redis/redis v6.15.2+incompatible/go.mod h1:NAIEuMOZ/fxfXJIrKDQDz8wamY7mA7PouImQ2Jvg6kA= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/gomodule/redigo v2.0.0+incompatible h1:K/R+8tc58AaqLkqG2Ol3Qk+DR/TlNuhuh457pBFPtt0= github.com/gomodule/redigo v2.0.0+incompatible/go.mod h1:B4C85qUVwatsJoIUNIfCRsp7qO0iAmpGFZ4EELWSbC4= github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg= github.com/gorilla/handlers v1.4.0 h1:XulKRWSQK5uChr4pEgSE4Tc/OcmnU9GJuSwdog/tZsA= github.com/gorilla/handlers v1.4.0/go.mod h1:Qkdc/uu4tH4g6mTK6auzZ766c4CA0Ng8+o/OAirnOIQ= github.com/gorilla/mux v1.7.3 h1:gnP5JzjVOuiZD07fKKToCAOjS0yOpj/qPETTXCCS6hw= github.com/gorilla/mux v1.7.3/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= github.com/gorilla/securecookie v1.1.1 h1:miw7JPhV+b/lAHSXz4qd/nN9jRiAFV5FwjeKyCS8BvQ= github.com/gorilla/securecookie v1.1.1/go.mod h1:ra0sb63/xPlUeL+yeDciTfxMRAA+MP+HVt/4epWDjd4= github.com/gorilla/sessions v1.1.1/go.mod h1:8KCfur6+4Mqcc6S0FEfKuN15Vl5MgXW92AE8ovaJD0w= github.com/gorilla/sessions v1.2.0 h1:S7P+1Hm5V/AT9cjEcUD5uDaQSX0OE577aCXgoaKpYbQ= github.com/gorilla/sessions v1.2.0/go.mod h1:dk2InVEVJ0sfLlnXv9EAgkf6ecYs/i80K/zI+bUmuGM= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= Loading go-apps/meep-platform-ctrl/server/platform-ctrl.go +10 −0 Original line number Diff line number Diff line Loading @@ -33,6 +33,7 @@ import ( mod "github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-model" mq "github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-mq" ss "github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-sandbox-store" sessions "github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-sessions" wd "github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-watchdog" ) Loading @@ -43,6 +44,7 @@ type Scenario struct { type PlatformCtrl struct { scenarioStore *couch.Connector sandboxStore *ss.SandboxStore sessionStore *sessions.SessionStore veWatchdog *wd.Watchdog mqGlobal *mq.MsgQueue } Loading Loading @@ -125,6 +127,14 @@ func Init() (err error) { } log.Info("Connected to Sandbox Store") // Connect to Session Store pfmCtrl.sessionStore, err = sessions.NewSessionStore(redisDBAddr) if err != nil { log.Error("Failed connection to Session Store: ", err.Error()) return err } log.Info("Connected to Session Store") // Setup for virt-engine monitoring pfmCtrl.veWatchdog, err = wd.NewWatchdog(moduleName, moduleNamespace, moduleVirtEngineName, moduleVirtEngineNamespace, "") if err != nil { Loading go-apps/meep-platform-ctrl/server/user_authentication.go +54 −11 Original line number Diff line number Diff line Loading @@ -28,14 +28,42 @@ import ( "net/http" log "github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-logger" sm "github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-sessions-manager" sessions "github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-sessions" ) func init() { log.Info("Initializing User Auth.") type User struct { Username string Password string SessionId string Active bool } var user1 = User{"u1", "1234", "NA", false} var user2 = User{"u2", "2345", "NA", false} var user3 = User{"u3", "3456", "NA", false} // Map of configured users - Key=Username var ConfiguredUsers map[string]*User _ = sm.Init("") func init() { // add preconfigured users ConfiguredUsers = make(map[string]*User) ConfiguredUsers[user1.Username] = &user1 ConfiguredUsers[user2.Username] = &user2 ConfiguredUsers[user3.Username] = &user3 } func authenticateUser(username string, password string) bool { // Verify user name user, ok := ConfiguredUsers[username] if !ok { return false } // Verify password if user.Password != password { return false } return true } func uaLoginUser(w http.ResponseWriter, r *http.Request) { Loading @@ -45,11 +73,26 @@ func uaLoginUser(w http.ResponseWriter, r *http.Request) { username := r.FormValue("username") password := r.FormValue("password") err := sm.AuthenticateNewUser(username, password, w, r) // Validate user credentials if !authenticateUser(username, password) { http.Error(w, "Unauthorized", http.StatusUnauthorized) return } // Create new session if none found _, err := pfmCtrl.sessionStore.GetSession(r) if err != nil { log.Error("There was an error during authentication of user ", username) var sessionInfo sessions.SessionInfo sessionInfo.Username = username err = pfmCtrl.sessionStore.CreateSession(&sessionInfo, w, r) if err != nil { log.Error("Failed to create session with err: ", err.Error()) return } } else { log.Info("Already logged in...") } w.Header().Set("Content-Type", "application/json; charset=UTF-8") w.WriteHeader(http.StatusOK) Loading @@ -57,11 +100,11 @@ func uaLoginUser(w http.ResponseWriter, r *http.Request) { func uaLogoutUser(w http.ResponseWriter, r *http.Request) { log.Info("----- LOGOUT -----") //PrintConnectedUsers() // Get session cookie err := sm.AuthenticateUserDeletion(w, r) // Delete session err := pfmCtrl.sessionStore.DeleteSession(w, r) if err != nil { log.Error("There was an error during authentication of user") log.Error("Failed to delete session with err: ", err.Error()) return } Loading Loading
.meepctl-repocfg.yaml +5 −0 Original line number Diff line number Diff line Loading @@ -669,6 +669,11 @@ repo: src: go-packages/meep-sandbox-store # supports linting lint: true meep-sessions: # location of source code src: go-packages/meep-sessions # supports linting lint: true meep-watchdog: # location of source code src: go-packages/meep-watchdog Loading
go-apps/meep-platform-ctrl/go.mod +2 −2 Original line number Diff line number Diff line Loading @@ -9,7 +9,7 @@ require ( github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-model v0.0.0 github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-mq v0.0.0 github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-sandbox-store v0.0.0 github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-sessions-manager v0.0.0 github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-sessions v0.0.0 github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-watchdog v0.0.0 github.com/gorilla/handlers v1.4.0 github.com/gorilla/mux v1.7.3 Loading @@ -24,6 +24,6 @@ replace ( github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-mq => ../../go-packages/meep-mq github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-redis => ../../go-packages/meep-redis github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-sandbox-store => ../../go-packages/meep-sandbox-store github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-sessions-manager => ../../go-packages/meep-sessions-manager github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-sessions => ../../go-packages/meep-sessions github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-watchdog => ../../go-packages/meep-watchdog )
go-apps/meep-platform-ctrl/go.sum +6 −1 Original line number Diff line number Diff line github.com/InterDigitalInc/AdvantEDGE v1.5.0 h1:Gv1wxW7kV31reTqxX5TflvvYEEqnxaUlKWvgoandpfI= github.com/KromDaniel/jonson v0.0.0-20180630143114-d2f9c3c389db/go.mod h1:RU+6d0CNIRSp6yo1mXLIIrnFa/3LHhvcDVLVJyovptM= github.com/KromDaniel/rejonson v0.0.0-20180822072824-00b5bcf2b351 h1:1u1XrfCBnY+GijnyU6O1k4odp5TnqZQTsp5v7+n/E4Y= github.com/KromDaniel/rejonson v0.0.0-20180822072824-00b5bcf2b351/go.mod h1:HxwfbuElTuGf+/uKZfjJrCnv0BmmpkPJDI7gBwj1KkM= Loading @@ -8,6 +7,8 @@ github.com/RyanCarrier/dijkstra-1 v0.0.0-20170512020943-0e5801a26345/go.mod h1:O github.com/albertorestifo/dijkstra v0.0.0-20160910063646-aba76f725f72/go.mod h1:o+JdB7VetTHjLhU0N57x18B9voDBQe0paApdEAEoEfw= github.com/blang/semver v3.5.1+incompatible h1:cQNTCjp13qL8KC3Nbxr/y2Bqb63oX6wdnnjpJbkM4JQ= github.com/blang/semver v3.5.1+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnwebNt5EWlYSAyrTnjyyk= github.com/boj/redistore v0.0.0-20180917114910-cd5dcc76aeff h1:RmdPFa+slIr4SCBg4st/l/vZWVe9QJKMXGO60Bxbe04= github.com/boj/redistore v0.0.0-20180917114910-cd5dcc76aeff/go.mod h1:+RTT1BOk5P97fT2CiHkbFQwkK3mjsFAP6zCYV2aXtjw= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/flimzy/kivik v1.8.1 h1:URl7e0OnfSvAu3ZHQ5BkvzRZlCmyYuDyWUCcPWIHlU0= github.com/flimzy/kivik v1.8.1/go.mod h1:S2aPycbG0eDFll4wgXt9uacSNkXISPufutnc9sv+mdA= Loading @@ -18,12 +19,16 @@ github.com/go-kivik/kivik v1.8.1/go.mod h1:nIuJ8z4ikBrVUSk3Ua8NoDqYKULPNjuddjqRv github.com/go-redis/redis v6.15.2+incompatible h1:9SpNVG76gr6InJGxoZ6IuuxaCOQwDAhzyXg+Bs+0Sb4= github.com/go-redis/redis v6.15.2+incompatible/go.mod h1:NAIEuMOZ/fxfXJIrKDQDz8wamY7mA7PouImQ2Jvg6kA= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/gomodule/redigo v2.0.0+incompatible h1:K/R+8tc58AaqLkqG2Ol3Qk+DR/TlNuhuh457pBFPtt0= github.com/gomodule/redigo v2.0.0+incompatible/go.mod h1:B4C85qUVwatsJoIUNIfCRsp7qO0iAmpGFZ4EELWSbC4= github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg= github.com/gorilla/handlers v1.4.0 h1:XulKRWSQK5uChr4pEgSE4Tc/OcmnU9GJuSwdog/tZsA= github.com/gorilla/handlers v1.4.0/go.mod h1:Qkdc/uu4tH4g6mTK6auzZ766c4CA0Ng8+o/OAirnOIQ= github.com/gorilla/mux v1.7.3 h1:gnP5JzjVOuiZD07fKKToCAOjS0yOpj/qPETTXCCS6hw= github.com/gorilla/mux v1.7.3/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= github.com/gorilla/securecookie v1.1.1 h1:miw7JPhV+b/lAHSXz4qd/nN9jRiAFV5FwjeKyCS8BvQ= github.com/gorilla/securecookie v1.1.1/go.mod h1:ra0sb63/xPlUeL+yeDciTfxMRAA+MP+HVt/4epWDjd4= github.com/gorilla/sessions v1.1.1/go.mod h1:8KCfur6+4Mqcc6S0FEfKuN15Vl5MgXW92AE8ovaJD0w= github.com/gorilla/sessions v1.2.0 h1:S7P+1Hm5V/AT9cjEcUD5uDaQSX0OE577aCXgoaKpYbQ= github.com/gorilla/sessions v1.2.0/go.mod h1:dk2InVEVJ0sfLlnXv9EAgkf6ecYs/i80K/zI+bUmuGM= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= Loading
go-apps/meep-platform-ctrl/server/platform-ctrl.go +10 −0 Original line number Diff line number Diff line Loading @@ -33,6 +33,7 @@ import ( mod "github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-model" mq "github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-mq" ss "github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-sandbox-store" sessions "github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-sessions" wd "github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-watchdog" ) Loading @@ -43,6 +44,7 @@ type Scenario struct { type PlatformCtrl struct { scenarioStore *couch.Connector sandboxStore *ss.SandboxStore sessionStore *sessions.SessionStore veWatchdog *wd.Watchdog mqGlobal *mq.MsgQueue } Loading Loading @@ -125,6 +127,14 @@ func Init() (err error) { } log.Info("Connected to Sandbox Store") // Connect to Session Store pfmCtrl.sessionStore, err = sessions.NewSessionStore(redisDBAddr) if err != nil { log.Error("Failed connection to Session Store: ", err.Error()) return err } log.Info("Connected to Session Store") // Setup for virt-engine monitoring pfmCtrl.veWatchdog, err = wd.NewWatchdog(moduleName, moduleNamespace, moduleVirtEngineName, moduleVirtEngineNamespace, "") if err != nil { Loading
go-apps/meep-platform-ctrl/server/user_authentication.go +54 −11 Original line number Diff line number Diff line Loading @@ -28,14 +28,42 @@ import ( "net/http" log "github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-logger" sm "github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-sessions-manager" sessions "github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-sessions" ) func init() { log.Info("Initializing User Auth.") type User struct { Username string Password string SessionId string Active bool } var user1 = User{"u1", "1234", "NA", false} var user2 = User{"u2", "2345", "NA", false} var user3 = User{"u3", "3456", "NA", false} // Map of configured users - Key=Username var ConfiguredUsers map[string]*User _ = sm.Init("") func init() { // add preconfigured users ConfiguredUsers = make(map[string]*User) ConfiguredUsers[user1.Username] = &user1 ConfiguredUsers[user2.Username] = &user2 ConfiguredUsers[user3.Username] = &user3 } func authenticateUser(username string, password string) bool { // Verify user name user, ok := ConfiguredUsers[username] if !ok { return false } // Verify password if user.Password != password { return false } return true } func uaLoginUser(w http.ResponseWriter, r *http.Request) { Loading @@ -45,11 +73,26 @@ func uaLoginUser(w http.ResponseWriter, r *http.Request) { username := r.FormValue("username") password := r.FormValue("password") err := sm.AuthenticateNewUser(username, password, w, r) // Validate user credentials if !authenticateUser(username, password) { http.Error(w, "Unauthorized", http.StatusUnauthorized) return } // Create new session if none found _, err := pfmCtrl.sessionStore.GetSession(r) if err != nil { log.Error("There was an error during authentication of user ", username) var sessionInfo sessions.SessionInfo sessionInfo.Username = username err = pfmCtrl.sessionStore.CreateSession(&sessionInfo, w, r) if err != nil { log.Error("Failed to create session with err: ", err.Error()) return } } else { log.Info("Already logged in...") } w.Header().Set("Content-Type", "application/json; charset=UTF-8") w.WriteHeader(http.StatusOK) Loading @@ -57,11 +100,11 @@ func uaLoginUser(w http.ResponseWriter, r *http.Request) { func uaLogoutUser(w http.ResponseWriter, r *http.Request) { log.Info("----- LOGOUT -----") //PrintConnectedUsers() // Get session cookie err := sm.AuthenticateUserDeletion(w, r) // Delete session err := pfmCtrl.sessionStore.DeleteSession(w, r) if err != nil { log.Error("There was an error during authentication of user") log.Error("Failed to delete session with err: ", err.Error()) return } Loading