Add support of /authenticate request #39
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Note that this change depends upon corresponding changes being landed in the github.com/SUSE/telemetry repo.
Added a new InstIdExists() helper method to the ClientsRow structure which is equivalent to the old Exists() helper. Updated the Exists() helper to now search for clients table entries with a matching Id value.
Add support for handling /authenticate requests allowing clients to obtain an updated authToken.
The /report handling now also requires that clients provide a new X-Telemetry-Client-Id header specifying their client id, and uses this to retrieve the saved authToken value for that client to check that the client id and token values provided match what is stored in the Operational DB's client table.
The /register handling has been tweaked slightly to align with new shared data types and also to use a different client instance id existence check mechanism.
Added new tests to test the /authenticate request and updated the test suite setup to create a test client entry in the operational DB's clients table as well as updating the relevant tests to pass the appropriate header values.