Page MenuHomePhabricator

[reports] Always create AuthorizationCredential directly
ClosedPublic

Authored by bartek on Feb 2 2024, 2:05 AM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Nov 8, 10:03 PM
Unknown Object (File)
Fri, Nov 8, 7:14 PM
Unknown Object (File)
Fri, Nov 8, 7:14 PM
Unknown Object (File)
Fri, Nov 8, 7:14 PM
Unknown Object (File)
Fri, Nov 8, 1:36 PM
Unknown Object (File)
Oct 3 2024, 11:47 PM
Unknown Object (File)
Oct 3 2024, 11:47 PM
Unknown Object (File)
Oct 3 2024, 11:47 PM
Subscribers

Details

Summary

Noticed this while testing D10931.
For authenticated endpoints this doesnt matter because they're always behind auth middleware.
But for optionally-authenticated endpoints, the request extensions isn't set by the middleware so it's always None.
Using AuthorizationCredential::from_request() also does the extensions check if possible so it's better to call it instead.

Test Plan

Test plan for D10931

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

bartek held this revision as a draft.
bartek published this revision for review.Feb 2 2024, 2:18 AM
bartek added inline comments.
services/reports/src/service.rs
238 ↗(On Diff #36580)

Ah, I should also update the comment. This should be Some for all endpoints as long as the Authorization header is provided.

This revision is now accepted and ready to land.Feb 2 2024, 9:18 AM
This revision was landed with ongoing or failed builds.Feb 7 2024, 1:35 AM
This revision was automatically updated to reflect the committed changes.