瀏覽代碼

invalidate agent token on 403 as well (#1888)

blotus 2 年之前
父節點
當前提交
c5079ac15e
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1 1
      pkg/apiclient/auth.go

+ 1 - 1
pkg/apiclient/auth.go

@@ -194,7 +194,7 @@ func (t *JWTTransport) RoundTrip(req *http.Request) (*http.Response, error) {
 		dump, _ := httputil.DumpResponse(resp, true)
 		log.Tracef("resp-jwt: %s (err:%v)", string(dump), err)
 	}
-	if err != nil || resp.StatusCode == 401 {
+	if err != nil || resp.StatusCode == http.StatusForbidden || resp.StatusCode == http.StatusUnauthorized {
 		/*we had an error (network error for example, or 401 because token is refused), reset the token ?*/
 		t.token = ""
 		return resp, errors.Wrapf(err, "performing jwt auth")