[#1186] cli: Make owner field optional for bearer token
All checks were successful
DCO action / DCO (pull_request) Successful in 11m13s
Vulncheck / Vulncheck (pull_request) Successful in 16m3s
Build / Build Components (1.21) (pull_request) Successful in 18m0s
Build / Build Components (1.22) (pull_request) Successful in 18m8s
Pre-commit hooks / Pre-commit (pull_request) Successful in 55m7s
Tests and linters / Lint (pull_request) Successful in 4m4s
Tests and linters / gopls check (pull_request) Successful in 4m7s
Tests and linters / Staticcheck (pull_request) Successful in 4m13s
Tests and linters / Tests (1.21) (pull_request) Successful in 8m15s
Tests and linters / Tests with -race (pull_request) Successful in 8m24s
Tests and linters / Tests (1.22) (pull_request) Successful in 9m1s
All checks were successful
DCO action / DCO (pull_request) Successful in 11m13s
Vulncheck / Vulncheck (pull_request) Successful in 16m3s
Build / Build Components (1.21) (pull_request) Successful in 18m0s
Build / Build Components (1.22) (pull_request) Successful in 18m8s
Pre-commit hooks / Pre-commit (pull_request) Successful in 55m7s
Tests and linters / Lint (pull_request) Successful in 4m4s
Tests and linters / gopls check (pull_request) Successful in 4m7s
Tests and linters / Staticcheck (pull_request) Successful in 4m13s
Tests and linters / Tests (1.21) (pull_request) Successful in 8m15s
Tests and linters / Tests with -race (pull_request) Successful in 8m24s
Tests and linters / Tests (1.22) (pull_request) Successful in 9m1s
Signed-off-by: Airat Arifullin <a.arifullin@yadro.com>
This commit is contained in:
parent
5b100699d7
commit
76154c21d6
1 changed files with 6 additions and 7 deletions
|
@ -67,7 +67,6 @@ func init() {
|
|||
_ = cobra.MarkFlagFilename(createCmd.Flags(), apeFlag)
|
||||
|
||||
_ = cobra.MarkFlagRequired(createCmd.Flags(), commonflags.ExpireAt)
|
||||
_ = cobra.MarkFlagRequired(createCmd.Flags(), ownerFlag)
|
||||
_ = cobra.MarkFlagRequired(createCmd.Flags(), outFlag)
|
||||
}
|
||||
|
||||
|
@ -108,16 +107,16 @@ func createToken(cmd *cobra.Command, _ []string) {
|
|||
fmt.Errorf("expiration epoch is less than not-valid-before epoch: %d < %d", exp, nvb))
|
||||
}
|
||||
|
||||
ownerStr, _ := cmd.Flags().GetString(ownerFlag)
|
||||
|
||||
var ownerID user.ID
|
||||
commonCmd.ExitOnErr(cmd, "can't parse recipient: %w", ownerID.DecodeString(ownerStr))
|
||||
|
||||
var b bearer.Token
|
||||
b.SetExp(exp)
|
||||
b.SetNbf(nvb)
|
||||
b.SetIat(iat)
|
||||
|
||||
if ownerStr, _ := cmd.Flags().GetString(ownerFlag); ownerStr != "" {
|
||||
var ownerID user.ID
|
||||
commonCmd.ExitOnErr(cmd, "can't parse recipient: %w", ownerID.DecodeString(ownerStr))
|
||||
b.ForUser(ownerID)
|
||||
}
|
||||
|
||||
impersonate, _ := cmd.Flags().GetBool(impersonateFlag)
|
||||
b.SetImpersonate(impersonate)
|
||||
|
|
Loading…
Reference in a new issue