mirror of
https://github.com/pomerium/pomerium.git
synced 2025-04-29 18:36:30 +02:00
authorize: allow redirects on deny (#2361)
This commit is contained in:
parent
b4b86dccb4
commit
360aa89505
1 changed files with 6 additions and 5 deletions
|
@ -67,11 +67,12 @@ func (a *Authorize) Check(ctx context.Context, in *envoy_service_auth_v3.CheckRe
|
||||||
a.logAuthorizeCheck(ctx, in, out, res, s, u)
|
a.logAuthorizeCheck(ctx, in, out, res, s, u)
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
denyStatusCode := int32(http.StatusForbidden)
|
||||||
|
denyStatusText := http.StatusText(http.StatusForbidden)
|
||||||
if res.Deny != nil {
|
if res.Deny != nil {
|
||||||
return a.deniedResponse(ctx, in, int32(res.Deny.Status), res.Deny.Message, nil)
|
denyStatusCode = int32(res.Deny.Status)
|
||||||
}
|
denyStatusText = res.Deny.Message
|
||||||
|
} else if res.Allow {
|
||||||
if res.Allow {
|
|
||||||
return a.okResponse(res), nil
|
return a.okResponse(res), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -81,7 +82,7 @@ func (a *Authorize) Check(ctx context.Context, in *envoy_service_auth_v3.CheckRe
|
||||||
|
|
||||||
// if we're logged in, don't redirect, deny with forbidden
|
// if we're logged in, don't redirect, deny with forbidden
|
||||||
if req.Session.ID != "" {
|
if req.Session.ID != "" {
|
||||||
return a.deniedResponse(ctx, in, http.StatusForbidden, http.StatusText(http.StatusForbidden), nil)
|
return a.deniedResponse(ctx, in, denyStatusCode, denyStatusText, nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
return a.requireLoginResponse(ctx, in)
|
return a.requireLoginResponse(ctx, in)
|
||||||
|
|
Loading…
Add table
Reference in a new issue