uber / rides-ios-sdk

Uber Rides iOS SDK (beta)
https://developer.uber.com/docs
MIT License
371 stars 123 forks source link

Base API for UberAuth framework #287

Closed mohssenfathi closed 5 months ago

mohssenfathi commented 5 months ago

Overview

This PR adds the base implementation for the new UberAuth interface. This is only the general structure, auth logic will be added in a later PR.

Main components are:

UberAuth - A class that contains only static methods. Its purpose is to simplify the login calls for the implementing target and to manage the lifecycle of the AuthManager.

AuthContext - A class to contain all auth configuration info that can be changed at runtime or on a per auth instance, such as the type of auth or where it should be handled.

AuthDestination - The location where auth should occur, in the hosting app or in the native Uber application.

AuthProviding / AuthorizationCodeAuthProvider - The type and backing protocol that will implement the actual auth logic. This will be filled out in a later PR.

AuthManager - The class the manages the lifecycle of the current auth context. It dispatches to the auth provider to actually execute authentication.

ClientProvider / Client - The response object that UberAuth will return to the implementing target.

UberAuthError / OAuthError - Error types

Mocks

To support testing I generated mocks for several of the protocols using Uber's Mockolo The only checked in change is that some protocols in UberAuth have been annotated with /// @mockable.

Sample App

I created a new sample app UberSDK that will be used to test out new features moving forward. As of now it's non functional. I also added test cases to this sample target. In the future we can consider moving this to a test app shim if needed.

Testing

Unit tests have been added for AuthManager and UberAuthError classes. In a follow up PR I will add CI support for running these on PR and merge.