mirror of
https://github.com/pomerium/pomerium.git
synced 2025-06-05 12:23:03 +02:00
pomerium-cli: add support for a custom browser command (#2617)
This commit is contained in:
parent
efffe57bf0
commit
a7442b1498
8 changed files with 58 additions and 17 deletions
|
@ -16,6 +16,7 @@ import (
|
|||
)
|
||||
|
||||
func init() {
|
||||
addBrowserFlags(kubernetesExecCredentialCmd)
|
||||
addTLSFlags(kubernetesExecCredentialCmd)
|
||||
kubernetesCmd.AddCommand(kubernetesExecCredentialCmd)
|
||||
kubernetesCmd.AddCommand(kubernetesFlushCredentialsCmd)
|
||||
|
@ -61,7 +62,9 @@ var kubernetesExecCredentialCmd = &cobra.Command{
|
|||
tlsConfig = getTLSConfig()
|
||||
}
|
||||
|
||||
ac := authclient.New(authclient.WithTLSConfig(tlsConfig))
|
||||
ac := authclient.New(
|
||||
authclient.WithBrowserCommand(browserOptions.command),
|
||||
authclient.WithTLSConfig(tlsConfig))
|
||||
rawJWT, err := ac.GetJWT(context.Background(), serverURL)
|
||||
if err != nil {
|
||||
fatalf("%s", err)
|
||||
|
|
|
@ -57,3 +57,13 @@ func getTLSConfig() *tls.Config {
|
|||
}
|
||||
return cfg
|
||||
}
|
||||
|
||||
var browserOptions struct {
|
||||
command string
|
||||
}
|
||||
|
||||
func addBrowserFlags(cmd *cobra.Command) {
|
||||
flags := cmd.Flags()
|
||||
flags.StringVar(&browserOptions.command, "browser-cmd", "",
|
||||
"custom browser command to run when opening a URL")
|
||||
}
|
||||
|
|
|
@ -87,6 +87,7 @@ var tcpCmd = &cobra.Command{
|
|||
}()
|
||||
|
||||
tun := tcptunnel.New(
|
||||
tcptunnel.WithBrowserCommand(browserOptions.command),
|
||||
tcptunnel.WithDestinationHost(dstHost),
|
||||
tcptunnel.WithProxyHost(pomeriumURL.Host),
|
||||
tcptunnel.WithTLSConfig(tlsConfig),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue