mirror of
https://github.com/pomerium/pomerium.git
synced 2025-04-29 10:26:29 +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)
|
||||
}()
|
||||
|
||||
denyStatusCode := int32(http.StatusForbidden)
|
||||
denyStatusText := http.StatusText(http.StatusForbidden)
|
||||
if res.Deny != nil {
|
||||
return a.deniedResponse(ctx, in, int32(res.Deny.Status), res.Deny.Message, nil)
|
||||
}
|
||||
|
||||
if res.Allow {
|
||||
denyStatusCode = int32(res.Deny.Status)
|
||||
denyStatusText = res.Deny.Message
|
||||
} else if res.Allow {
|
||||
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 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)
|
||||
|
|
Loading…
Add table
Reference in a new issue