Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# UNRELEASED
- Add Swift name to `resumeExternalUserAgentFlowWithURL:error:` and update hint. (#966)
- BREAKING: `resumeExternalUserAgentFlowWithURL:error:` is now required in `OIDExternalUserAgentSession` to fix a Swift compiler crash (no workaround) caused by its `@optional` status with `NSError **`. Implementers must now provide this method. Affects projects since 2.1.0. ([#955](https://github.com/openid/AppAuth-iOS/pull/955))
- Swift callers now spell the method `resumeExternalUserAgentFlow(_:)`. Since the method is no longer optional, you don't need optional-chaining anymore. For those migrating from 2.1.0, replace `try session.resumeExternalUserAgentFlow?(with: url)` with `try session.resumeExternalUserAgentFlow(url)`. Objective-C callers are unaffected. ([#966](https://github.com/openid/AppAuth-iOS/pull/966))
- Replace case range with explicit case labels in OIDTokenUtilities. Addresses issue #947. ([#963](https://github.com/openid/AppAuth-iOS/pull/963))

# 2.1.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
// such as no pending flow, which previously surfaced as an NSException.
if let authorizationFlow = self.currentAuthorizationFlow {
do {
try authorizationFlow.resumeExternalUserAgentFlow?(with: url)
try authorizationFlow.resumeExternalUserAgentFlow(url)
self.currentAuthorizationFlow = nil
return true
} catch {
Expand Down
2 changes: 1 addition & 1 deletion Examples/Example-iOS_Swift-SPM/Example/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class AppDelegate: NSObject, UIApplicationDelegate {
// such as no pending flow, which previously surfaced as an NSException.
if let authorizationFlow = self.currentAuthorizationFlow {
do {
try authorizationFlow.resumeExternalUserAgentFlow?(url)
try authorizationFlow.resumeExternalUserAgentFlow(url)
self.currentAuthorizationFlow = nil
return true
} catch {
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ func application(_ app: UIApplication,
// mismatches (OIDErrorCodeURLMismatch) are kept silent.
if let authorizationFlow = self.currentAuthorizationFlow {
do {
try authorizationFlow.resumeExternalUserAgentFlow(with: url)
try authorizationFlow.resumeExternalUserAgentFlow(url)
self.currentAuthorizationFlow = nil
return true
} catch let error as NSError where error.code == OIDErrorCodeInvalidAuthorizationFlow.rawValue {
Expand Down
10 changes: 4 additions & 6 deletions Sources/AppAuthCore/OIDExternalUserAgentSession.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,16 +55,15 @@ NS_ASSUME_NONNULL_BEGIN
__deprecated_msg("Use resumeExternalUserAgentFlowWithURL:error: instead. "
"Swift: Use the throwing resumeExternalUserAgentFlow(_:)");

@optional
/*! @brief Clients should call this method with the result of the external user-agent code flow if
it becomes available. This is the preferred replacement for the deprecated version.
@param URL The redirect URL invoked by the server.
@param error On failure, an NSError describing why the URL was not handled. Pass NULL if you do
not need the error.
@discussion When the URL represented a valid response, implementations should clean up any
left-over UI state from the request, for example by closing the
\SFSafariViewController or loopback HTTP listener if those were used. The completion block
of the pending request should then be invoked.
@discussion Conforming types are required to implement this method. When the URL represented a
valid response, implementations should clean up any left-over UI state from the request, for
example by closing the \SFSafariViewController or loopback HTTP listener if those were used.
The completion block of the pending request should then be invoked.
Two specific error cases: (1) OIDErrorCodeURLMismatch when the URL does not match the
expected redirect, (2) OIDErrorCodeInvalidAuthorizationFlow when no pending authorization
flow exists.
Expand All @@ -75,7 +74,6 @@ NS_ASSUME_NONNULL_BEGIN
*/
- (BOOL)resumeExternalUserAgentFlowWithURL:(NSURL *)URL error:(NSError *_Nullable *_Nullable)error NS_SWIFT_NAME(resumeExternalUserAgentFlow(_:));

@required
/*! @brief @c OIDExternalUserAgent or clients should call this method when the
external user-agent flow failed with a non-OAuth error.
@param error The error that is the reason for the failure of this external flow.
Expand Down