(ctx context.Context)
| 169 | } |
| 170 | |
| 171 | func (a *CliAuthenticator) RemoveAuth(ctx context.Context) error { |
| 172 | authConfig, err := existingAuth(ctx) |
| 173 | if err != nil { |
| 174 | return errors.Wrapf(ctx, err, "get authentication config for removal") |
| 175 | } |
| 176 | |
| 177 | var c auth.ConfigPerHostV2 |
| 178 | err = json.Unmarshal(authConfig.AuthConfigPerHost, &c) |
| 179 | if err != nil { |
| 180 | return errors.Wrapf(ctx, err, "unmarshal authentication config per host") |
| 181 | } |
| 182 | |
| 183 | authHost, err := a.authHost(ctx) |
| 184 | if err != nil { |
| 185 | return errors.Wrapf(ctx, err, "get authentication service host") |
| 186 | } |
| 187 | |
| 188 | delete(c, authHost) |
| 189 | |
| 190 | buffer, err := json.Marshal(&c) |
| 191 | if err != nil { |
| 192 | return errors.Wrapf(ctx, err, "marshal cleaned authentication config") |
| 193 | } |
| 194 | |
| 195 | authConfig.AuthConfigPerHost = json.RawMessage(buffer) |
| 196 | return writeAuthFile(ctx, authConfig) |
| 197 | } |
| 198 | |
| 199 | func (a *CliAuthenticator) authHost(ctx context.Context) (string, error) { |
| 200 | u, err := url.Parse(C.ScalingoAuthURL) |
no test coverage detected