google / GoogleSignIn-iOS

Enables iOS and macOS apps to sign in with Google.
https://developers.google.com/identity/sign-in/ios
Apache License 2.0
506 stars 201 forks source link

Add GIDAuthorizationUtil class. #288

Closed Alex-4-Git closed 1 year ago

Alex-4-Git commented 1 year ago

The class GIDAuthorizationUtil contains two utility methods. It helps us test these methods easily and reduce the GIDSIgnInTest complexity vastly.

In GIDSignInTest there are some tests using an OIDAuthorizationRequest. In production GIDSignIn sends an OIDAuthorizationRequest to AppAuth to start the authorization flow. In GIDSignInTest we saved the request and use this to verify the parameters and scopes before sending it to an AppAuth mock. By extracting these method we can verify the request and scopes directly instead of verifying them along with the whole sign-in flow.