Skip to content

Commit

Permalink
Don't panic in CLI on nil auth URL response
Browse files Browse the repository at this point in the history
  • Loading branch information
Jim Kalafut committed Jun 19, 2019
1 parent 407df2d commit 0afdb03
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@ func (h *CLIHandler) Auth(c *api.Client, m map[string]string) (*api.Secret, erro
}

func fetchAuthURL(c *api.Client, role, mount, port string) (string, error) {
var authURL string

data := map[string]interface{}{
"role": role,
"redirect_uri": fmt.Sprintf("http://localhost:%s/oidc/callback", port),
Expand All @@ -116,7 +118,10 @@ func fetchAuthURL(c *api.Client, role, mount, port string) (string, error) {
return "", err
}

authURL := secret.Data["auth_url"].(string)
if secret != nil {
authURL = secret.Data["auth_url"].(string)
}

if authURL == "" {
return "", errors.New(fmt.Sprintf("Unable to authorize role %q. Check Vault logs for more information.", role))
}
Expand Down

0 comments on commit 0afdb03

Please sign in to comment.