Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added support for iOS13 changes in ASWebAuthenticationSession #297

Merged
merged 11 commits into from
Aug 19, 2019
Merged
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
52 changes: 43 additions & 9 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,43 @@
version: 2
jobs:
build-iOS-Swift-5.1:
macos:
xcode: "11.0.0"
shell: /bin/bash --login -eo pipefail
environment:
LC_ALL: en_US.UTF-8
LANG: en_US.UTF-8
HOMEBREW_LOGS: ~/homebrew-logs
HOMEBREW_TEMP: ~/homebrew-temp
HOMEBREW_NO_AUTO_UPDATE: 1
steps:
- run:
name: Set Ruby Version
command: echo "ruby-2.5" > ~/.ruby-version
- checkout
- run: |
brew install swiftlint
bundle install --without=development
grep -lR "shouldUseLaunchSchemeArgsEnv" *.* --null | xargs -0 sed -i '' -e 's/shouldUseLaunchSchemeArgsEnv = "YES"/shouldUseLaunchSchemeArgsEnv = "YES" codeCoverageEnabled = "YES"/g'
- run:
name: Bootstrap
command: bundle exec fastlane ios bootstrap
- run:
name: Run test suite
command: bundle exec fastlane ios ci
environment:
SCHEME: Auth0.iOS
DEVICE: iPhone 8
FASTLANE_EXPLICIT_OPEN_SIMULATOR: 2
- save_cache:
key: dependency-cache
paths:
- Carthage/Build
- store_test_results:
path: fastlane/test_output
build-iOS-Swift-5.0:
macos:
xcode: "10.2.0"
xcode: "10.3.0"
environment:
LC_ALL: en_US.UTF-8
LANG: en_US.UTF-8
Expand Down Expand Up @@ -35,7 +70,7 @@ jobs:
path: fastlane/test_output
build-iOS-Swift-4.2:
macos:
xcode: "10.2.0"
xcode: "10.3.0"
environment:
LC_ALL: en_US.UTF-8
LANG: en_US.UTF-8
Expand All @@ -59,8 +94,6 @@ jobs:
SCHEME: Auth0.iOS
DEVICE: iPhone 8
FASTLANE_EXPLICIT_OPEN_SIMULATOR: 2
- run: |
bash <(curl -s https://codecov.io/bash) -J 'Auth0'
- save_cache:
key: dependency-cache
paths:
Expand All @@ -69,7 +102,7 @@ jobs:
path: fastlane/test_output
build-iOS-Swift-4.0:
macos:
xcode: "10.2.0"
xcode: "10.3.0"
environment:
LC_ALL: en_US.UTF-8
LANG: en_US.UTF-8
Expand Down Expand Up @@ -99,7 +132,7 @@ jobs:
- Carthage/Build
build-macOS-Swift-5.0:
macos:
xcode: "10.2.0"
xcode: "10.3.0"
environment:
LC_ALL: en_US.UTF-8
LANG: en_US.UTF-8
Expand Down Expand Up @@ -131,7 +164,7 @@ jobs:
- Carthage/Build
build-macOS-Swift-4.2:
macos:
xcode: "10.2.0"
xcode: "10.3.0"
environment:
LC_ALL: en_US.UTF-8
LANG: en_US.UTF-8
Expand Down Expand Up @@ -164,7 +197,7 @@ jobs:
- Carthage/Build
build-tvOS-Swift-5.0:
macos:
xcode: "10.2.0"
xcode: "10.3.0"
environment:
LC_ALL: en_US.UTF-8
LANG: en_US.UTF-8
Expand All @@ -189,7 +222,7 @@ jobs:
- Carthage/Build
build-tvOS-Swift-4.2:
macos:
xcode: "10.2.0"
xcode: "10.3.0"
environment:
LC_ALL: en_US.UTF-8
LANG: en_US.UTF-8
Expand Down Expand Up @@ -218,6 +251,7 @@ workflows:
version: 2
build:
jobs:
- build-iOS-Swift-5.1
- build-iOS-Swift-5.0
- build-iOS-Swift-4.2
- build-iOS-Swift-4.0
Expand Down
23 changes: 13 additions & 10 deletions App/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,19 @@

import UIKit
import Auth0
#if canImport(AuthenticationServices)
import AuthenticationServices
#endif

class ViewController: UIViewController {

var onAuth: ((Result<Credentials>) -> ())!

@IBOutlet weak var oauth2: UIButton!

override func viewDidLoad() {
super.viewDidLoad()

self.onAuth = { [weak self] in
switch $0 {
case .failure(let cause):
Expand All @@ -37,28 +40,28 @@ class ViewController: UIViewController {
print($0)
}
}

@IBAction func startOAuth2(_ sender: Any) {
Auth0.webAuth()
Auth0.webAuth()
.logging(enabled: true)
.start(onAuth)
}

@IBAction func startGoogleOAuth2(_ sender: Any) {
Auth0.webAuth()
.logging(enabled: true)
.connection("google-oauth2")
.start(onAuth)
}

@IBAction func startTokenGoogleOAuth2(_ sender: Any) {
Auth0.webAuth()
.logging(enabled: true)
.connection("google-oauth2")
.responseType([.token])
.start(onAuth)
}

@IBAction func startIDTokenGoogleOAuth2(_ sender: Any) {
Auth0.webAuth()
.logging(enabled: true)
Expand All @@ -67,7 +70,7 @@ class ViewController: UIViewController {
.nonce("abc1234")
.start(onAuth)
}

@IBAction func startTokenIDTokenGoogleOAuth2(_ sender: Any) {
Auth0.webAuth()
.logging(enabled: true)
Expand All @@ -76,7 +79,7 @@ class ViewController: UIViewController {
.nonce("abc1234")
.start(onAuth)
}

@IBAction func startCodeIDTokenGoogleOAuth2(_ sender: Any) {
Auth0.webAuth()
.logging(enabled: true)
Expand Down
8 changes: 5 additions & 3 deletions Auth0.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1276,7 +1276,7 @@
isa = PBXProject;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general you can ignore these, it's just updating to latest version

attributes = {
LastSwiftUpdateCheck = 0940;
LastUpgradeCheck = 0940;
LastUpgradeCheck = 1100;
ORGANIZATIONNAME = Auth0;
TargetAttributes = {
5B7EE45720FC9F3200367724 = {
Expand Down Expand Up @@ -2032,7 +2032,7 @@
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CODE_SIGN_ENTITLEMENTS = OAuth2Mac/OAuth2Mac.entitlements;
CODE_SIGN_IDENTITY = "";
CODE_SIGN_IDENTITY = "-";
CODE_SIGN_STYLE = Manual;
COMBINE_HIDPI_IMAGES = YES;
DEVELOPMENT_TEAM = "";
Expand Down Expand Up @@ -2066,7 +2066,7 @@
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CODE_SIGN_ENTITLEMENTS = OAuth2Mac/OAuth2Mac.entitlements;
CODE_SIGN_IDENTITY = "";
CODE_SIGN_IDENTITY = "-";
CODE_SIGN_STYLE = Manual;
COMBINE_HIDPI_IMAGES = YES;
DEVELOPMENT_TEAM = "";
Expand Down Expand Up @@ -2593,6 +2593,7 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ANALYZER_NONNULL = YES;
CODE_SIGN_IDENTITY = "Apple Development";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 1;
Expand All @@ -2617,6 +2618,7 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ANALYZER_NONNULL = YES;
CODE_SIGN_IDENTITY = "Apple Development";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 1;
Expand Down
24 changes: 10 additions & 14 deletions Auth0.xcodeproj/xcshareddata/xcschemes/Auth0.iOS.xcscheme
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0940"
LastUpgradeVersion = "1100"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand All @@ -27,6 +27,15 @@
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "5F06DD771CC448B10011842B"
BuildableName = "Auth0.framework"
BlueprintName = "Auth0.iOS"
ReferencedContainer = "container:Auth0.xcodeproj">
</BuildableReference>
</MacroExpansion>
<Testables>
<TestableReference
skipped = "NO">
Expand All @@ -39,17 +48,6 @@
</BuildableReference>
</TestableReference>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "5F06DD771CC448B10011842B"
BuildableName = "Auth0.framework"
BlueprintName = "Auth0.iOS"
ReferencedContainer = "container:Auth0.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
Expand All @@ -70,8 +68,6 @@
ReferencedContainer = "container:Auth0.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
Expand Down
24 changes: 10 additions & 14 deletions Auth0.xcodeproj/xcshareddata/xcschemes/Auth0.macOS.xcscheme
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0940"
LastUpgradeVersion = "1100"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand All @@ -27,6 +27,15 @@
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "5F06DD841CC448C90011842B"
BuildableName = "Auth0.framework"
BlueprintName = "Auth0.macOS"
ReferencedContainer = "container:Auth0.xcodeproj">
</BuildableReference>
</MacroExpansion>
<Testables>
<TestableReference
skipped = "NO">
Expand All @@ -39,17 +48,6 @@
</BuildableReference>
</TestableReference>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "5F06DD841CC448C90011842B"
BuildableName = "Auth0.framework"
BlueprintName = "Auth0.macOS"
ReferencedContainer = "container:Auth0.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
Expand All @@ -70,8 +68,6 @@
ReferencedContainer = "container:Auth0.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
Expand Down
24 changes: 10 additions & 14 deletions Auth0.xcodeproj/xcshareddata/xcschemes/Auth0.tvOS.xcscheme
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0940"
LastUpgradeVersion = "1100"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand All @@ -27,6 +27,15 @@
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "5F23E6F51D4B87F000C3F2D9"
BuildableName = "Auth0.framework"
BlueprintName = "Auth0.tvOS"
ReferencedContainer = "container:Auth0.xcodeproj">
</BuildableReference>
</MacroExpansion>
<Testables>
<TestableReference
skipped = "NO">
Expand All @@ -39,17 +48,6 @@
</BuildableReference>
</TestableReference>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "5F23E6F51D4B87F000C3F2D9"
BuildableName = "Auth0.framework"
BlueprintName = "Auth0.tvOS"
ReferencedContainer = "container:Auth0.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
Expand All @@ -70,8 +68,6 @@
ReferencedContainer = "container:Auth0.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
Expand Down
2 changes: 1 addition & 1 deletion Auth0/AuthSession.swift
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class AuthSession: NSObject, AuthTransaction {
self.finish(.failure(error: AuthenticationError(string: url.absoluteString, statusCode: 200)))
return false
}
var items = self.handler.values(fromComponents: components)
let items = self.handler.values(fromComponents: components)
guard has(state: self.state, inItems: items) else { return false }
if items["error"] != nil {
self.finish(.failure(error: AuthenticationError(info: items, statusCode: 0)))
Expand Down
Loading