MCPcopy Index your code
hub / github.com/cloudfoundry/cli / Make

Method Make

api/cfnetworking/wrapper/uaa_authentication.go:57–81  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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.
57func (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}

Callers

nothing calls this directly

Calls 9

AuthorizationTokenMethod · 0.80
SetMethod · 0.65
AccessTokenMethod · 0.65
MakeMethod · 0.65
RefreshAccessTokenMethod · 0.65
RefreshTokenMethod · 0.65
SetAccessTokenMethod · 0.65
SetRefreshTokenMethod · 0.65
ResetBodyMethod · 0.45

Tested by

no test coverage detected