Make adds authentication headers to the passed in request and then calls the wrapped connection's Make. If the client is not set on the wrapper, it will not add any header or handle any authentication errors.
(request *cfnetworking.Request, passedResponse *cfnetworking.Response)
| 55 | // wrapped connection's Make. If the client is not set on the wrapper, it will |
| 56 | // not add any header or handle any authentication errors. |
| 57 | func (t *UAAAuthentication) Make(request *cfnetworking.Request, passedResponse *cfnetworking.Response) error { |
| 58 | request.Header.Set("Authorization", t.cache.AccessToken()) |
| 59 | |
| 60 | requestErr := t.connection.Make(request, passedResponse) |
| 61 | if _, ok := requestErr.(networkerror.InvalidAuthTokenError); ok { |
| 62 | tokens, err := t.client.RefreshAccessToken(t.cache.RefreshToken()) |
| 63 | if err != nil { |
| 64 | return err |
| 65 | } |
| 66 | |
| 67 | t.cache.SetAccessToken(tokens.AuthorizationToken()) |
| 68 | t.cache.SetRefreshToken(tokens.RefreshToken) |
| 69 | |
| 70 | if request.Body != nil { |
| 71 | err = request.ResetBody() |
| 72 | if err != nil { |
| 73 | return err |
| 74 | } |
| 75 | } |
| 76 | request.Header.Set("Authorization", t.cache.AccessToken()) |
| 77 | requestErr = t.connection.Make(request, passedResponse) |
| 78 | } |
| 79 | |
| 80 | return requestErr |
| 81 | } |
nothing calls this directly
no test coverage detected