Skip to content

Commit 62394b8

Browse files
cloud-j-lunatroian
authored andcommitted
fix: JWT CLI scopes documentation missing scopes
1 parent 5e18bd5 commit 62394b8

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

cmd/akash/cmd/auth.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package cmd
33
import (
44
"fmt"
55
"strconv"
6+
"strings"
67
"time"
78

89
"github.com/golang-jwt/jwt/v5"
@@ -145,7 +146,7 @@ func authJWTCmd() *cobra.Command {
145146
cmd.Flags().String(FlagJWTExp, "15m", "Set token's `exp` field. Format is either 15m|h or unix timestamp")
146147
cmd.Flags().String(FlagJWTNbf, "", "Set token's `nbf` field. Format is either 15m|h or unix timestamp. Empty equals to current timestamp")
147148
cmd.Flags().String(FlagJWTAccess, "full", "Set token's `leases.access` field. Permitted values are full|scoped|granular. Default is full")
148-
cmd.Flags().StringSlice(FlagJWTScope, nil, "Set token's `leases.scope` field. Comma separated list of scopes. Can only be set if `leases.access=scoped`. Allowed scopes are")
149+
cmd.Flags().StringSlice(FlagJWTScope, nil, fmt.Sprintf("Set token's `leases.scope` field. Comma separated list of scopes. Can only be set if `leases.access=scoped`. Allowed scopes are (%s)", strings.Join(permissionScopesToStrings(ajwt.GetSupportedScopes()), "|")))
149150

150151
return cmd
151152
}
@@ -163,3 +164,11 @@ func parseAccess(val string) (ajwt.AccessType, bool) {
163164

164165
return res, true
165166
}
167+
168+
func permissionScopesToStrings(scopes ajwt.PermissionScopes) []string {
169+
result := make([]string, len(scopes))
170+
for i, scope := range scopes {
171+
result[i] = string(scope)
172+
}
173+
return result
174+
}

0 commit comments

Comments
 (0)