HomePhabricator
Diffusion Comm a6e0dc1ae2ed

[reports-service] Add authenticated service

Description

[reports-service] Add authenticated service

Summary:
This diff introduces a ReportsService struct that is going to be a business logic core.
It also implements mechanism for reading reporter's user ID from Authorization header.
The FromRequest trait is implemented struct to make it possible to use the service directly in handlers.

Depends on D8947, D8786, D8911

Test Plan:
Created a HTTP handler with the service as a function parameter.
Ran the server without middleware, sent a request and observed tracing logs.
Then added middleware and sent another request with Authorization header and observed the logs again.
The requesting_user_id field was empty in the first case and contained the user ID in the second case.

Reviewers: michal, patryk, varun, jon

Reviewed By: michal, jon

Subscribers: ashoat, tomek

Differential Revision: https://phab.comm.dev/D8951

Details

Provenance
bartekAuthored on Aug 25 2023, 8:21 AM
Reviewer
michal
Differential Revision
D8951: [reports-service] Add authenticated service
Parents
rCOMM0f9c62299c8f: [reports-service] Add HTTP server
Branches
Unknown
Tags
Unknown