AuthURL returns the targeted CredHub server's trusted authentication server URL.
()
| 31 | |
| 32 | // AuthURL returns the targeted CredHub server's trusted authentication server URL. |
| 33 | func (ch *CredHub) AuthURL() (string, error) { |
| 34 | if ch.authURL != nil { |
| 35 | return ch.authURL.String(), nil |
| 36 | } |
| 37 | |
| 38 | info, err := ch.Info() |
| 39 | |
| 40 | if err != nil { |
| 41 | return "", err |
| 42 | } |
| 43 | |
| 44 | authURL := info.AuthServer.URL |
| 45 | |
| 46 | if authURL == "" { |
| 47 | return "", errors.New("AuthURL not found") |
| 48 | } |
| 49 | |
| 50 | return authURL, nil |
| 51 | } |