Page MenuHomePhabricator

[reports-service] Add authenticated service
ClosedPublic

Authored by bartek on Aug 25 2023, 8:33 AM.
Tags
None
Referenced Files
F3345005: D8951.id30320.diff
Fri, Nov 22, 5:04 AM
F3344972: D8951.id30359.diff
Fri, Nov 22, 5:00 AM
F3341499: D8951.diff
Thu, Nov 21, 11:10 PM
Unknown Object (File)
Thu, Nov 7, 9:39 PM
Unknown Object (File)
Thu, Nov 7, 9:22 PM
Unknown Object (File)
Sun, Oct 27, 3:49 PM
Unknown Object (File)
Sun, Oct 27, 3:48 PM
Unknown Object (File)
Sun, Oct 27, 3:48 PM
Subscribers

Details

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.

Diff Detail

Repository
rCOMM Comm
Lint
No Lint Coverage
Unit
No Test Coverage

Event Timeline

bartek held this revision as a draft.
bartek published this revision for review.Aug 25 2023, 10:11 AM

Not sure about the specifics of authentication, but the rust looks fine.

This revision is now accepted and ready to land.Aug 28 2023, 12:43 AM