summaryrefslogtreecommitdiff
path: root/internal/handlers/handler_authz_builder.go
diff options
context:
space:
mode:
authorJames Elliott <james-d-elliott@users.noreply.github.com>2023-11-23 08:20:36 +1100
committerGitHub <noreply@github.com>2023-11-23 08:20:36 +1100
commitc49b973120c7fd755923a2b88afd794c7d320d6e (patch)
tree5fcef6de1a85568eee3c67470f73b790b294dda8 /internal/handlers/handler_authz_builder.go
parentfa141929a39e546f3f3ca6bcbc7bd72c64e575c8 (diff)
fix(configuration): illogical refresh interval default (#6319)
When using the file provider with watch enabled, the refresh interval should just be set to always default as the cost is minimal. Signed-off-by: James Elliott <james-d-elliott@users.noreply.github.com>
Diffstat (limited to 'internal/handlers/handler_authz_builder.go')
-rw-r--r--internal/handlers/handler_authz_builder.go18
1 files changed, 2 insertions, 16 deletions
diff --git a/internal/handlers/handler_authz_builder.go b/internal/handlers/handler_authz_builder.go
index 365966ee9..43be45c0d 100644
--- a/internal/handlers/handler_authz_builder.go
+++ b/internal/handlers/handler_authz_builder.go
@@ -1,18 +1,15 @@
package handlers
import (
- "time"
-
"github.com/valyala/fasthttp"
"github.com/authelia/authelia/v4/internal/configuration/schema"
- "github.com/authelia/authelia/v4/internal/utils"
)
// NewAuthzBuilder creates a new AuthzBuilder.
func NewAuthzBuilder() *AuthzBuilder {
return &AuthzBuilder{
- config: AuthzConfig{RefreshInterval: time.Second * -1},
+ config: AuthzConfig{RefreshInterval: schema.NewRefreshIntervalDurationAlways()},
}
}
@@ -62,19 +59,8 @@ func (b *AuthzBuilder) WithConfig(config *schema.Configuration) *AuthzBuilder {
return b
}
- var refreshInterval time.Duration
-
- switch config.AuthenticationBackend.RefreshInterval {
- case schema.ProfileRefreshDisabled:
- refreshInterval = time.Second * -1
- case schema.ProfileRefreshAlways:
- refreshInterval = time.Second * 0
- default:
- refreshInterval, _ = utils.ParseDurationString(config.AuthenticationBackend.RefreshInterval)
- }
-
b.config = AuthzConfig{
- RefreshInterval: refreshInterval,
+ RefreshInterval: config.AuthenticationBackend.RefreshInterval,
}
return b