MCPcopy Create free account
hub / github.com/supabase/auth / CheckValidity

Method CheckValidity

internal/models/sessions.go:215–233  ·  view source on GitHub ↗
(config SessionValidityConfig, now time.Time, refreshTokenTime *time.Time, userHighestPossibleAAL AuthenticatorAssuranceLevel)

Source from the content-addressed store, hash-verified

213}
214
215func (s *Session) CheckValidity(config SessionValidityConfig, now time.Time, refreshTokenTime *time.Time, userHighestPossibleAAL AuthenticatorAssuranceLevel) SessionValidityReason {
216 if s.NotAfter != nil && now.After(*s.NotAfter) {
217 return SessionPastNotAfter
218 }
219
220 if config.Timebox != nil && *config.Timebox != 0 && now.After(s.CreatedAt.Add(*config.Timebox)) {
221 return SessionPastTimebox
222 }
223
224 if config.InactivityTimeout != nil && *config.InactivityTimeout != 0 && now.After(s.LastRefreshedAt(refreshTokenTime).Add(*config.InactivityTimeout)) {
225 return SessionTimedOut
226 }
227
228 if config.AllowLowAAL != nil && *config.AllowLowAAL != 0 && CompareAAL(ParseAAL(s.AAL), userHighestPossibleAAL) < 0 && now.After(s.CreatedAt.Add(*config.AllowLowAAL)) {
229 return SessionLowAAL
230 }
231
232 return SessionValid
233}
234
235func (s *Session) DetermineTag(tags []string) string {
236 if len(tags) == 0 {

Callers 3

RefreshTokenGrantMethod · 0.80
TestCheckValidityFunction · 0.80

Calls 4

LastRefreshedAtMethod · 0.95
CompareAALFunction · 0.85
ParseAALFunction · 0.85
AddMethod · 0.65

Tested by 1

TestCheckValidityFunction · 0.64