Skip to content

Commit

Permalink
fix(app): don't auto SSO if no profiles
Browse files Browse the repository at this point in the history
  • Loading branch information
Integralist committed Nov 14, 2023
1 parent 5160d5d commit a26ed51
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 7 additions & 0 deletions pkg/app/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,13 @@ func processToken(cmds []cmd.Command, commandName string, data *global.Data) (to
// If there's no token available, and we need one for the invoked command,
// then we'll trigger the SSO authentication flow.
if tokenSource == lookup.SourceUndefined && commandRequiresToken(commandName) {
// FIXME: Remove this conditional when SSO is GA.
// Once put back, it means "no token" == "automatic SSO".
// For now, a brand new CLI user will have to manually create long-lived
// tokens via the UI in order to use the Fastly CLI.
if data.Env.UseSSO != "1" && !data.Flags.SSO {
return "", nil
}
token, tokenSource, err = ssoAuthentication(tokenSource, token, warningMessage, cmds, data)
if err != nil {
return token, fmt.Errorf("failed to check profile token: %w", err)
Expand Down
2 changes: 1 addition & 1 deletion pkg/commands/sso/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ type RootCommand struct {
func NewRootCommand(parent cmd.Registerer, g *global.Data) *RootCommand {
var c RootCommand
c.Globals = g
// FIXME: Unhide this command once SSO authentication goes GA.
// FIXME: Unhide this command once SSO is GA.
c.CmdClause = parent.Command("sso", "Single Sign-On authentication").Hidden()
c.CmdClause.Arg("profile", "Profile to authenticate (i.e. create/update a token for)").Short('p').StringVar(&c.profile)
return &c
Expand Down

0 comments on commit a26ed51

Please sign in to comment.