This commit is contained in:
@@ -275,7 +275,7 @@ Deleting a group will also impact all permissions based on that group. For that
|
|||||||
### Secrets Operations
|
### Secrets Operations
|
||||||
|
|
||||||
#### Store
|
#### Store
|
||||||
**POST** `/api/secret/store`
|
**POST** `/api/secret/add`
|
||||||
|
|
||||||
Store secret if user only has access to a single safe
|
Store secret if user only has access to a single safe
|
||||||
|
|
||||||
@@ -308,7 +308,7 @@ If a secret exists with a matching deviceName and deviceCategory in a safe that
|
|||||||
If the current user has access to multiple safes, then the destination safeId will also need to be specified.
|
If the current user has access to multiple safes, then the destination safeId will also need to be specified.
|
||||||
|
|
||||||
#### Retrieve
|
#### Retrieve
|
||||||
POST `/api/secret/retrieve`
|
POST `/api/secret/get`
|
||||||
|
|
||||||
Data
|
Data
|
||||||
```
|
```
|
||||||
|
@@ -118,7 +118,9 @@ func StoreSecret(c *gin.Context) {
|
|||||||
// TODO replace GetSecrets with SecretsGetFromMultipleSafes
|
// TODO replace GetSecrets with SecretsGetFromMultipleSafes
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()})
|
errString := fmt.Sprintf("error checking for existing secret : %s", err)
|
||||||
|
log.Printf("StoreSecret %s\n", errString)
|
||||||
|
c.JSON(http.StatusBadRequest, gin.H{"error": errString})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if len(checkExists) > 0 {
|
if len(checkExists) > 0 {
|
||||||
@@ -239,8 +241,8 @@ func UpdateSecret(c *gin.Context) {
|
|||||||
log.Printf("UpdateSecret received JSON input '%v'\n", input)
|
log.Printf("UpdateSecret received JSON input '%v'\n", input)
|
||||||
|
|
||||||
if len(input.SecretValue) == 0 {
|
if len(input.SecretValue) == 0 {
|
||||||
errString := "UpdateSecret no updated secret specified\n"
|
errString := "no updated secret specified\n"
|
||||||
log.Print(errString)
|
log.Printf("UpdateSecret %s\n", errString)
|
||||||
c.JSON(http.StatusBadRequest, gin.H{"error": errString})
|
c.JSON(http.StatusBadRequest, gin.H{"error": errString})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
7
main.go
7
main.go
@@ -273,10 +273,13 @@ func main() {
|
|||||||
// Get secrets
|
// Get secrets
|
||||||
secretRoutes := router.Group("/api/secret")
|
secretRoutes := router.Group("/api/secret")
|
||||||
secretRoutes.Use(middlewares.JwtAuthMiddleware())
|
secretRoutes.Use(middlewares.JwtAuthMiddleware())
|
||||||
secretRoutes.POST("/retrieve", controllers.RetrieveSecret)
|
secretRoutes.POST("/retrieve", controllers.RetrieveSecret) // TODO deprecate, replace retrieve with get
|
||||||
|
secretRoutes.POST("/get", controllers.RetrieveSecret)
|
||||||
secretRoutes.GET("/list", controllers.ListSecrets)
|
secretRoutes.GET("/list", controllers.ListSecrets)
|
||||||
secretRoutes.POST("/retrieveMultiple", controllers.RetrieveMultpleSecrets) // TODO is this still required?
|
secretRoutes.POST("/retrieveMultiple", controllers.RetrieveMultpleSecrets) // TODO is this still required?
|
||||||
secretRoutes.POST("/store", controllers.StoreSecret)
|
secretRoutes.POST("/store", controllers.StoreSecret) // TODO deprecate, replace store with add
|
||||||
|
secretRoutes.POST("/add", controllers.StoreSecret)
|
||||||
|
|
||||||
secretRoutes.POST("/update", controllers.UpdateSecret)
|
secretRoutes.POST("/update", controllers.UpdateSecret)
|
||||||
// TODO
|
// TODO
|
||||||
secretRoutes.POST("/delete", controllers.DeleteSecret)
|
secretRoutes.POST("/delete", controllers.DeleteSecret)
|
||||||
|
Reference in New Issue
Block a user