Merge pull request #2062 from earthly/corey/fix-stale-tokens

Remove potentially expired tokens
v0.9
Tõnis Tiigi 2021-04-26 09:10:46 -07:00 committed by GitHub
commit aa8c1baeec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 0 deletions

View File

@ -400,6 +400,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.StatusUnauthorized {
return errors.Wrapf(docker.ErrInvalidAuthorization, "authorization status: %v", lastResponse.StatusCode)
}
errStr := c.Parameters["error"]
if errStr == "" {
return nil