Skip to content

Commit cbeff2e

Browse files
authored
Relocate common concurrency features into a separate library for reuse (#257)
* Relocate common concurrency features into a separate library for reuse * Include CommonSupport in OktaAuthFoundation cocoapod * Update CommonSupport imports to be contextual for CocoaPods
1 parent 9fa0e14 commit cbeff2e

54 files changed

Lines changed: 370 additions & 169 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

OktaAuthFoundation.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Provides the foundation and common features used to authenticate users, managing
2424
s.authors = { "Okta Developers" => "developer@okta.com"}
2525
s.source = { :git => "https://github.com/okta/okta-mobile-swift.git", :tag => s.version.to_s }
2626

27-
s.source_files = "Sources/AuthFoundation/**/*.swift"
27+
s.source_files = "Sources/{AuthFoundation,CommonSupport}/**/*.swift"
2828
s.resource_bundles = { "AuthFoundation" => "Sources/AuthFoundation/Resources/**/*" }
2929
s.swift_versions = ['5.10', '6.0']
3030
s.prefix_header_file = false

Package.swift

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ var package = Package(
3939
.macCatalyst(.v13)
4040
],
4141
products: [
42-
.library(name: "AuthFoundation", targets: ["AuthFoundation"]),
42+
.library(name: "CommonSupport", targets: ["CommonSupport"]),
43+
.library(name: "AuthFoundation", targets: ["CommonSupport", "AuthFoundation"]),
4344
.library(name: "OAuth2Auth", targets: ["OAuth2Auth"]),
4445
.library(name: "OktaDirectAuth", targets: ["OktaDirectAuth"]),
4546
.library(name: "OktaIdxAuth", targets: ["OktaIdxAuth"])
@@ -48,8 +49,10 @@ var package = Package(
4849
.package(url: "https://github.com/apple/swift-docc-plugin", from: "1.4.0")
4950
],
5051
targets: [
52+
.target(name: "CommonSupport",
53+
swiftSettings: .libraryTarget),
5154
.target(name: "AuthFoundation",
52-
dependencies: [],
55+
dependencies: ["CommonSupport"],
5356
resources: [.process("Resources")],
5457
swiftSettings: .libraryTarget),
5558
.target(name: "OAuth2Auth",
@@ -75,6 +78,9 @@ var package = Package(
7578
dependencies: ["AuthFoundation"],
7679
path: "Tests/TestCommon",
7780
swiftSettings: .testTarget),
81+
.testTarget(name: "CommonSupportTests",
82+
dependencies: ["CommonSupport", "TestCommon"],
83+
swiftSettings: .testTarget),
7884
.testTarget(name: "AuthFoundationTests",
7985
dependencies: ["AuthFoundation", "TestCommon"],
8086
resources: [

Sources/AuthFoundation/Debugging/APIRequestObserver.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@
2020
import Foundation
2121
import OSLog
2222

23+
#if !COCOAPODS
24+
import CommonSupport
25+
#endif
26+
2327
#if compiler(<6.0)
2428
extension OSLog: @unchecked Sendable {}
2529
#endif

Sources/AuthFoundation/JWT/JWK.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@
1212

1313
import Foundation
1414

15+
#if !COCOAPODS
16+
import CommonSupport
17+
#endif
18+
1519
/// Describes an individual key from an authorization server, which can be used to validate tokens or encrypt content.
1620
///
1721
/// > Warning: At this time, this class only supports RSA Public Keys.

Sources/AuthFoundation/Migration/Migration.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@
1212

1313
import Foundation
1414

15+
#if !COCOAPODS
16+
import CommonSupport
17+
#endif
18+
1519
/// Namespace used for a variety of version migration agents.
1620
public final class Migration {
1721
/// Determines whether or not some user data needs to be migrated.

Sources/AuthFoundation/Migration/SDKVersion.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@
1212

1313
import Foundation
1414

15+
#if !COCOAPODS
16+
import CommonSupport
17+
#endif
18+
1519
#if canImport(UIKit)
1620
import UIKit
1721
#endif

Sources/AuthFoundation/OAuth2/Authentication.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@
1212

1313
import Foundation
1414

15+
#if !COCOAPODS
16+
import CommonSupport
17+
#endif
18+
1519
/// A common delegate protocol that all authentication flows should support.
1620
public protocol AuthenticationDelegate: AnyObject {
1721
/// Sent when an authentication session starts.

Sources/AuthFoundation/OAuth2/OAuth2Client.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@
1212

1313
import Foundation
1414

15+
#if !COCOAPODS
16+
import CommonSupport
17+
#endif
18+
1519
#if canImport(FoundationNetworking)
1620
import FoundationNetworking
1721
#endif

Sources/AuthFoundation/Security/Keychain.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@
1212

1313
import Foundation
1414

15+
#if !COCOAPODS
16+
import CommonSupport
17+
#endif
18+
1519
#if os(iOS) || os(macOS) || os(tvOS) || os(watchOS) || (swift(>=5.10) && os(visionOS))
1620

1721
#if canImport(LocalAuthentication) && !os(tvOS)

Sources/AuthFoundation/Token Management/Token.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@
1212

1313
import Foundation
1414

15+
#if !COCOAPODS
16+
import CommonSupport
17+
#endif
18+
1519
/// Token information representing a user's access to a resource server, including access token, refresh token, and other related information.
1620
public struct Token: Sendable, Codable, Equatable, Hashable, JSONClaimContainer, Expires {
1721
public typealias ClaimType = TokenClaim

0 commit comments

Comments
 (0)