Skip to content

Commit

Permalink
put the if in the wrong location
Browse files Browse the repository at this point in the history
  • Loading branch information
dovholuknf committed Aug 30, 2024
1 parent 24571e2 commit 9d6ab91
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
5 changes: 5 additions & 0 deletions zsshlib/authenticate.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
3 changes: 0 additions & 3 deletions zsshlib/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion zsshlib/ssh.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 9d6ab91

Please sign in to comment.