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 *cloudcontroller.Request, passedResponse *cloudcontroller.Response)
| 50 | // wrapped connection's Make. If the client is not set on the wrapper, it will |
| 51 | // not add any header or handle any authentication errors. |
| 52 | func (t *UAAAuthentication) Make(request *cloudcontroller.Request, passedResponse *cloudcontroller.Response) error { |
| 53 | if request.Header.Get("Authorization") == "" && (t.cache.AccessToken() != "" || t.cache.RefreshToken() != "") { |
| 54 | // assert a valid access token for authenticated requests |
| 55 | err := t.refreshTokenIfNecessary(t.cache.AccessToken()) |
| 56 | if nil != err { |
| 57 | return err |
| 58 | } |
| 59 | |
| 60 | request.Header.Set("Authorization", t.cache.AccessToken()) |
| 61 | } |
| 62 | |
| 63 | err := t.connection.Make(request, passedResponse) |
| 64 | return err |
| 65 | } |
| 66 | |
| 67 | // SetClient sets the UAA client that the wrapper will use. |
| 68 | func (t *UAAAuthentication) SetClient(client UAAClient) { |
nothing calls this directly
no test coverage detected