TUN-8871: Accept login flag to authenticate with Fedramp environment
## Summary Some description... Closes TUN-8871
This commit is contained in:
parent
25c3f676f4
commit
8918b6729e
|
@ -20,7 +20,31 @@ import (
|
||||||
|
|
||||||
const (
|
const (
|
||||||
baseLoginURL = "https://dash.cloudflare.com/argotunnel"
|
baseLoginURL = "https://dash.cloudflare.com/argotunnel"
|
||||||
callbackStoreURL = "https://login.cloudflareaccess.org/"
|
callbackURL = "https://login.cloudflareaccess.org/"
|
||||||
|
// For now these are the same but will change in the future once we know which URLs to use (TUN-8872)
|
||||||
|
fedBaseLoginURL = "https://dash.cloudflare.com/argotunnel"
|
||||||
|
fedCallbackStoreURL = "https://login.cloudflareaccess.org/"
|
||||||
|
fedRAMPParamName = "fedramp"
|
||||||
|
loginURLParamName = "loginURL"
|
||||||
|
callbackURLParamName = "callbackURL"
|
||||||
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
loginURL = &cli.StringFlag{
|
||||||
|
Name: loginURLParamName,
|
||||||
|
Value: baseLoginURL,
|
||||||
|
Usage: "The URL used to login (default is https://dash.cloudflare.com/argotunnel)",
|
||||||
|
}
|
||||||
|
callbackStore = &cli.StringFlag{
|
||||||
|
Name: callbackURLParamName,
|
||||||
|
Value: callbackURL,
|
||||||
|
Usage: "The URL used for the callback (default is https://login.cloudflareaccess.org/)",
|
||||||
|
}
|
||||||
|
fedramp = &cli.BoolFlag{
|
||||||
|
Name: fedRAMPParamName,
|
||||||
|
Aliases: []string{"f"},
|
||||||
|
Usage: "Login with FedRAMP High environment.",
|
||||||
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
func buildLoginSubcommand(hidden bool) *cli.Command {
|
func buildLoginSubcommand(hidden bool) *cli.Command {
|
||||||
|
@ -30,6 +54,11 @@ func buildLoginSubcommand(hidden bool) *cli.Command {
|
||||||
Usage: "Generate a configuration file with your login details",
|
Usage: "Generate a configuration file with your login details",
|
||||||
ArgsUsage: " ",
|
ArgsUsage: " ",
|
||||||
Hidden: hidden,
|
Hidden: hidden,
|
||||||
|
Flags: []cli.Flag{
|
||||||
|
loginURL,
|
||||||
|
callbackStore,
|
||||||
|
fedramp,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,9 +73,18 @@ func login(c *cli.Context) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
loginURL, err := url.Parse(baseLoginURL)
|
var (
|
||||||
|
baseloginURL = c.String(loginURLParamName)
|
||||||
|
callbackStoreURL = c.String(callbackURLParamName)
|
||||||
|
)
|
||||||
|
|
||||||
|
if c.Bool(fedRAMPParamName) {
|
||||||
|
baseloginURL = fedBaseLoginURL
|
||||||
|
callbackStoreURL = fedCallbackStoreURL
|
||||||
|
}
|
||||||
|
|
||||||
|
loginURL, err := url.Parse(baseloginURL)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// shouldn't happen, URL is hardcoded
|
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue