Skip to content

Commit

Permalink
Updates to support Cocoapods (#179)
Browse files Browse the repository at this point in the history
  • Loading branch information
mikenachbaur-okta authored Feb 28, 2024
1 parent 3ca565b commit 13d94e6
Show file tree
Hide file tree
Showing 14 changed files with 55 additions and 69 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,24 @@ jobs:
- name: Test
run: swift test --parallel

Cocoapods:
name: CocoaPods Build
runs-on: macos-12
timeout-minutes: 10
needs:
- SwiftBuild
steps:
- uses: actions/checkout@master
- name: OktaAuthFoundation.podspec
run: pod lib lint --allow-warnings OktaAuthFoundation.podspec
# TODO: Enable dependent podspec linting once unreleased local spec version checking is fixed.
#- name: OktaOAuth2.podspec
# run: pod lib lint --allow-warnings OktaOAuth2.podspec
#- name: OktaDirectAuth.podspec
# run: pod lib lint --allow-warnings OktaDirectAuth.podspec
#- name: OktaWebAuthenticationUI.podspec
# run: pod lib lint --allow-warnings OktaWebAuthenticationUI.podspec

XcodeBuild:
name: Xcode Unit Tests
runs-on: macos-12
Expand Down
12 changes: 6 additions & 6 deletions OktaAuthFoundation.podspec
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
Pod::Spec.new do |s|
s.name = "OktaAuthFoundation"
s.module_name = "AuthFoundation"
s.version = "1.6.0"
s.version = "1.6.1"
s.summary = "Okta Authentication Foundation"
s.description = <<-DESC
Provides the foundation and common features used to authenticate users, managing the lifecycle and storage of tokens and credentials, and provide a base for other Okta SDKs to build upon.
DESC
s.platforms = {
:ios => "9.0",
:ios => "10.0",
:tvos => "10.0",
:watchos => "7.0",
:osx => "10.11"
:osx => "10.12"
}
s.ios.deployment_target = "9.0"
s.ios.deployment_target = "10.0"
s.tvos.deployment_target = "10.0"
s.watchos.deployment_target = "7.0"
s.osx.deployment_target = "10.11"
s.osx.deployment_target = "10.12"

s.homepage = "https://github.com/okta/okta-mobile-swift"
s.license = { :type => "APACHE2", :file => "LICENSE" }
s.authors = { "Okta Developers" => "[email protected]"}
s.source = { :git => "https://github.com/okta/okta-mobile-swift.git", :tag => s.version.to_s }
s.source_files = "Sources/AuthFoundation/**/*.swift"
s.resources = "Sources/AuthFoundation/Resources/*.lproj"
s.swift_version = "5.5"
s.swift_version = "5.6"
end
12 changes: 6 additions & 6 deletions OktaDirectAuth.podspec
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
Pod::Spec.new do |s|
s.name = "OktaDirectAuth"
s.version = "1.6.0"
s.version = "1.6.1"
s.summary = "Okta Direct Authentication"
s.description = <<-DESC
Enables application developers to build native sign in experiences using the Okta Direct Authentication API.
DESC
s.platforms = {
:ios => "9.0",
:ios => "10.0",
:tvos => "10.0",
:watchos => "7.0",
:osx => "10.11"
:osx => "10.12"
}
s.ios.deployment_target = "9.0"
s.ios.deployment_target = "10.0"
s.tvos.deployment_target = "10.0"
s.watchos.deployment_target = "7.0"
s.osx.deployment_target = "10.11"
s.osx.deployment_target = "10.12"

s.homepage = "https://github.com/okta/okta-mobile-swift"
s.license = { :type => "APACHE2", :file => "LICENSE" }
s.authors = { "Okta Developers" => "[email protected]"}
s.source = { :git => "https://github.com/okta/okta-mobile-swift.git", :tag => s.version.to_s }
s.source_files = "Sources/OktaDirectAuth/**/*.swift"
s.resources = "Sources/OktaDirectAuth/Resources/*.lproj"
s.swift_version = "5.5"
s.swift_version = "5.6"

s.dependency "OktaAuthFoundation", "#{s.version.to_s}"
end
12 changes: 6 additions & 6 deletions OktaOAuth2.podspec
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
Pod::Spec.new do |s|
s.name = "OktaOAuth2"
s.version = "1.6.0"
s.version = "1.6.1"
s.summary = "Okta OAuth2 Authentication"
s.description = <<-DESC
Enables application developers to authenticate users utilizing a variety of OAuth2 authentication flows.
DESC
s.platforms = {
:ios => "9.0",
:ios => "10.0",
:tvos => "10.0",
:watchos => "7.0",
:osx => "10.11"
:osx => "10.12"
}
s.ios.deployment_target = "9.0"
s.ios.deployment_target = "10.0"
s.tvos.deployment_target = "10.0"
s.watchos.deployment_target = "7.0"
s.osx.deployment_target = "10.11"
s.osx.deployment_target = "10.12"

s.homepage = "https://github.com/okta/okta-mobile-swift"
s.license = { :type => "APACHE2", :file => "LICENSE" }
s.authors = { "Okta Developers" => "[email protected]"}
s.source = { :git => "https://github.com/okta/okta-mobile-swift.git", :tag => s.version.to_s }
s.source_files = "Sources/OktaOAuth2/**/*.swift"
s.resources = "Sources/OktaOAuth2/Resources/*.lproj"
s.swift_version = "5.5"
s.swift_version = "5.6"

s.dependency "OktaAuthFoundation", "#{s.version.to_s}"
end
12 changes: 6 additions & 6 deletions OktaWebAuthenticationUI.podspec
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
Pod::Spec.new do |s|
s.name = "OktaWebAuthenticationUI"
s.module_name = "WebAuthenticationUI"
s.version = "1.6.0"
s.version = "1.6.1"
s.summary = "Okta Web Authentication UI"
s.description = <<-DESC
Authenticate users using web-based OIDC.
DESC
s.platforms = {
:ios => "9.0",
:osx => "10.11"
:ios => "10.0",
:osx => "10.12"
}
s.ios.deployment_target = "9.0"
s.osx.deployment_target = "10.11"
s.ios.deployment_target = "10.0"
s.osx.deployment_target = "10.12"

s.homepage = "https://github.com/okta/okta-mobile-swift"
s.license = { :type => "APACHE2", :file => "LICENSE" }
s.authors = { "Okta Developers" => "[email protected]"}
s.source = { :git => "https://github.com/okta/okta-mobile-swift.git", :tag => s.version.to_s }
s.source_files = "Sources/WebAuthenticationUI/**/*.swift"
s.resources = "Sources/WebAuthenticationUI/Resources/*.lproj"
s.swift_version = "5.5"
s.swift_version = "5.6"

s.dependency "OktaAuthFoundation", "#{s.version.to_s}"
s.dependency "OktaOAuth2", "#{s.version.to_s}"
Expand Down
11 changes: 4 additions & 7 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// swift-tools-version:5.5
// swift-tools-version:5.6
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription
Expand All @@ -7,10 +7,10 @@ var package = Package(
name: "AuthFoundation",
defaultLocalization: "en",
platforms: [
.iOS(.v9),
.iOS(.v10),
.tvOS(.v10),
.watchOS(.v7),
.macOS(.v10_11),
.macOS(.v10_12),
.macCatalyst(.v13)
],
products: [
Expand All @@ -20,6 +20,7 @@ var package = Package(
.library(name: "WebAuthenticationUI", targets: ["WebAuthenticationUI"])
],
dependencies: [
.package(url: "https://github.com/apple/swift-docc-plugin", from: "1.0.0")
],
targets: [
.target(name: "AuthFoundation",
Expand Down Expand Up @@ -59,7 +60,3 @@ var package = Package(
],
swiftLanguageVersions: [.v5]
)

#if swift(>=5.6)
package.dependencies.append(.package(url: "https://github.com/apple/swift-docc-plugin", from: "1.0.0"))
#endif
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ This library uses semantic versioning and follows Okta's [Library Version Policy

| Version | Status |
| ------- | ---------------------------------- |
| 1.6.0 | ✔️ Stable |
| 1.6.1 | ✔️ Stable |

The latest release can always be found on the [releases page][github-releases].

Expand Down Expand Up @@ -384,11 +384,11 @@ Only the last 4 major platform versions are officially supported, unless there a

| Platform | Supported | Best-Effort |
| ----------- | --------- | ----------- |
| iOS | 12.0 | 9.0 |
| iOS | 12.0 | 10.0 |
| tvOS | 12.0 | 10.0 |
| watchOS | 8.0 | 7.0 |
| macCatalyst | 13.0 | 13.0 |
| macOS | 12.0 | 10.11 |
| macOS | 12.0 | 10.12 |

Once a platform version becomes unsupported, dropping support for it will not be considered a breaking change and will be done in a minor release. For example, iOS 12 will cease to be supported when iOS 16 gets released, and might be dropped in a minor release.

Expand Down
29 changes: 0 additions & 29 deletions Samples/UserPasswordSignIn/UserPasswordSignIn (macOS)/main.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,7 @@ import Foundation
import ArgumentParser
import OktaOAuth2

#if swift(>=5.6)
typealias Command = AsyncParsableCommand
#else
typealias Command = ParsableCommand
#endif

@main
struct UserPasswordSignIn: Command {
Expand All @@ -37,7 +33,6 @@ struct UserPasswordSignIn: Command {
@Option(help: "Password")
var password: String?

#if swift(>=5.6)
mutating func run() async throws {
guard #available(macOS 12, *) else {
print("'user-password-sign-in' isn't supported on this platform.")
Expand All @@ -49,28 +44,4 @@ struct UserPasswordSignIn: Command {
password: try promptPassword())
printUserInfo(using: token)
}
#else
mutating func run() throws {
guard #available(macOS 12, *) else {
print("'user-password-sign-in' isn't supported on this platform.")
return
}

let flow = try createFlow()

let group = DispatchGroup()
group.enter()
flow.start(username: try promptUsername(),
password: try promptPassword()) { result in
defer { group.leave() }
switch result {
case .success(let token):
printUserInfo(using: token)
case .failure(let error):
print(error)
}
}
_ = group.wait(timeout: .now() + 30)
}
#endif
}
2 changes: 1 addition & 1 deletion Sources/AuthFoundation/Version.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@
import Foundation

// swiftlint:disable identifier_name
public let Version = SDKVersion(sdk: "okta-authfoundation-swift", version: "1.6.0")
public let Version = SDKVersion(sdk: "okta-authfoundation-swift", version: "1.6.1")
// swiftlint:enable identifier_name
2 changes: 1 addition & 1 deletion Sources/OktaDirectAuth/Version.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@
@_exported import AuthFoundation

// swiftlint:disable identifier_name
public let Version = SDKVersion(sdk: "okta-directauth-swift", version: "1.6.0")
public let Version = SDKVersion(sdk: "okta-directauth-swift", version: "1.6.1")
// swiftlint:enable identifier_name
2 changes: 1 addition & 1 deletion Sources/OktaOAuth2/Version.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@
@_exported import AuthFoundation

// swiftlint:disable identifier_name
public let Version = SDKVersion(sdk: "okta-oauth2-swift", version: "1.6.0")
public let Version = SDKVersion(sdk: "okta-oauth2-swift", version: "1.6.1")
// swiftlint:enable identifier_name
2 changes: 1 addition & 1 deletion Sources/WebAuthenticationUI/Version.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ import Foundation
import AuthFoundation

// swiftlint:disable identifier_name
public let Version = SDKVersion(sdk: "okta-webauthenticationui-swift", version: "1.6.0")
public let Version = SDKVersion(sdk: "okta-webauthenticationui-swift", version: "1.6.1")
// swiftlint:enable identifier_name
2 changes: 1 addition & 1 deletion Sources/WebAuthenticationUI/WebAuthentication.swift
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ public class WebAuthentication {
delegate: delegate)
}

if #available(iOS 9.0, *) {
if #available(iOS 10.0, *) {
return SafariBrowserProvider(loginFlow: loginFlow,
logoutFlow: logoutFlow,
from: window,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ To maximize the number of platforms and OS versions your application can support

Platform | Versions | Authentication Controller |
---|---|---
iOS | 9.0 - 10.x | SFSafariViewController
iOS | 10.0 - 10.x | SFSafariViewController
iOS | 11.0 | SFAuthenticationSession
iOS | 12.0 - Current | ASWebAuthenticationSession
macOS | 10.15 - Current | ASWebAuthenticationSession
Expand Down

0 comments on commit 13d94e6

Please sign in to comment.