Resolves ENG-6287.
Added Authorization header to blob service requests.
Details
Called all these blob functions in "main" keyserver.js. In blob service handlers, I added the following:
#[instrument(name = "assign_holder", skip(service))] pub async fn assign_holder_handler( // ... auth: comm_lib::auth::AuthorizationCredential, ) -> actix_web::Result<HttpResponse> { info!(?auth, "Assign holder request"); // ...
And checked the logs to see that the auth struct was populated with the correct data from the keyserver.
Diff Detail
- Repository
- rCOMM Comm
- Lint
Lint Not Applicable - Unit
Tests Not Applicable
Event Timeline
keyserver/src/services/blob.js | ||
---|---|---|
20 ↗ | (On Diff #36504) | This is on purpose NOT $ReadOnly - seems like fetch() doesn't like the plus sign 😛 |
lib/utils/services-utils.js | ||
17 ↗ | (On Diff #36504) | I really don't like passing this param all the time but haven't got any better idea than possibly this:
But the above is still not perfect. Let's assume I want to add another utility function on top of this one: function createDefaultHTTPHeaders(authMetadata: AuthMetadata): { [string]: string } { const authorizationValue = createHTTPAuthorizationHeader(authMetadata); return { Authorization: authorizationValue, }; } I'd have to repeat this function 3 times per platform, or curry the same way as the original: const defaultHTTPHeadersFactory = authHeaderFn => authMetadata => { ... } |
lib/utils/services-utils.js | ||
---|---|---|
17 ↗ | (On Diff #36504) | Not sure if we can elegantly solve this. Maybe some platform-specific config might help... not sure if it is worth it. |
lib/utils/services-utils.js | ||
---|---|---|
17 ↗ | (On Diff #36504) | Probably I'll have to add the js-only base-64 dependency to lib. I worked around passing callback to multimedia endpoints, but reports stuff is mostly lib-only so no good way of doing it. |