]> git.immae.eu Git - perso/Immae/Projets/Cryptomonnaies/Cryptoportfolio/Front.git/blobdiff - api/auth_jwt.go
Better go import paths.
[perso/Immae/Projets/Cryptomonnaies/Cryptoportfolio/Front.git] / api / auth_jwt.go
index f713f4e9be9ef710da6f14e881a6db5f85a67c24..88ccda84bd161e133b9c59ff3cf0c1f094510f76 100644 (file)
@@ -5,7 +5,7 @@ import (
        "strings"
        "time"
 
-       "immae.eu/Immae/Projets/Cryptomonnaies/Cryptoportfolio/Front/db"
+       "git.immae.eu/Cryptoportfolio/Front.git/db"
 
        "github.com/dgrijalva/jwt-go"
        "github.com/gin-gonic/gin"
@@ -20,10 +20,6 @@ type JwtClaims struct {
        jwt.StandardClaims
 }
 
-func SetJwtSecretKey(secret string) {
-       JWT_SECRET = []byte(secret)
-}
-
 func VerifyJwtToken(token string) (JwtClaims, error) {
        if len(JWT_SECRET) == 0 {
                return JwtClaims{}, fmt.Errorf("not initialized jwt secret")
@@ -61,7 +57,7 @@ func CreateJwtToken(userId int64) (string, error) {
                false,
                userId,
                jwt.StandardClaims{
-                       ExpiresAt: time.Now().Add(time.Hour * 24).Unix(),
+                       ExpiresAt: time.Now().Add(time.Hour * 24 * 7).Unix(),
                },
        }