Address review feedback

This commit is contained in:
ugurtafrali 2026-04-10 00:42:19 +03:00
parent 8d19ba11f8
commit 3e538674e8
2 changed files with 0 additions and 14 deletions

View File

@ -421,7 +421,6 @@ func buildSessionChain(opts *options.Options, provider providers.Provider, sessi
RefreshPeriod: opts.Cookie.Refresh,
RefreshSession: provider.RefreshSession,
ValidateSession: provider.ValidateSession,
EnrichSession: provider.EnrichSession,
}))
return chain

View File

@ -48,9 +48,6 @@ type StoredSessionLoaderOptions struct {
// If the sesssion is older than `RefreshPeriod` but the provider doesn't
// refresh it, we must re-validate using this validation.
ValidateSession func(context.Context, *sessionsapi.SessionState) bool
// Provider based session enriching after a token refresh.
EnrichSession func(context.Context, *sessionsapi.SessionState) error
}
// NewStoredSessionLoader creates a new storedSessionLoader which loads
@ -63,7 +60,6 @@ func NewStoredSessionLoader(opts *StoredSessionLoaderOptions) alice.Constructor
refreshPeriod: opts.RefreshPeriod,
sessionRefresher: opts.RefreshSession,
sessionValidator: opts.ValidateSession,
sessionEnricher: opts.EnrichSession,
}
return ss.loadSession
}
@ -75,7 +71,6 @@ type storedSessionLoader struct {
refreshPeriod time.Duration
sessionRefresher func(context.Context, *sessionsapi.SessionState) (bool, error)
sessionValidator func(context.Context, *sessionsapi.SessionState) bool
sessionEnricher func(context.Context, *sessionsapi.SessionState) error
}
// loadSession attempts to load a session as identified by the request cookies.
@ -235,14 +230,6 @@ func (s *storedSessionLoader) refreshSession(rw http.ResponseWriter, req *http.R
// (In case underlying provider implementations forget)
session.CreatedAtNow()
// Re-enrich the session after a real token refresh so that providers
// which fetch extra data (e.g. groups via Graph API) can repopulate it.
if !errors.Is(err, providers.ErrNotImplemented) && s.sessionEnricher != nil {
if enrichErr := s.sessionEnricher(req.Context(), session); enrichErr != nil {
return fmt.Errorf("error enriching session after refresh: %v", enrichErr)
}
}
// Because the session was refreshed, make sure to save it
err = s.store.Save(rw, req, session)
if err != nil {