summaryrefslogtreecommitdiffstats
path: root/cmd/serv.go
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/serv.go')
-rw-r--r--cmd/serv.go8
1 files changed, 6 insertions, 2 deletions
diff --git a/cmd/serv.go b/cmd/serv.go
index d7fe6c6630..0326656f2a 100644
--- a/cmd/serv.go
+++ b/cmd/serv.go
@@ -259,12 +259,16 @@ func runServ(c *cli.Context) error {
url := fmt.Sprintf("%s%s/%s.git/info/lfs", setting.AppURL, username, repo.Name)
now := time.Now()
- token := jwt.NewWithClaims(jwt.SigningMethodHS256, jwt.MapClaims{
+ claims := jwt.MapClaims{
"repo": repo.ID,
"op": lfsVerb,
"exp": now.Add(5 * time.Minute).Unix(),
"nbf": now.Unix(),
- })
+ }
+ if user != nil {
+ claims["user"] = user.ID
+ }
+ token := jwt.NewWithClaims(jwt.SigningMethodHS256, claims)
// Sign and get the complete encoded token as a string using the secret
tokenString, err := token.SignedString(setting.LFS.JWTSecretBytes)