21617: Interpret any 4xx as token rejection, not an error.
authorTom Clegg <tom@curii.com>
Tue, 26 Mar 2024 02:30:10 +0000 (22:30 -0400)
committerTom Clegg <tom@curii.com>
Tue, 26 Mar 2024 14:00:39 +0000 (10:00 -0400)
Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tom@curii.com>

services/api/app/models/api_client_authorization.rb

index e41fa99a08c5d35695d4c23ae6682d5e2fdf3329..798d49817f6867568d801cde3eaf69854fecab17 100644 (file)
@@ -294,8 +294,8 @@ class ApiClientAuthorization < ArvadosModel
         raise "remote cluster #{upstream_cluster_id} returned invalid token uuid #{token_uuid.inspect}"
       end
     rescue HTTPClient::BadResponseError => e
-      if e.res.status_code == 401
-        # Token is not valid.
+      if e.res.status_code >= 400 && e.res.status_code < 500
+        # Remote cluster does not accept this token.
         return nil
       end
       # CurrentApiToken#call and ApplicationController#render_error will