https://github.com/kwintenvdb/unity-publisher-management
https://github.com/kwintenvdb/unity-publisher-management
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/kwintenvdb/unity-publisher-management
- Owner: Kwintenvdb
- License: apache-2.0
- Created: 2022-11-05T15:08:39.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-05-11T16:22:43.000Z (about 2 years ago)
- Last Synced: 2025-01-23T01:13:48.815Z (5 months ago)
- Language: Go
- Size: 101 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Overview
First request:
1. Authenticate against Unity
2. Retrieve auth cookies
3. Return auth cookies to client (browser)
4. Client is now authenticated for all subsequent requests to Unity API
5. A DB entry is created for the user containing the publisher idNote: this will not work for caching -> we need to be able to verify authenticated access to the cache separately from access to the Unity API.
Could create a separate JWT which we can validate for each request. Either the Unity tokens or the JWT might expire earlier, we cannot sync this.Next requests:
1. Client sends requests with auth cookies
2. For each API requests, the API service checks the cache first
3. API service forwards requests to Unity API on cache miss and populates the cacheIf the Unity API returns a 401, invalidate the JWT somehow (clear the cookie).
Additionally send out a message which the scheduler may react to (stop caching).Scheduler:
1. When user is first created, a message is sent to the scheduler
2. The scheduler periodically sends a request to the API service to fetch ALL sales data of all months
3. The scheduler then populates the cache with the dataThe scheduler receives the JWT from the API service.
When the JWT expires, or any Unity API returns a 401, the scheduler stops fetching data for that particular publisher.Cache:
1. Stores all sales data per month by publisher id
2. On a request to cache new (different) data, sends a message to the notification service to inform the user of new sales## To do's
* Add JWT verification to all services
* Move authentication to API gateway
* Convert API gateway to use Gin rather than Fiber
* Return frontend from API gateway
* Run on k8s