Upstream sync

This commit is contained in:
Senad Uka
2023-09-18 12:27:40 +02:00
parent 9750aa2c37
commit 1f30f85787
30 changed files with 309 additions and 150 deletions

View File

@@ -20,4 +20,4 @@ func CORSMiddleware() gin.HandlerFunc {
c.Next()
}
}
}

View File

@@ -5,9 +5,9 @@
package middlewares
import (
"strings"
"github.com/gin-gonic/gin"
"github.com/dgrijalva/jwt-go"
"github.com/gin-gonic/gin"
"strings"
"time"
)
@@ -83,7 +83,7 @@ func GenerateToken(key []byte, userId string, username string, roles []string) (
claims := make(jwt.MapClaims)
claims["user_id"] = userId
claims["username"] = username
claims["exp"]=time.Now().Add(time.Hour * 72).UnixNano() / int64(time.Millisecond)
claims["exp"] = time.Now().Add(time.Hour*72).UnixNano() / int64(time.Millisecond)
//Set user roles
claims["roles"] = roles
@@ -102,4 +102,3 @@ func ValidateToken(tokenString string, key string) (*jwt.Token, error) {
return token, err
}