feat: add option to disable auth module fallbacks

This commit is contained in:
Stavros
2026-08-21 13:26:02 +03:00
parent 75c7aad40e
commit cf5d5cab6e
3 changed files with 17 additions and 3 deletions
+2
View File
@@ -227,6 +227,8 @@ TINYAUTH_LDAP_GROUPCACHETTL=900
# Enable the OAuth bridge, uses a new way to format OAuth user information. # Enable the OAuth bridge, uses a new way to format OAuth user information.
TINYAUTH_EXPERIMENTAL_OAUTHBRIDGEENABLED=false TINYAUTH_EXPERIMENTAL_OAUTHBRIDGEENABLED=false
# Disable the fallback to forward_auth modules when auth_request or ext_authz fail.
TINYAUTH_EXPERIMENTAL_DISABLEAUTHMODULEFALLBACK=false
# tailscale config # tailscale config
+13 -2
View File
@@ -57,6 +57,7 @@ type ProxyContext struct {
type ProxyController struct { type ProxyController struct {
log *logger.Logger log *logger.Logger
runtime *model.RuntimeConfig runtime *model.RuntimeConfig
config *model.Config
acls *service.AccessControlsService acls *service.AccessControlsService
auth *service.AuthService auth *service.AuthService
policyEngine *service.PolicyEngine policyEngine *service.PolicyEngine
@@ -67,6 +68,7 @@ type ProxyControllerInput struct {
Log *logger.Logger Log *logger.Logger
RuntimeConfig *model.RuntimeConfig RuntimeConfig *model.RuntimeConfig
Config *model.Config
RouterGroup *gin.RouterGroup `name:"apiRouterGroup"` RouterGroup *gin.RouterGroup `name:"apiRouterGroup"`
ACLsService *service.AccessControlsService ACLsService *service.AccessControlsService
AuthService *service.AuthService AuthService *service.AuthService
@@ -77,6 +79,7 @@ func NewProxyController(i ProxyControllerInput) *ProxyController {
controller := &ProxyController{ controller := &ProxyController{
log: i.Log, log: i.Log,
runtime: i.RuntimeConfig, runtime: i.RuntimeConfig,
config: i.Config,
acls: i.ACLsService, acls: i.ACLsService,
auth: i.AuthService, auth: i.AuthService,
policyEngine: i.PolicyEngine, policyEngine: i.PolicyEngine,
@@ -486,9 +489,17 @@ func (controller *ProxyController) determineAuthModules(proxy ProxyType) []AuthM
case Traefik, Caddy: case Traefik, Caddy:
return []AuthModuleType{ForwardAuth} return []AuthModuleType{ForwardAuth}
case Envoy: case Envoy:
return []AuthModuleType{ExtAuthz, ForwardAuth} authModules := []AuthModuleType{ExtAuthz}
if !controller.config.Experimental.DisableAuthModuleFallback {
authModules = append(authModules, ForwardAuth)
}
return authModules
case Nginx: case Nginx:
return []AuthModuleType{AuthRequest, ForwardAuth} authModules := []AuthModuleType{AuthRequest}
if !controller.config.Experimental.DisableAuthModuleFallback {
authModules = append(authModules, ForwardAuth)
}
return authModules
default: default:
return []AuthModuleType{} return []AuthModuleType{}
} }
+2 -1
View File
@@ -239,7 +239,8 @@ type LogStreamConfig struct {
} }
type ExperimentalConfig struct { type ExperimentalConfig struct {
OAuthBridgeEnabled bool `description:"Enable the OAuth bridge, uses a new way to format OAuth user information." yaml:"oauthBridgeEnabled,omitempty"` OAuthBridgeEnabled bool `description:"Enable the OAuth bridge, uses a new way to format OAuth user information." yaml:"oauthBridgeEnabled,omitempty"`
DisableAuthModuleFallback bool `description:"Disable the fallback to forward_auth modules when auth_request or ext_authz fail." yaml:"disableAuthModuleFallback,omitempty"`
} }
type TailscaleConfig struct { type TailscaleConfig struct {