diff --git a/Package.swift b/Package.swift index 5f3f68d4c..818b20253 100644 --- a/Package.swift +++ b/Package.swift @@ -43,7 +43,6 @@ var package = Package( .library(name: "AuthFoundation", targets: ["AuthFoundation"]), .library(name: "OktaOAuth2", targets: ["OktaOAuth2"]), .library(name: "OktaDirectAuth", targets: ["OktaDirectAuth"]), - .library(name: "WebAuthenticationUI", targets: ["WebAuthenticationUI"]) ], dependencies: [ .package(url: "https://github.com/apple/swift-docc-plugin", from: "1.0.0"), @@ -234,25 +233,6 @@ var package = Package( .target(name: "AuthFoundationTestCommon"), ], resources: [ .process("MockResponses") ]), - - // WebAuthenticationUI - .target(name: "WebAuthenticationUI", - dependencies: [ - .target(name: "OktaOAuth2") - ], - exclude: exclude(), - resources: include(.process("Resources"))), - .testTarget(name: "WebAuthenticationUITests", - dependencies: [ - .target(name: "WebAuthenticationUI"), - .target(name: "OktaOAuth2"), - .target(name: "AuthFoundation"), - .target(name: "TestCommon"), - .target(name: "KeychainTestCommon"), - .target(name: "APIClientTestCommon"), - .target(name: "AuthFoundationTestCommon"), - ], - resources: [ .process("MockResponses") ]), ], swiftLanguageVersions: [.v5] ) @@ -267,3 +247,27 @@ for target in package.targets where target.type != .system && target.type != .te ]) } #endif + +#if canImport(Darwin) +// WebAuthenticationUI +package.products.append(.library(name: "WebAuthenticationUI", targets: ["WebAuthenticationUI"])) +package.targets.append(contentsOf: [ + .target(name: "WebAuthenticationUI", + dependencies: [ + .target(name: "OktaOAuth2") + ], + exclude: exclude(), + resources: include(.process("Resources"))), + .testTarget(name: "WebAuthenticationUITests", + dependencies: [ + .target(name: "WebAuthenticationUI"), + .target(name: "OktaOAuth2"), + .target(name: "AuthFoundation"), + .target(name: "TestCommon"), + .target(name: "KeychainTestCommon"), + .target(name: "APIClientTestCommon"), + .target(name: "AuthFoundationTestCommon"), + ], + resources: [ .process("MockResponses") ]), +]) +#endif diff --git a/Sources/APIClient/APIClient.swift b/Sources/APIClient/APIClient.swift index 4823b27c7..54682a1a0 100644 --- a/Sources/APIClient/APIClient.swift +++ b/Sources/APIClient/APIClient.swift @@ -13,7 +13,7 @@ import Foundation #if os(Linux) -import FoundationNetworking +@_exported import FoundationNetworking #endif import OktaUtilities diff --git a/Sources/APIClient/Extensions/DefaultTimeCoordinator+Extensions.swift b/Sources/APIClient/Extensions/DefaultTimeCoordinator+Extensions.swift index 96a664199..fdc131d1f 100644 --- a/Sources/APIClient/Extensions/DefaultTimeCoordinator+Extensions.swift +++ b/Sources/APIClient/Extensions/DefaultTimeCoordinator+Extensions.swift @@ -13,6 +13,10 @@ import Foundation import OktaUtilities +#if os(Linux) +import FoundationNetworking +#endif + extension DefaultTimeCoordinator: APIClientDelegate { public func api(client: any APIClient, didSend request: URLRequest, received response: HTTPURLResponse) { guard request.cachePolicy == .reloadIgnoringLocalAndRemoteCacheData, diff --git a/Sources/AuthFoundation/User Management/CredentialSecurity.swift b/Sources/AuthFoundation/User Management/CredentialSecurity.swift index 4ef0b7bd6..e0280f17e 100644 --- a/Sources/AuthFoundation/User Management/CredentialSecurity.swift +++ b/Sources/AuthFoundation/User Management/CredentialSecurity.swift @@ -45,8 +45,6 @@ extension Credential { /// Defines a custom LocalAuthentication context for interactions with this credential, for systems that support it. case context(_ obj: LAContext) #endif - #else - public static var standard: [Security] = [] #endif } } diff --git a/Sources/JWT/Internal/DefaultTokenHashValidator.swift b/Sources/JWT/Internal/DefaultTokenHashValidator.swift index a5a12a660..b0ad624dc 100644 --- a/Sources/JWT/Internal/DefaultTokenHashValidator.swift +++ b/Sources/JWT/Internal/DefaultTokenHashValidator.swift @@ -53,7 +53,7 @@ public struct DefaultTokenHashValidator: TokenHashValidator { } #if !canImport(CommonCrypto) - func validate(_ string: String, idToken: JWT) throws { + public func validate(_ string: String, idToken: JWT) throws { throw JWTError.signatureVerificationUnavailable } #else diff --git a/Sources/OktaConcurrency/CoalescedResult.swift b/Sources/OktaConcurrency/CoalescedResult.swift index 1931211c5..c5219b0cd 100644 --- a/Sources/OktaConcurrency/CoalescedResult.swift +++ b/Sources/OktaConcurrency/CoalescedResult.swift @@ -10,7 +10,7 @@ // See the License for the specific language governing permissions and limitations under the License. // -import Foundation +@preconcurrency import Foundation public final class CoalescedResult: Sendable { private let lock = Lock() diff --git a/Tests/AuthFoundationTests/CredentialNotificationTests.swift b/Tests/AuthFoundationTests/CredentialNotificationTests.swift index afd657d81..0922fd12e 100644 --- a/Tests/AuthFoundationTests/CredentialNotificationTests.swift +++ b/Tests/AuthFoundationTests/CredentialNotificationTests.swift @@ -56,22 +56,26 @@ final class CredentialNotificationTests: XCTestCase { coordinator = nil } - @MainActor func testNotifications() throws { - let oldCredential = coordinator.default + let wait = expectation(description: "Main actor") - let recorder = NotificationRecorder(observing: [.defaultCredentialChanged]) - - let credential = try coordinator.store(token: token, security: []) - wait(for: .standard) - XCTAssertEqual(recorder.notifications.count, 1) - XCTAssertEqual(recorder.notifications.first?.object as? Credential, credential) - XCTAssertNotEqual(oldCredential, credential) - - recorder.reset() - coordinator.default = nil - wait(for: .standard) - XCTAssertEqual(recorder.notifications.count, 1) - XCTAssertNil(recorder.notifications.first?.object) + Task { @MainActor in + let oldCredential = coordinator.default + + let recorder = NotificationRecorder(observing: [.defaultCredentialChanged]) + + let credential = try coordinator.store(token: token, security: []) + self.wait(for: .standard) + XCTAssertEqual(recorder.notifications.count, 1) + XCTAssertEqual(recorder.notifications.first?.object as? Credential, credential) + XCTAssertNotEqual(oldCredential, credential) + + recorder.reset() + coordinator.default = nil + self.wait(for: .standard) + XCTAssertEqual(recorder.notifications.count, 1) + XCTAssertNil(recorder.notifications.first?.object) + } + waitForExpectations(timeout: .long) } } diff --git a/Tests/OktaUtilitiesTests/SDKVersionMigrationTests.swift b/Tests/OktaUtilitiesTests/SDKVersionMigrationTests.swift index 82f4cf322..9c0cedce0 100644 --- a/Tests/OktaUtilitiesTests/SDKVersionMigrationTests.swift +++ b/Tests/OktaUtilitiesTests/SDKVersionMigrationTests.swift @@ -17,7 +17,7 @@ enum TestMigratorError: Error { case generic } -class TestMigrator: AnyObject, SDKVersionMigrator, @unchecked Sendable { +class TestMigrator: SDKVersionMigrator, @unchecked Sendable { var error: Error? private(set) var migrationCalled: Bool = false