| 213 | } |
| 214 | |
| 215 | func (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 | |
| 235 | func (s *Session) DetermineTag(tags []string) string { |
| 236 | if len(tags) == 0 { |