Sessions in etcd KV store instead of cookies
This commit is contained in:
16
main.go
16
main.go
@@ -11,8 +11,8 @@ import (
|
||||
"git.coopgo.io/coopgo-apps/parcoursmob/handlers/auth"
|
||||
"git.coopgo.io/coopgo-apps/parcoursmob/renderer"
|
||||
"git.coopgo.io/coopgo-apps/parcoursmob/services"
|
||||
"git.coopgo.io/coopgo-apps/parcoursmob/utils/cache"
|
||||
"git.coopgo.io/coopgo-apps/parcoursmob/utils/identification"
|
||||
cache "git.coopgo.io/coopgo-apps/parcoursmob/utils/storage"
|
||||
"github.com/gorilla/mux"
|
||||
)
|
||||
|
||||
@@ -33,12 +33,12 @@ func main() {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
idp, err := identification.NewIdentificationProvider(cfg, svc)
|
||||
kv, err := cache.NewKVHandler(cfg)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
cache, err := cache.NewCacheHandler(cfg)
|
||||
idp, err := identification.NewIdentificationProvider(cfg, svc, kv)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
@@ -48,9 +48,9 @@ func main() {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
apiHandler, _ := api.NewAPIHandler(cfg, idp, svc, cache)
|
||||
applicationHandler, _ := application.NewApplicationHandler(cfg, svc, cache, emailing)
|
||||
authHandler, _ := auth.NewAuthHandler(cfg, idp, svc, cache)
|
||||
apiHandler, _ := api.NewAPIHandler(cfg, idp, svc, kv)
|
||||
applicationHandler, _ := application.NewApplicationHandler(cfg, svc, kv, emailing)
|
||||
authHandler, _ := auth.NewAuthHandler(cfg, idp, svc, kv, emailing)
|
||||
|
||||
fmt.Println("Running", service_name, ":")
|
||||
|
||||
@@ -59,6 +59,8 @@ func main() {
|
||||
r.PathPrefix("/public/").Handler(http.StripPrefix("/public/", http.FileServer(http.Dir(templates_public_dir))))
|
||||
|
||||
r.HandleFunc("/auth/onboarding", authHandler.Onboarding)
|
||||
r.HandleFunc("/auth/lost-password", authHandler.LostPasswordInit)
|
||||
r.HandleFunc("/auth/lost-password/recover", authHandler.LostPasswordRecover)
|
||||
r.HandleFunc("/auth/groups/", authHandler.Groups)
|
||||
r.HandleFunc("/auth/groups/switch", authHandler.GroupSwitch)
|
||||
r.HandleFunc("/", redirectApp)
|
||||
@@ -67,6 +69,7 @@ func main() {
|
||||
api_router.HandleFunc("/", apiHandler.NotFound)
|
||||
api_router.HandleFunc("/geo/autocomplete", apiHandler.GeoAutocomplete)
|
||||
api_router.HandleFunc("/cache/{cacheid}", apiHandler.GetCache)
|
||||
api_router.HandleFunc("/cache/{cacheid}/export", apiHandler.CacheExport)
|
||||
api_router.HandleFunc("/oauth2/callback", apiHandler.OAuth2Callback)
|
||||
|
||||
application := r.PathPrefix("/app").Subrouter()
|
||||
@@ -104,6 +107,7 @@ func main() {
|
||||
appAdmin.HandleFunc("/groups/", applicationHandler.AdministrationCreateGroup)
|
||||
appAdmin.HandleFunc("/groups/{groupid}", applicationHandler.AdministrationGroupDisplay)
|
||||
appAdmin.HandleFunc("/groups/{groupid}/invite-admin", applicationHandler.AdministrationGroupInviteAdmin)
|
||||
appAdmin.HandleFunc("/groups/{groupid}/invite-member", applicationHandler.AdministrationGroupInviteMember)
|
||||
//TODO Secure with Middleware checking for modules
|
||||
|
||||
fmt.Println("-> HTTP server listening on", address)
|
||||
|
||||
Reference in New Issue
Block a user