1
0
mirror of https://github.com/smallstep/cli.git synced 2025-08-09 03:22:43 +03:00

Add console flag to ssh commands

This commit adds the `--console` flag to the following commands:
 * `step ssh certificate`
 * `step ssh config`
 * `step ssh hosts`
 * `step ssh login`
 * `step ssh proxycommand`
This commit is contained in:
Mariano Cano
2024-07-15 18:47:24 -07:00
parent 3b1e836af0
commit 2a6e644000
10 changed files with 21 additions and 23 deletions

View File

@@ -1,7 +1,6 @@
package oauth
import (
"bufio"
"bytes"
"crypto/sha256"
"crypto/x509"
@@ -901,11 +900,9 @@ func (o *oauth) DoDeviceAuthorization() (*token, error) {
idr.Interval = defaultDeviceAuthzInterval
}
fmt.Fprintf(os.Stderr, "Visit %s and enter the code: (press 'ENTER' to open default browser)\n", idr.VerificationURI)
fmt.Fprintf(os.Stderr, "Visit %s and enter the code:\n", idr.VerificationURI)
fmt.Fprintln(os.Stderr, idr.UserCode)
go openBrowserIfAsked(o, idr.VerificationURI)
// Poll the Token endpoint until the user completes the flow.
data = url.Values{}
data.Set("client_id", o.clientID)
@@ -939,13 +936,6 @@ func (o *oauth) DoDeviceAuthorization() (*token, error) {
}
}
func openBrowserIfAsked(o *oauth, u string) {
reader := bufio.NewReader(os.Stdin)
reader.ReadString('\n')
exec.OpenInBrowser(u, o.browser)
}
var errHTTPToken = errors.New("bad request; token not returned")
func (o *oauth) deviceAuthzTokenPoll(data url.Values) (*token, error) {