spotify / XCMetrics

XCMetrics is the easiest way to collect Xcode build metrics and improve developer productivity.
https://xcmetrics.io
Other
1.1k stars 77 forks source link

Facilitate additional auth headers to be included within the metrics request #44

Closed dlbuckley closed 3 years ago

dlbuckley commented 3 years ago

Overview

We are currently using AWS to host the XCMetrics backend and want to lock down the API so it can only be used for developers within our team. To close down the API somewhat we decided to use the functionality within API Gateway to provide a basic level of authentication.

For this to work we need to send additional headers with the xcactivitylog upload requests. This is something that the XCMetrics client doesn't yet support. This PR adds support for two additional flags; authorizationKey and authorizationValue. The reason for allowing the key to be configurable was down to making this functionality as flexible as possible. Whilst a lot of cases you may use the standard Authorisation key, there are instances where you may just wish to use an API token with a custom key e.g x-api-key.

Details

Two additional flags have been added:

Internally, the changes allow for any number of additional headers to be included within the PUT request which uploads the xcactivitylog. These headers are added prior to any required headers in the request builder so they can't be used to override required headers by XCMetrics.

dlbuckley commented 3 years ago

@ecamacho is there anything that I can do to help push this forwards?

BalestraPatrick commented 3 years ago

@dlbuckley This looks very interesting! We knew that at some point we would need to support something like for teams that don't put their XCMetrics installation being a VPN. In my opinion this looks fine, I have a comment though on the flags. Let's see what @ecamacho thinks as well :)