You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: auth.go
+46-6Lines changed: 46 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -26,6 +26,7 @@ import (
26
26
"fmt"
27
27
"io/ioutil"
28
28
"strings"
29
+
"time"
29
30
30
31
"github.com/spf13/cobra"
31
32
@@ -34,9 +35,10 @@ import (
34
35
35
36
var (
36
37
cmdAuth=&cobra.Command{
37
-
Use: "auth",
38
-
Short: "ArangoDB authentication helper commands",
39
-
Run: cmdShowUsage,
38
+
Use: "auth",
39
+
Short: "ArangoDB authentication helper commands",
40
+
PersistentPreRunE: persistentAuthPreFunE,
41
+
Run: cmdShowUsage,
40
42
}
41
43
cmdAuthHeader=&cobra.Command{
42
44
Use: "header",
@@ -52,7 +54,8 @@ var (
52
54
jwtSecretFilestring
53
55
userstring
54
56
paths []string
55
-
expint64
57
+
expstring
58
+
expDuration time.Duration
56
59
}
57
60
)
58
61
@@ -65,7 +68,7 @@ func init() {
65
68
pf.StringVar(&authOptions.jwtSecretFile, "auth.jwt-secret", "", "name of a plain text file containing a JWT secret used for server authentication")
66
69
pf.StringVar(&authOptions.user, "auth.user", "", "name of a user to authenticate as. If empty, 'super-user' authentication is used")
67
70
pf.StringSliceVar(&authOptions.paths, "auth.paths", nil, "a list of allowed pathes. The path must not include the '_db/DBNAME' prefix.")
68
-
pf.Int64Var(&authOptions.exp, "auth.exp", 0, "an expiry date in seconds since epoche")
71
+
pf.StringVar(&authOptions.exp, "auth.exp", "", "a time in which token should expire - based on current time in UTC. Supported units: h, m, s (default)")
69
72
}
70
73
71
74
// mustAuthCreateJWTToken creates a the JWT token based on authentication options.
0 commit comments