diff --git a/Auth0/ASCallbackTransaction.swift b/Auth0/ASCallbackTransaction.swift index 75bb6d4d..13b26d16 100644 --- a/Auth0/ASCallbackTransaction.swift +++ b/Auth0/ASCallbackTransaction.swift @@ -23,7 +23,7 @@ #if WEB_AUTH_PLATFORM import AuthenticationServices -final class ASCallbackTransaction: BaseCallbackTransaction, ASWebAuthenticationPresentationContextProviding { +final class ASCallbackTransaction: BaseCallbackTransaction { init(url: URL, schemeURL: URL, callback: @escaping (Bool) -> Void) { super.init(callback: callback) diff --git a/Auth0/BaseTransaction.swift b/Auth0/BaseTransaction.swift index 11f0cefb..5214a15f 100644 --- a/Auth0/BaseTransaction.swift +++ b/Auth0/BaseTransaction.swift @@ -53,9 +53,9 @@ class BaseTransaction: NSObject, AuthTransaction { authSession = nil } - func handleUrl(_ url: URL) -> Bool { + func resume(_ url: URL) -> Bool { self.logger?.trace(url: url, source: "iOS Safari") - if self.resumeAuth(url) { + if self.handleURL(url) { authSession?.cancel() authSession = nil return true @@ -63,7 +63,7 @@ class BaseTransaction: NSObject, AuthTransaction { return false } - private func resumeAuth(_ url: URL) -> Bool { + private func handleURL(_ url: URL) -> Bool { guard url.absoluteString.lowercased().hasPrefix(self.redirectURL.absoluteString.lowercased()) else { return false } guard let components = URLComponents(url: url, resolvingAgainstBaseURL: true) else { self.callback(.failure(AuthenticationError(string: url.absoluteString, statusCode: 200))) diff --git a/Auth0Tests/BaseTransactionSpec.swift b/Auth0Tests/BaseTransactionSpec.swift index b36971e9..d916fadd 100644 --- a/Auth0Tests/BaseTransactionSpec.swift +++ b/Auth0Tests/BaseTransactionSpec.swift @@ -78,19 +78,19 @@ class BaseTransactionSpec: QuickSpec { context("handle url") { it("should handle url") { let url = URL(string: "https://samples.auth0.com/callback?code=\(code)&state=state")! - expect(transaction.handleUrl(url)) == true + expect(transaction.resume(url)) == true expect(result).toEventually(haveCredentials()) } it("should handle url with error") { let url = URL(string: "https://samples.auth0.com/callback?error=error&error_description=description&state=state")! - expect(transaction.handleUrl(url)) == true + expect(transaction.resume(url)) == true expect(result).toEventually(haveAuthenticationError(code: "error", description: "description")) } it("should fail to handle url without state") { let url = URL(string: "https://samples.auth0.com/callback?code=\(code)")! - expect(transaction.handleUrl(url)) == false + expect(transaction.resume(url)) == false } }