summaryrefslogtreecommitdiff
path: root/internal/handlers/handler_firstfactor.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/handlers/handler_firstfactor.go')
-rw-r--r--internal/handlers/handler_firstfactor.go25
1 files changed, 2 insertions, 23 deletions
diff --git a/internal/handlers/handler_firstfactor.go b/internal/handlers/handler_firstfactor.go
index e196f8b80..15882eed6 100644
--- a/internal/handlers/handler_firstfactor.go
+++ b/internal/handlers/handler_firstfactor.go
@@ -4,10 +4,8 @@ import (
"errors"
"time"
- "github.com/authelia/authelia/v4/internal/configuration/schema"
"github.com/authelia/authelia/v4/internal/middlewares"
"github.com/authelia/authelia/v4/internal/regulation"
- "github.com/authelia/authelia/v4/internal/utils"
)
// FirstFactorPOST is the handler performing the first factory.
@@ -138,8 +136,8 @@ func FirstFactorPOST(delayFunc middlewares.TimingAttackDelayFunc) middlewares.Re
userSession.SetOneFactor(ctx.Clock.Now(), userDetails, keepMeLoggedIn)
- if refresh, refreshInterval := getProfileRefreshSettings(ctx.Configuration.AuthenticationBackend); refresh {
- userSession.RefreshTTL = ctx.Clock.Now().Add(refreshInterval)
+ if ctx.Configuration.AuthenticationBackend.RefreshInterval.Update() {
+ userSession.RefreshTTL = ctx.Clock.Now().Add(ctx.Configuration.AuthenticationBackend.RefreshInterval.Value())
}
if err = ctx.SaveSession(userSession); err != nil {
@@ -159,22 +157,3 @@ func FirstFactorPOST(delayFunc middlewares.TimingAttackDelayFunc) middlewares.Re
}
}
}
-
-func getProfileRefreshSettings(cfg schema.AuthenticationBackend) (refresh bool, refreshInterval time.Duration) {
- if cfg.LDAP != nil {
- if cfg.RefreshInterval == schema.ProfileRefreshDisabled {
- refresh = false
- refreshInterval = 0
- } else {
- refresh = true
-
- if cfg.RefreshInterval != schema.ProfileRefreshAlways {
- refreshInterval, _ = utils.ParseDurationString(cfg.RefreshInterval)
- } else {
- refreshInterval = schema.RefreshIntervalAlways
- }
- }
- }
-
- return refresh, refreshInterval
-}