getRefreshJwt constructs a refresh jwt with the given user id, namespace and expiration ttl specified by worker.Config.RefreshJwtTtl
(userId string, namespace uint64)
| 259 | // getRefreshJwt constructs a refresh jwt with the given user id, namespace and expiration ttl |
| 260 | // specified by worker.Config.RefreshJwtTtl |
| 261 | func getRefreshJwt(userId string, namespace uint64) (string, error) { |
| 262 | token := jwt.NewWithClaims(worker.Config.AclJwtAlg, jwt.MapClaims{ |
| 263 | "userid": userId, |
| 264 | "namespace": namespace, |
| 265 | "exp": time.Now().Add(worker.Config.RefreshJwtTtl).Unix(), |
| 266 | }) |
| 267 | |
| 268 | jwtString, err := token.SignedString(x.MaybeKeyToBytes(worker.Config.AclSecretKey)) |
| 269 | if err != nil { |
| 270 | return "", errors.Errorf("unable to encode jwt to string: %v", err) |
| 271 | } |
| 272 | return jwtString, nil |
| 273 | } |
| 274 | |
| 275 | const queryUser = ` |
| 276 | query search($userid: string, $password: string){ |