Skip to content

Commit

Permalink
incus/remote: Forward OIDC auth failures
Browse files Browse the repository at this point in the history
Signed-off-by: Stéphane Graber <[email protected]>
  • Loading branch information
stgraber committed Jul 19, 2024
1 parent 0e8d559 commit 7cd606c
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion cmd/incus/remote_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,16 @@ func (t remoteProxyTransport) RoundTrip(r *http.Request) (*http.Response, error)
r.URL.Host = t.baseURL.Host
r.RequestURI = ""

return t.s.DoHTTP(r)
resp, err := t.s.DoHTTP(r)
if err == incus.ErrOIDCExpired {
// Override the response so the client knows to retry the request.
resp.StatusCode = http.StatusUseProxy
resp.Status = "Retry the request for OIDC refresh"

return resp, nil
}

return resp, err
}

type remoteProxyHandler struct {
Expand Down

0 comments on commit 7cd606c

Please sign in to comment.