Skip to content
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
2 changes: 1 addition & 1 deletion OktaAuthFoundation.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Provides the foundation and common features used to authenticate users, managing
s.authors = { "Okta Developers" => "developer@okta.com"}
s.source = { :git => "https://github.com/okta/okta-mobile-swift.git", :tag => s.version.to_s }

s.source_files = "Sources/{AuthFoundation,CommonSupport}/**/*.swift"
s.source_files = "Sources/{AuthFoundation,CommonSupport,JSON}/**/*.swift"
s.resource_bundles = { "AuthFoundation" => "Sources/AuthFoundation/Resources/**/*" }
s.swift_versions = ['5.10', '6.0']
s.prefix_header_file = false
Expand Down
11 changes: 9 additions & 2 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ var package = Package(
],
products: [
.library(name: "CommonSupport", targets: ["CommonSupport"]),
.library(name: "AuthFoundation", targets: ["CommonSupport", "AuthFoundation"]),
.library(name: "JSON", targets: ["JSON"]),
.library(name: "AuthFoundation", targets: ["CommonSupport", "JSON", "AuthFoundation"]),
.library(name: "OAuth2Auth", targets: ["OAuth2Auth"]),
.library(name: "OktaDirectAuth", targets: ["OktaDirectAuth"]),
.library(name: "OktaIdxAuth", targets: ["OktaIdxAuth"])
Expand All @@ -51,8 +52,11 @@ var package = Package(
targets: [
.target(name: "CommonSupport",
swiftSettings: .libraryTarget),
.target(name: "AuthFoundation",
.target(name: "JSON",
dependencies: ["CommonSupport"],
swiftSettings: .libraryTarget),
.target(name: "AuthFoundation",
dependencies: ["CommonSupport", "JSON"],
resources: [.process("Resources")],
swiftSettings: .libraryTarget),
.target(name: "OAuth2Auth",
Expand Down Expand Up @@ -81,6 +85,9 @@ var package = Package(
.testTarget(name: "CommonSupportTests",
dependencies: ["CommonSupport", "TestCommon"],
swiftSettings: .testTarget),
.testTarget(name: "JSONTests",
dependencies: ["JSON", "TestCommon"],
swiftSettings: .testTarget),
.testTarget(name: "AuthFoundationTests",
dependencies: ["AuthFoundation", "TestCommon"],
resources: [
Expand Down
4 changes: 4 additions & 0 deletions Sources/AuthFoundation/Debugging/APIRequestObserver.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ import OSLog
import CommonSupport
#endif

#if !COCOAPODS
import CommonSupport
#endif

#if compiler(<6.0)
extension OSLog: @unchecked Sendable {}
#endif
Expand Down
4 changes: 4 additions & 0 deletions Sources/AuthFoundation/JWT/JWK.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ import Foundation
import CommonSupport
#endif

#if !COCOAPODS
import CommonSupport
#endif

/// Describes an individual key from an authorization server, which can be used to validate tokens or encrypt content.
///
/// > Warning: At this time, this class only supports RSA Public Keys.
Expand Down
4 changes: 4 additions & 0 deletions Sources/AuthFoundation/Migration/Migration.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ import Foundation
import CommonSupport
#endif

#if !COCOAPODS
import CommonSupport
#endif

/// Namespace used for a variety of version migration agents.
public final class Migration {
/// Determines whether or not some user data needs to be migrated.
Expand Down
4 changes: 4 additions & 0 deletions Sources/AuthFoundation/Migration/SDKVersion.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ import Foundation
import CommonSupport
#endif

#if !COCOAPODS
import CommonSupport
#endif

#if canImport(UIKit)
import UIKit
#endif
Expand Down
4 changes: 4 additions & 0 deletions Sources/AuthFoundation/OAuth2/Authentication.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ import Foundation
import CommonSupport
#endif

#if !COCOAPODS
import CommonSupport
#endif

/// A common delegate protocol that all authentication flows should support.
public protocol AuthenticationDelegate: AnyObject {
/// Sent when an authentication session starts.
Expand Down
4 changes: 4 additions & 0 deletions Sources/AuthFoundation/OAuth2/OAuth2Client.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ import Foundation
import CommonSupport
#endif

#if !COCOAPODS
import CommonSupport
#endif

#if canImport(FoundationNetworking)
import FoundationNetworking
#endif
Expand Down
4 changes: 4 additions & 0 deletions Sources/AuthFoundation/Responses/OpenIdConfiguration.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@

import Foundation

#if !COCOAPODS
import JSON
#endif

/// Describes the configuration of an OpenID server.
///
/// The values exposed from this configuration are typically used during authentication, or when querying a server for its capabilities. This type uses ``HasClaims`` to represent the various provider metadata (represented as ``OpenIdConfiguration/ProviderMetadata``) for returning the full contents of the server's configuration. For more information, please see the ``HasClaims`` documentation.
Expand Down
4 changes: 4 additions & 0 deletions Sources/AuthFoundation/Security/Keychain.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ import Foundation
import CommonSupport
#endif

#if !COCOAPODS
import CommonSupport
#endif

#if os(iOS) || os(macOS) || os(tvOS) || os(watchOS) || (swift(>=5.10) && os(visionOS))

#if canImport(LocalAuthentication) && !os(tvOS)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@

import Foundation

#if !COCOAPODS
import JSON
#endif

extension Token {
/// When refreshing a token, not all values are always returned, especially the refresh token or device secret.
///
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@

import Foundation

#if !COCOAPODS
import JSON
#endif

extension Token {
public init(from decoder: any Decoder) throws {
// Initialize defaults supplied from the decoder's userInfo dictionary
Expand Down
5 changes: 5 additions & 0 deletions Sources/AuthFoundation/Token Management/Token.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@

import Foundation

#if !COCOAPODS
import CommonSupport
import JSON
#endif

#if !COCOAPODS
import CommonSupport
#endif
Expand Down
4 changes: 4 additions & 0 deletions Sources/AuthFoundation/User Management/Credential.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ import Foundation
import CommonSupport
#endif

#if !COCOAPODS
import CommonSupport
#endif

#if canImport(FoundationNetworking)
import FoundationNetworking
#endif
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ import Foundation
import CommonSupport
#endif

#if !COCOAPODS
import CommonSupport
#endif

#if canImport(Security)
#if compiler(<6.0)
import Security
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ import Foundation
import CommonSupport
#endif

#if !COCOAPODS
import CommonSupport
#endif

#if canImport(FoundationNetworking)
import FoundationNetworking
#endif
Expand Down
4 changes: 4 additions & 0 deletions Sources/AuthFoundation/Utilities/DelegateCollection.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ import Foundation
import CommonSupport
#endif

#if !COCOAPODS
import CommonSupport
#endif

/// Indicates the class contains a collection of delegates, and the necessary convenience functions to add and remove delegates from the collection.
public protocol UsesDelegateCollection {
associatedtype Delegate
Expand Down
4 changes: 4 additions & 0 deletions Sources/AuthFoundation/Utilities/TimeCoordinator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ import Foundation
import CommonSupport
#endif

#if !COCOAPODS
import CommonSupport
#endif

#if canImport(FoundationNetworking)
import FoundationNetworking
#endif
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ import Foundation
import CommonSupport
#endif

#if !COCOAPODS
import CommonSupport
#endif

public enum JSONError: Error {
case cannotDecode(value: (any Sendable)?)
case invalidContentEncoding
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
import Foundation
import AuthFoundation

#if !COCOAPODS
import JSON
#endif

extension WebAuthn {
/**
The PublicKeyCredentialRequestOptions dictionary supplies get() with the data it needs to generate an assertion. Its challenge member MUST be present, while its other members are OPTIONAL.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import AuthFoundation

#if !COCOAPODS
import CommonSupport
import JSON
#endif

/// Capability for authenticating a user with an existing WebAuthn credential.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import AuthFoundation

#if !COCOAPODS
import CommonSupport
import JSON
#endif

public enum WebAuthnCapabilityError: Error {
Expand Down
4 changes: 4 additions & 0 deletions Sources/OktaIdxAuth/IDXAuthenticator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@

import Foundation

#if !COCOAPODS
import JSON
#endif

/// Represents information describing the available authenticators and enrolled authenticators.
///
/// Instances of this class are used to identify the type of authenticator, or factor, that is associated with a user. These may be associated with form fields (for example, when selecting an authenticator to verify or to enrol in), with a ``Remediation`` (when challenging an authenticator for a verification code), or with an overall ``Response`` to indicate which authenticators have been enrolled, are being enrolled.
Expand Down
1 change: 1 addition & 0 deletions Sources/OktaIdxAuth/IDXFormField.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import AuthFoundation

#if !COCOAPODS
import CommonSupport
import JSON
#endif

extension Remediation.Form {
Expand Down
4 changes: 4 additions & 0 deletions Sources/OktaIdxAuth/IDXMessage.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ import Foundation
import CommonSupport
#endif

#if !COCOAPODS
import CommonSupport
#endif

extension Response {
/// Represents messages sent from the server to indicate error or warning conditions related to responses or form values.
public final class Message: Sendable, Equatable, Hashable {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
import Foundation
import AuthFoundation

#if !COCOAPODS
import JSON
#endif

extension Remediation {
func apiRequest() throws -> InteractionCodeFlow.RemediationRequest {
// Inform any capabilities associated with this remediation that it will proceed.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
import Foundation
import AuthFoundation

#if !COCOAPODS
import JSON
#endif

extension String {
static func relyingPartyIssuer(from json: JSON, issuerURL: URL) throws -> String {
// On registration requests, the server-supplied rpId value is within the `rp.id` path.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
import Foundation
import AuthFoundation

#if !COCOAPODS
import JSON
#endif

extension InteractionCodeFlow {
struct TokenRequest: AuthenticationFlowRequest {
typealias Flow = InteractionCodeFlow
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
import Foundation
import AuthFoundation

#if !COCOAPODS
import JSON
#endif

protocol ReferencesParent: AnyObject {
func assign<ParentType>(parent: ParentType?)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
import Foundation
import AuthFoundation

#if !COCOAPODS
import JSON
#endif

enum IDXIONObjectType: Sendable {
case Link
}
Expand Down
5 changes: 5 additions & 0 deletions Tests/AuthFoundationTests/TokenTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@
//

import XCTest

#if !COCOAPODS
import JSON
#endif

@testable import AuthFoundation
@testable import TestCommon

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@
*/

import XCTest
@testable import AuthFoundation

#if !COCOAPODS
@testable import JSON
#endif

class JSONTests: XCTestCase {
let decoder = JSONDecoder()
Expand Down Expand Up @@ -156,10 +159,7 @@ class JSONTests: XCTestCase {
}

func testConversions() throws {
let json = try decoder.decode(JSON.self,
from: try data(from: .module,
for: "openid-configuration",
in: "MockResponses"))
let json = try decoder.decode(JSON.self, from: Data(openidConfigurationJSONString.utf8))
let object = try XCTUnwrap(json.anyValue as? [String: Any])
let array = try XCTUnwrap(object["claims_supported"] as? [String])

Expand Down
Loading
Loading