* Use the intercepted token if present, use it through the keyring if keyring contains it
* fixup! Use the intercepted token if present, use it through the keyring if keyring contains it
* Apply suggestions from code review
Co-authored-by: Jim <jlambert@hashicorp.com>
---------
Co-authored-by: Jim <jlambert@hashicorp.com>
@ -25,6 +25,9 @@ func saveAndOrPrintToken(c *base.Command, result *authmethods.AuthenticateResult
returnbase.CommandCliError
}
opts:=base.GetOpts(opt...)
ifopts.WithInterceptedToken!=nil{
*opts.WithInterceptedToken=token.Token
}
switchbase.Format(c.UI){
case"table":
@ -98,18 +101,10 @@ func saveAndOrPrintToken(c *base.Command, result *authmethods.AuthenticateResult
switch{
casegotErr:
c.UI.Warn(fmt.Sprintf("The token was not successfully saved to a system keyring. The token is:\n\n%s\n\nIt must be manually passed in via the BOUNDARY_TOKEN env var or -token flag. Storing the token can also be disabled via -keyring-type=none.",token.Token))
ifopts.WithInterceptedToken!=nil{
*opts.WithInterceptedToken=token.Token
}
casec.FlagKeyringType=="none":
c.UI.Warn("\nStoring the token in a keyring was disabled. The token is:")