diff options
| author | James Elliott <james-d-elliott@users.noreply.github.com> | 2023-04-08 14:48:55 +1000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-04-08 14:48:55 +1000 |
| commit | 2dcfc0b04c3fbe57ecc11322487089bc8970e79f (patch) | |
| tree | 54538032cbe1cdd9220d1418251d1c848c987519 /internal/handlers/handler_authz_impl_forwardauth.go | |
| parent | fa250ea7ddb902132f4df74c407be84015577fa3 (diff) | |
feat(handlers): authz authrequest authelia url (#5181)
This adjusts the AuthRequest Authz implementation behave similarly to the other implementations in as much as Authelia can return the relevant redirection to the proxy and the proxy just utilizes it if possible. In addition it swaps the HAProxy examples over to the ForwardAuth implementation as that's now supported.
Signed-off-by: James Elliott <james-d-elliott@users.noreply.github.com>
Diffstat (limited to 'internal/handlers/handler_authz_impl_forwardauth.go')
| -rw-r--r-- | internal/handlers/handler_authz_impl_forwardauth.go | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/internal/handlers/handler_authz_impl_forwardauth.go b/internal/handlers/handler_authz_impl_forwardauth.go index a042c13bb..d385cf971 100644 --- a/internal/handlers/handler_authz_impl_forwardauth.go +++ b/internal/handlers/handler_authz_impl_forwardauth.go @@ -50,6 +50,12 @@ func handleAuthzUnauthorizedForwardAuth(ctx *middlewares.AutheliaCtx, authn *Aut } } - ctx.Logger.Infof("Access to %s (method %s) is not authorized to user %s, responding with status code %d with location redirect to %s", authn.Object.String(), authn.Method, authn.Username, statusCode, redirectionURL) - ctx.SpecialRedirect(redirectionURL.String(), statusCode) + ctx.Logger.Infof(logFmtAuthzRedirect, authn.Object.String(), authn.Method, authn.Username, statusCode, redirectionURL) + + switch authn.Object.Method { + case fasthttp.MethodHead: + ctx.SpecialRedirectNoBody(redirectionURL.String(), statusCode) + default: + ctx.SpecialRedirect(redirectionURL.String(), statusCode) + } } |
