feat: refac and add key deletion route

This commit is contained in:
2026-04-29 14:46:24 +02:00
parent 8f6b1efea0
commit 6669fda371
11 changed files with 177 additions and 84 deletions
+2 -2
View File
@@ -42,7 +42,7 @@ func AuthMiddleware() gin.HandlerFunc {
return func(c *gin.Context) {
authorizationHeader := c.GetHeader("Authorization")
if len(authorizationHeader) == 0 {
c.AbortWithStatusJSON(http.StatusUnauthorized, assets.BasicResponse{
c.AbortWithStatusJSON(http.StatusUnauthorized, assets.ResponseObject{
Msg: "Authorization header is required",
})
return
@@ -52,7 +52,7 @@ func AuthMiddleware() gin.HandlerFunc {
// The header must be a specific format, 0 being the bearer text and 1 being the token itself, making it 2 pieces total
// In the following if statement we verify both parts if the part after Bearer is empty its only 1 part for example
if len(headerParts) != 2 || headerParts[0] != "Bearer" {
c.AbortWithStatusJSON(http.StatusUnauthorized, assets.BasicResponse{
c.AbortWithStatusJSON(http.StatusUnauthorized, assets.ResponseObject{
Msg: "Authorization header is invalid",
})
return