analytics/test/support
Adrian Gruntkowski 373d4dd665
Implement token-based sessions (#4463)
* Turn `Plausible.Auth.UserSession` into full schema

* Implement token based sessions and use them as default

* Ignore expired user sessions during retrieval from DB

* Implement plug bumping user session last used and timeout timestamps

* Implement Oban worker removing expired user sessions with grace period

* Implement legacy session conversion on touch, when applicable

* Update `UserAuth` moduledoc

* Extend `UserAuth` tests to account for db-backed session tokens

* Update CHANGELOG

* Add tests for `UserSessionTouch` plug

* Add test for `CleanUserSessions` worker

* Add logging of legacy session retrievals

* Use single update permitting stale records  when touching user session

* Don't fetch session and user for external API endpoints (/api/event too)

* Refactor `Users.with_subscription/1` and expose helper query

* Skip fetching session in legacy `SessionTimeoutPlug`

* Rely on user session assign from `AuthContext` in `SentryContext`

* Silence legacy session warnings in `UserSessionTouchTest`

* Rely on session assign from `AuthPlug` in `SuperAdminOnlyPlug`

* Change `UserAuth` to get session, user and last subscription in one go

* Avoid refetching user session in `AuthorizeSiteAccess` plug

* Fix code formatting

* Refactor `UserAuth.get_user_token/1` (h/t @aerosol)

* Remove bogus empty opts from `scope` declarations in router

* Only touch session once an hour and keep `user.last_seen` in sync

* Bring back logging of legacy token use
2024-09-03 11:34:37 +02:00
..
conn_case.ex Implement UI for 2FA setup and verification (#3541) 2023-12-06 12:01:19 +01:00
data_case.ex Google APIs integration improvements (#2358) 2022-10-24 09:34:02 +02:00
exchange_rate_mock.ex Revenue tracking: Add currency field to goal creation (#2948) 2023-05-23 12:08:09 +02:00
factory.ex Edit goals with display names (#4415) 2024-08-09 11:12:00 +02:00
google_api_mock.ex Implement search and pagination in Google Keywords modal (#4378) 2024-07-23 11:53:52 +03:00
html.ex Snippet integration verification (#4106) 2024-05-23 15:00:50 +02:00
http_mocker.ex Upgrade Erlang/Elixir stack (#3454) 2023-10-24 10:33:48 +02:00
live_view_test_fix.ex update runtime to elixir-1.17.1 and erlang-27.0 (#4255) 2024-06-24 13:22:33 +02:00
paddle_api_mock.ex Unify default pricing currency selection (#4221) 2024-06-14 14:49:22 +02:00
plugins_api_case.ex Merge Plugins.API.Router into main one (#3767) 2024-02-12 10:44:32 +01:00
test_utils.ex Implement token-based sessions (#4463) 2024-09-03 11:34:37 +02:00