@@ -401,7 +401,7 @@ func createClient(endpoints []string, certCA *x509.CertPool, auth connection.Aut
401
401
}
402
402
403
403
// getJWTTokenFromSecrets returns token from the secret.
404
- func getJWTTokenFromSecrets (ctx context.Context , secrets generic.ReadClient [* core.Secret ], name string ) (connection.Authentication , error ) {
404
+ func getJWTTokenFromSecrets (ctx context.Context , secrets generic.ReadClient [* core.Secret ], name string , paths ... string ) (connection.Authentication , error ) {
405
405
ctxChild , cancel := globals .GetGlobalTimeouts ().Kubernetes ().WithTimeout (ctx )
406
406
defer cancel ()
407
407
@@ -410,11 +410,16 @@ func getJWTTokenFromSecrets(ctx context.Context, secrets generic.ReadClient[*cor
410
410
return nil , errors .WithMessage (err , fmt .Sprintf ("failed to get secret \" %s\" " , name ))
411
411
}
412
412
413
- authz , err := token .NewClaims ().With (
413
+ claims := token .NewClaims ().With (
414
414
token .WithDefaultClaims (),
415
415
token .WithServerID ("kube-arangodb" ),
416
- token .WithAllowedPaths ("/_api/version" ),
417
- ).Sign (secret )
416
+ )
417
+
418
+ if len (paths ) > 0 {
419
+ claims = claims .With (token .WithAllowedPaths (paths ... ))
420
+ }
421
+
422
+ authz , err := claims .Sign (secret )
418
423
if err != nil {
419
424
return nil , errors .WithMessage (err , fmt .Sprintf ("failed to create bearer token from secret \" %s\" " , name ))
420
425
}
0 commit comments