Skip to content

Commit

Permalink
Make invalidAuthorization return an error if the last request was a…
Browse files Browse the repository at this point in the history
…n error status code.

Signed-off-by: Corey Larson <corey@earthly.dev>
  • Loading branch information
dchw committed Apr 7, 2021
1 parent 35c5e37 commit 92d21ff
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions util/resolver/authorizer.go
Original file line number Diff line number Diff line change
Expand Up @@ -415,6 +415,11 @@ func (ah *authHandler) fetchToken(ctx context.Context, sm *session.Manager, g se
}

func invalidAuthorization(c auth.Challenge, responses []*http.Response) error {
lastResponse := responses[len(responses)-1]
if lastResponse.StatusCode >= http.StatusBadRequest {
return errors.Wrapf(docker.ErrInvalidAuthorization, "authorization status: %v", lastResponse.StatusCode)
}

errStr := c.Parameters["error"]
if errStr == "" {
return nil
Expand Down

0 comments on commit 92d21ff

Please sign in to comment.