Skip to content

AppAuth 3.1.0

Latest

Choose a tag to compare

@w-goog w-goog released this 03 Dec 21:13
4f9e72b

Summary

This is the first AppAuth release distributed only through Swift Package Manager - 3.0.0 was the last release published to CocoaPods, so please see MIGRATING_FROM_COCOAPODS.md if you haven't moved yet. It fixes three crashes (cancelling sign-in on iOS, a JSON array from the token endpoint, and null values in discovery documents), adds HTTPS redirect URLs on iOS 17.4+, and adds an AppAuthTestHelpers product for faking AppAuth in your own tests.

Note that the new HTTPS redirect URLs (#978) support is covered by unit tests only. If you adopt it, please let us know how it goes, and file an issue if anything misbehaves. (Your app needs the webcredentials Associated Domains service for the redirect host; applinks alone isn't enough.)

Changelog

New Features

  • Added support for HTTPS (universal link) redirect URLs on iOS 17.4+. OIDExternalUserAgentIOS uses ASWebAuthenticationSession's HTTPS callback for them instead of a custom scheme callback. Not yet tested end to end - see the note above. (#978)

Behaviour Changes

  • Discovery documents with a JSON null or a non-string value in an optional URL-valued field no longer raise NSInvalidArgumentException; the property reads as nil. The same value in a required URL field now fails with OIDErrorCodeInvalidDiscoveryDocument. An authorization_endpoint that does not parse now fails the document too, like the other required URL fields. Addresses issue #380. (#983)
  • Improved the state validation error messages to distinguish a missing state parameter from a mismatched one. The end session message now notes that a provider's end_session_endpoint may point at a legacy or SAML single-logout endpoint, which does not echo state. Addresses issue #956. (#977)
  • Deprecated OIDAuthorizationService.configuration. It is never set and is always nil; use the request's configuration instead. It will be removed in 4.0. (#990)
  • Deprecated CocoaPods distribution. See details above. Addresses issue #962. (#986)

Crash & Flow-logic Fixes

  • Fixed OIDExternalUserAgentIOSCustomBrowser failing the flow with "Unable to open Safari." when canOpenURL: returns NO for a URL that the system can open, for example an https URL when Safari is restricted and another browser is the default. The flow now fails only if the URL really cannot be opened. Addresses issue #980. (#981)
  • Fixed a crash when the user cancels sign-in on iOS, caused by ASWebAuthenticationSession being deallocated during its completion handler or dismiss animation. Based on #917 by @Prash88. (#985)
  • Fixed a crash (NSInvalidArgumentException) when a token, registration or device authorization endpoint answers with a JSON array instead of an object. The callback now gets an error. Addresses issue #987. (#988)

Testability Improvements

  • Added the AppAuthTestHelpers Swift package product, with OIDFakeAuthorizationService and OIDFakeExternalUserAgentSession, for testing code that depends on AppAuth. (#992, #993)
  • Added OIDExternalUserAgentIOSCustomBrowserURLOpener and -[OIDExternalUserAgentIOSCustomBrowser initWithURLTransformation:canOpenURLScheme:appStoreURL:URLOpener:] so an app can supply the object that opens URLs instead of UIApplication. The existing initializers keep using UIApplication. (#984)
  • Added instance-method counterparts of the OIDAuthorizationService class methods, and made -init public, so the service can be injected and faked in tests. OIDAuthorizationServiceProtocol declares them, and OIDAuthorizationServiceIOSProtocol / OIDAuthorizationServiceMacProtocol declare the platform convenience methods. (#990, #997)
  • Added instance-method counterparts of the iOS and macOS OIDAuthorizationService convenience methods, and read-only presentingViewController / presentingWindow properties on the external user agents. (#991)