| 362 | var _ net.RoundTripperWrapper = &conditionalTransport{} |
| 363 | |
| 364 | func (t *conditionalTransport) RoundTrip(req *http.Request) (*http.Response, error) { |
| 365 | if len(req.Header.Get("Authorization")) != 0 { |
| 366 | return t.oauthTransport.Base.RoundTrip(req) |
| 367 | } |
| 368 | |
| 369 | res, err := t.oauthTransport.RoundTrip(req) |
| 370 | |
| 371 | if err != nil { |
| 372 | return nil, err |
| 373 | } |
| 374 | |
| 375 | if res.StatusCode == 401 { |
| 376 | klog.V(4).Infof("The credentials that were supplied are invalid for the target cluster") |
| 377 | t.persister.Persist(t.resetCache) |
| 378 | } |
| 379 | |
| 380 | return res, nil |
| 381 | } |
| 382 | |
| 383 | func (t *conditionalTransport) WrappedRoundTripper() http.RoundTripper { return t.oauthTransport.Base } |