summaryrefslogtreecommitdiff
path: root/internal/handlers/handler_authz_impl_extauthz.go
diff options
context:
space:
mode:
authorJames Elliott <james-d-elliott@users.noreply.github.com>2023-04-08 14:48:55 +1000
committerGitHub <noreply@github.com>2023-04-08 14:48:55 +1000
commit2dcfc0b04c3fbe57ecc11322487089bc8970e79f (patch)
tree54538032cbe1cdd9220d1418251d1c848c987519 /internal/handlers/handler_authz_impl_extauthz.go
parentfa250ea7ddb902132f4df74c407be84015577fa3 (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_extauthz.go')
-rw-r--r--internal/handlers/handler_authz_impl_extauthz.go10
1 files changed, 8 insertions, 2 deletions
diff --git a/internal/handlers/handler_authz_impl_extauthz.go b/internal/handlers/handler_authz_impl_extauthz.go
index ccae832d9..67786a33d 100644
--- a/internal/handlers/handler_authz_impl_extauthz.go
+++ b/internal/handlers/handler_authz_impl_extauthz.go
@@ -50,6 +50,12 @@ func handleAuthzUnauthorizedExtAuthz(ctx *middlewares.AutheliaCtx, authn *Authn,
}
}
- 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)
+ }
}