feat(identity): add server sessions and audited mail recovery
This commit is contained in:
1 parent
20c03288d6
commit
4ee53d9a74
58 files changed
+5359
-567
No files matched your search
@@ -28,9 +28,8 @@ const (
|
||||
// consent records.
|
||||
consentSubjectForeignKey = "consent_records_subject_id_fkey"
|
||||
|
||||
// sessionTouchInterval is the minimum age of last_seen_at before Touch
|
||||
// writes it again. It bounds session writes to one per minute per session
|
||||
// at the cost of ending an idle session up to a minute early.
|
||||
// sessionTouchInterval coalesces session activity writes for frequent
|
||||
// requests. Touch also caps it at half the configured idle timeout.
|
||||
sessionTouchInterval = time.Minute
|
||||
)
|
||||
|
||||
@@ -614,11 +613,12 @@ func (repository sessionRepository) Touch(ctx context.Context, id uuid.UUID, at
|
||||
if err := validateSessionCheck("sessionRepository.Touch", at, idleTimeout); err != nil {
|
||||
return err
|
||||
}
|
||||
touchInterval := min(sessionTouchInterval, idleTimeout/2)
|
||||
result, err := repository.queries.TouchSession(ctx, sqlc.TouchSessionParams{
|
||||
ID: pgUUID(id),
|
||||
At: pgTime(at),
|
||||
IdleCutoff: pgTime(at.Add(-idleTimeout)),
|
||||
TouchCutoff: pgTime(at.Add(-sessionTouchInterval)),
|
||||
TouchCutoff: pgTime(at.Add(-touchInterval)),
|
||||
})
|
||||
if err != nil {
|
||||
return fmt.Errorf("sessionRepository.Touch - update session: %w", mapIdentityError(err))
|
||||
|
||||
Reference in new issue
Block a user