mongodb / stitch-ios-sdk

Apache License 2.0
42 stars 25 forks source link

STITCH-1449 Add user API key auth provider client #55

Closed adamchel closed 6 years ago

adamchel commented 6 years ago

Added a user API key client. To do this, I had to introduce the idea of an "authenticated auth provider client", which is the same as an existing auth provider client, except it can only be retrieved from an authenticated StitchAuth.

The code in the User API key provider is a little bit messy because it coexists with an unauthenticated auth provider client, but I think it will be cleaner once we make the same changes Eric made on Android to get rid of unnecessary auth provider clients.

I also chose to do integration tests since it was relatively straightforward compared to mocking a StitchAuthRequestClient and we don't yet have a good mocking framework for unit tests.

adamchel commented 6 years ago

@edaniels Went through your feedback, this is ready for another look

Tried to implement a refactor of the core auth provider client based on your suggestions, but it's not quite what you were imagining I think.

There is slightly less duplicated code now but we decided offline that it’s probably not worth creating a separate request framework just for auth provider clients.

Also realized that Swiftlint wasn’t running on StitchCore for some reason, the build phase must have gotten destroyed when we rebuilt the SPM package at some point. We’re gonna have to figure out a way to get the generate-xcodeproj for StitchCore to not wipe the swiftlint script.