authorize: fix nginx infinite redirect (#2812)

This commit is contained in:
Caleb Doxsey 2021-12-08 15:10:52 -07:00 committed by GitHub
parent 9eccefbece
commit 8778097bb9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -76,15 +76,15 @@ func (a *Authorize) Check(ctx context.Context, in *envoy_service_auth_v3.CheckRe
return a.okResponse(res), nil
}
if isForwardAuth && hreq.URL.Path == "/verify" {
return a.deniedResponse(ctx, in, http.StatusUnauthorized, "Unauthenticated", nil)
}
// if we're logged in, don't redirect, deny with forbidden
if req.Session.ID != "" {
return a.deniedResponse(ctx, in, denyStatusCode, denyStatusText, nil)
}
if isForwardAuth && hreq.URL.Path == "/verify" {
return a.deniedResponse(ctx, in, http.StatusUnauthorized, "Unauthenticated", nil)
}
return a.requireLoginResponse(ctx, in)
}