From 9d6ab919022fd471b43fc682c798108e70018dc4 Mon Sep 17 00:00:00 2001 From: dovholuknf <46322585+dovholuknf@users.noreply.github.com> Date: Fri, 30 Aug 2024 08:21:37 -0400 Subject: [PATCH] put the if in the wrong location --- zsshlib/authenticate.go | 5 +++++ zsshlib/flags.go | 3 --- zsshlib/ssh.go | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/zsshlib/authenticate.go b/zsshlib/authenticate.go index 96de6a5..36808c8 100644 --- a/zsshlib/authenticate.go +++ b/zsshlib/authenticate.go @@ -16,6 +16,11 @@ import ( func NewContext(flags *SshFlags, enableMfaListener bool) ziti.Context { oidcToken := "" var oidcErr error + + if flags.OIDC.OIDCOnly && !flags.OIDC.Mode { + flags.OIDC.Mode = true //override Mode to true + } + if flags.OIDC.Mode { oidcToken, oidcErr = OIDCFlow(context.Background(), flags) if oidcErr != nil { diff --git a/zsshlib/flags.go b/zsshlib/flags.go index 48b0162..5ca6e99 100644 --- a/zsshlib/flags.go +++ b/zsshlib/flags.go @@ -100,9 +100,6 @@ func (f *SshFlags) OIDCFlags(cmd *cobra.Command) { cmd.Flags().BoolVarP(&f.OIDC.Mode, "oidc", "o", false, fmt.Sprintf("toggle OIDC mode. default: %t", defaults.OIDC.Enabled)) cmd.Flags().BoolVar(&f.OIDC.OIDCOnly, "oidcOnly", false, "toggle OIDC only mode. default: false") cmd.Flags().StringVar(&f.OIDC.ControllerUrl, "controllerUrl", "", "the url of the controller to use. only used with --oidcOnly") - if f.OIDC.OIDCOnly { - f.OIDC.Mode = true - } } func (f *SshFlags) AddCommonFlags(cmd *cobra.Command) { diff --git a/zsshlib/ssh.go b/zsshlib/ssh.go index 97e47c7..06ade2e 100644 --- a/zsshlib/ssh.go +++ b/zsshlib/ssh.go @@ -364,7 +364,7 @@ func RetrieveRemoteFiles(client *sftp.Client, localPath string, remotePath strin func EstablishClient(f *SshFlags, target string, targetIdentity string) *ssh.Client { ctx := NewContext(f, true) Auth(ctx) - + _, ok := ctx.GetService(f.ServiceName) if !ok { logrus.Fatalf("service not found: %s", f.ServiceName)