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 .editorconfig
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Swift source code
[*.swift]
indent_style = tab
indent_style = space
indent_size = 4

# GitHub Actions workflow files
Expand Down
2 changes: 2 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Convert Swift indentation from tabs to spaces.
7854fb15cdcf69e58d4ccbc8294699422edba91c
Comment thread
DominikPalo marked this conversation as resolved.
Resolved
2 changes: 1 addition & 1 deletion OAuth2.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,7 @@
EEDB8625193FAAE500C4EEA1 /* Products */,
);
sourceTree = "<group>";
usesTabs = 1;
usesTabs = 0;
};
EEDB8625193FAAE500C4EEA1 /* Products */ = {
isa = PBXGroup;
Expand Down
56 changes: 28 additions & 28 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,32 +22,32 @@
import PackageDescription

let package = Package(
name: "OAuth2",
platforms: [
.macOS(.v10_15), .iOS(.v13), .tvOS(.v13), .watchOS(.v6)
],
products: [
.library(name: "OAuth2", targets: ["OAuth2"]),
],
dependencies: [
.package(url: "https://github.com/slidoapp/SwiftKeychain.git", .upToNextMinor(from: "2.1.0")),
.package(url: "https://github.com/groue/Semaphore.git", .upToNextMinor(from: "0.1.0")),
.package(url: "https://github.com/apple/swift-log.git", .upToNextMinor(from: "1.6.4"))
],
targets: [
.target(name: "OAuth2",
dependencies: ["Base", "Flows", "DataLoader"]),
.target(name: "Base", dependencies: ["SwiftKeychain", "Semaphore", .product(name: "Logging", package: "swift-log")]),
.target(name: "macOS", dependencies: [.target(name: "Base")]),
.target(name: "iOS", dependencies: [.target(name: "Base")]),
.target(name: "tvOS", dependencies: [.target(name: "Base")]),
.target(name: "Constants"),
.target(name: "Flows", dependencies: [
.target(name: "macOS"), .target(name: "iOS"), .target(name: "tvOS"), .target(name: "Constants")]),
.target(name: "DataLoader", dependencies: [.target(name: "Flows")]),
.target(name: "TestUtils", dependencies: [.target(name: "Base")]),
.testTarget(name: "BaseTests", dependencies: [.target(name: "TestUtils"), .target(name: "Base"), .target(name: "Flows")]),
.testTarget(name: "FlowTests", dependencies: [.target(name: "TestUtils"), .target(name: "Flows")]),
// .testTarget(name: "DataLoaderTests", dependencies: [.target(name: "DataLoader")]),
]
name: "OAuth2",
platforms: [
.macOS(.v10_15), .iOS(.v13), .tvOS(.v13), .watchOS(.v6)
],
products: [
.library(name: "OAuth2", targets: ["OAuth2"]),
],
dependencies: [
.package(url: "https://github.com/slidoapp/SwiftKeychain.git", .upToNextMinor(from: "2.1.0")),
.package(url: "https://github.com/groue/Semaphore.git", .upToNextMinor(from: "0.1.0")),
.package(url: "https://github.com/apple/swift-log.git", .upToNextMinor(from: "1.6.4"))
],
targets: [
.target(name: "OAuth2",
dependencies: ["Base", "Flows", "DataLoader"]),
.target(name: "Base", dependencies: ["SwiftKeychain", "Semaphore", .product(name: "Logging", package: "swift-log")]),
.target(name: "macOS", dependencies: [.target(name: "Base")]),
.target(name: "iOS", dependencies: [.target(name: "Base")]),
.target(name: "tvOS", dependencies: [.target(name: "Base")]),
.target(name: "Constants"),
.target(name: "Flows", dependencies: [
.target(name: "macOS"), .target(name: "iOS"), .target(name: "tvOS"), .target(name: "Constants")]),
.target(name: "DataLoader", dependencies: [.target(name: "Flows")]),
.target(name: "TestUtils", dependencies: [.target(name: "Base")]),
.testTarget(name: "BaseTests", dependencies: [.target(name: "TestUtils"), .target(name: "Base"), .target(name: "Flows")]),
.testTarget(name: "FlowTests", dependencies: [.target(name: "TestUtils"), .target(name: "Flows")]),
// .testTarget(name: "DataLoaderTests", dependencies: [.target(name: "DataLoader")]),
]
)
2 changes: 1 addition & 1 deletion Sources/Base/OAuth2Actor.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
@globalActor public actor OAuth2Actor : GlobalActor {
public static let shared = OAuth2Actor()
public static let shared = OAuth2Actor()
}
76 changes: 38 additions & 38 deletions Sources/Base/OAuth2AuthConfig.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,43 +27,43 @@ import UIKit
Simple struct to hold settings describing how authorization appears to the user.
*/
public struct OAuth2AuthConfig: Sendable {
/// Sub-stuct holding configuration relevant to UI presentation.
public struct UI: Sendable {
/// Title to propagate to views handled by OAuth2, such as OAuth2WebViewController.
public var title: String? = nil
/// Starting with iOS 12, `ASWebAuthenticationSession` can be used for embedded authorization instead of our custom class. You can turn this on here.
public var useAuthenticationSession = true
/// May be passed through to [ASWebAuthenticationSession](https://developer.apple.com/documentation/authenticationservices/aswebauthenticationsession/3237231-prefersephemeralwebbrowsersessio).
public var prefersEphemeralWebBrowserSession = false
#if os(iOS)
/// By assigning your own style you can configure how the embedded authorization is presented.
public var modalPresentationStyle = UIModalPresentationStyle.fullScreen
/// Assign a UIColor here, to be applied to the Safari view controller (in iOS 10.10+) or the navigation's bar tint color if using the legacy web view controller.
public var barTintColor: UIColor? = nil
/// You can assign a UIColor here, which will be applied to Safari's (in iOS 10.10+) or the legacy web view controller's item tint colors (also see: `barTintColor`).
public var controlTintColor: UIColor? = nil
#endif
}
/// Whether to use an embedded web view for authorization (true) or the OS browser (false, the default).
public var authorizeEmbedded = false
/// Whether to automatically dismiss the auto-presented authorization screen.
public var authorizeEmbeddedAutoDismiss = true
/// Context information for the authorization flow:
/// - iOS: The parent view controller to present from
/// - macOS: An NSWindow from which to present a modal sheet _or_ `nil` to present in a new window
public nonisolated(unsafe) weak var authorizeContext: (AnyObject)? = nil
/// UI-specific configuration.
public var ui = UI()

/// Sub-stuct holding configuration relevant to UI presentation.
public struct UI: Sendable {

/// Title to propagate to views handled by OAuth2, such as OAuth2WebViewController.
public var title: String? = nil

/// Starting with iOS 12, `ASWebAuthenticationSession` can be used for embedded authorization instead of our custom class. You can turn this on here.
public var useAuthenticationSession = true

/// May be passed through to [ASWebAuthenticationSession](https://developer.apple.com/documentation/authenticationservices/aswebauthenticationsession/3237231-prefersephemeralwebbrowsersessio).
public var prefersEphemeralWebBrowserSession = false

#if os(iOS)
/// By assigning your own style you can configure how the embedded authorization is presented.
public var modalPresentationStyle = UIModalPresentationStyle.fullScreen

/// Assign a UIColor here, to be applied to the Safari view controller (in iOS 10.10+) or the navigation's bar tint color if using the legacy web view controller.
public var barTintColor: UIColor? = nil

/// You can assign a UIColor here, which will be applied to Safari's (in iOS 10.10+) or the legacy web view controller's item tint colors (also see: `barTintColor`).
public var controlTintColor: UIColor? = nil
#endif
}

/// Whether to use an embedded web view for authorization (true) or the OS browser (false, the default).
public var authorizeEmbedded = false

/// Whether to automatically dismiss the auto-presented authorization screen.
public var authorizeEmbeddedAutoDismiss = true

/// Context information for the authorization flow:
/// - iOS: The parent view controller to present from
/// - macOS: An NSWindow from which to present a modal sheet _or_ `nil` to present in a new window
public nonisolated(unsafe) weak var authorizeContext: (AnyObject)? = nil

/// UI-specific configuration.
public var ui = UI()
}

Loading
Loading