This commit is contained in:
26
main.go
26
main.go
@@ -259,26 +259,32 @@ func main() {
|
||||
|
||||
// Other functions for admin
|
||||
adminOnly.POST("/unlock", controllers.Unlock)
|
||||
adminOnly.POST("/safes/listall", controllers.GetAllSafesHandler)
|
||||
|
||||
// Deprecated
|
||||
//adminOnly.GET("/roles", controllers.GetRoles)
|
||||
//adminOnly.POST("/role/add", controllers.AddRole)
|
||||
|
||||
// Get secrets
|
||||
protected := router.Group("/api/secret")
|
||||
protected.Use(middlewares.JwtAuthMiddleware())
|
||||
protected.POST("/retrieve", controllers.RetrieveSecret)
|
||||
protected.GET("/list", controllers.ListSecrets)
|
||||
protected.POST("/retrieveMultiple", controllers.RetrieveMultpleSecrets) // TODO is this still required?
|
||||
protected.POST("/store", controllers.StoreSecret)
|
||||
protected.POST("/update", controllers.UpdateSecret)
|
||||
secretRoutes := router.Group("/api/secret")
|
||||
secretRoutes.Use(middlewares.JwtAuthMiddleware())
|
||||
secretRoutes.POST("/retrieve", controllers.RetrieveSecret)
|
||||
secretRoutes.GET("/list", controllers.ListSecrets)
|
||||
secretRoutes.POST("/retrieveMultiple", controllers.RetrieveMultpleSecrets) // TODO is this still required?
|
||||
secretRoutes.POST("/store", controllers.StoreSecret)
|
||||
secretRoutes.POST("/update", controllers.UpdateSecret)
|
||||
// TODO
|
||||
protected.POST("/delete", controllers.DeleteSecret)
|
||||
secretRoutes.POST("/delete", controllers.DeleteSecret)
|
||||
|
||||
// Get Safes (only those user allowed to access)
|
||||
safeRoutes := router.Group("/api/safe")
|
||||
safeRoutes.Use(middlewares.JwtAuthMiddleware())
|
||||
safeRoutes.GET("/list", controllers.GetSafesHandler)
|
||||
|
||||
// Support parameters in path
|
||||
// See https://gin-gonic.com/docs/examples/param-in-path/
|
||||
protected.GET("/retrieve/name/:devicename", controllers.RetrieveSecretByDevicename)
|
||||
protected.GET("/retrieve/category/:devicecategory", controllers.RetrieveSecretByDevicecategory)
|
||||
secretRoutes.GET("/retrieve/name/:devicename", controllers.RetrieveSecretByDevicename)
|
||||
secretRoutes.GET("/retrieve/category/:devicecategory", controllers.RetrieveSecretByDevicecategory)
|
||||
|
||||
// Initializing the server in a goroutine so that
|
||||
// it won't block the graceful shutdown handling below
|
||||
|
Reference in New Issue
Block a user