From b616af78c0c76df6f132cace066837ed199e7348 Mon Sep 17 00:00:00 2001 From: Mike Nachbaur Date: Wed, 14 Feb 2024 15:48:23 -0800 Subject: [PATCH] Update linting rules --- .swiftlint.yml | 1 + .../OIDCMigration/OIDCSignInViewController.swift | 3 ++- .../Migration/Migrators/OIDCLegacyMigrator.swift | 12 ++++++++---- .../Utilities/DelegateCollection.swift | 3 +-- .../AuthFoundation/Utilities/TimeCoordinator.swift | 3 +-- Sources/OktaDirectAuth/DirectAuthFlow.swift | 2 +- .../Internal/Requests/OOBAuthenticateRequest.swift | 2 +- .../Internal/Requests/WebAuthnRequest.swift | 2 +- .../WebAuthn/PublicKeyCredentialDescriptor.swift | 1 + .../WebAuthn/PublicKeyCredentialRequestOptions.swift | 1 + .../WebAuthn/Type/AuthenticatorTransport.swift | 1 + .../WebAuthn/Type/PublicKeyCredentialType.swift | 1 + .../WebAuthn/Type/UserVerificationRequirement.swift | 1 + 13 files changed, 21 insertions(+), 12 deletions(-) diff --git a/.swiftlint.yml b/.swiftlint.yml index 308e21d33..496c466e0 100644 --- a/.swiftlint.yml +++ b/.swiftlint.yml @@ -12,6 +12,7 @@ only_rules: - operator_usage_whitespace - return_arrow_whitespace - trailing_whitespace + - attributes # Empty - empty_collection_literal diff --git a/Samples/OIDCMigration/OIDCMigration/OIDCSignInViewController.swift b/Samples/OIDCMigration/OIDCMigration/OIDCSignInViewController.swift index 7fdf56bb0..eecbc7025 100644 --- a/Samples/OIDCMigration/OIDCMigration/OIDCSignInViewController.swift +++ b/Samples/OIDCMigration/OIDCMigration/OIDCSignInViewController.swift @@ -35,7 +35,8 @@ class OIDCSignInViewController: UIViewController { object: nil) } - @objc func dismissProfile() { + @objc + func dismissProfile() { guard presentedViewController != nil else { return } self.presentedViewController?.dismiss(animated: true, completion: { diff --git a/Sources/AuthFoundation/Migration/Migrators/OIDCLegacyMigrator.swift b/Sources/AuthFoundation/Migration/Migrators/OIDCLegacyMigrator.swift index 17da6a238..2240c7c66 100644 --- a/Sources/AuthFoundation/Migration/Migrators/OIDCLegacyMigrator.swift +++ b/Sources/AuthFoundation/Migration/Migrators/OIDCLegacyMigrator.swift @@ -209,7 +209,8 @@ extension SDKVersion.Migration { NotificationCenter.default.post(name: .credentialMigrated, object: credential) } - @objc(_OIDCLegacyStateManager) class StateManager: NSObject, NSCoding { + @objc(_OIDCLegacyStateManager) + class StateManager: NSObject, NSCoding { @objc let authState: AuthState? @objc let accessibility: String? @@ -220,7 +221,8 @@ extension SDKVersion.Migration { accessibility = coder.decodeObject(forKey: "accessibility") as? String } - @objc(_OIDCLegacyAuthState) class AuthState: NSObject, NSCoding { + @objc(_OIDCLegacyAuthState) + class AuthState: NSObject, NSCoding { @objc let refreshToken: String? @objc let scope: String? @objc let lastTokenResponse: TokenResponse? @@ -236,7 +238,8 @@ extension SDKVersion.Migration { } } - @objc(_OIDCLegacyTokenResponse) class TokenResponse: NSObject, NSCoding { + @objc(_OIDCLegacyTokenResponse) + class TokenResponse: NSObject, NSCoding { @objc let accessToken: String? @objc let accessTokenExpirationDate: Date? @objc let tokenType: String? @@ -258,7 +261,8 @@ extension SDKVersion.Migration { } } - @objc(_OIDCLegacyAuthorizationResponse) class AuthorizationResponse: NSObject, NSCoding { + @objc(_OIDCLegacyAuthorizationResponse) + class AuthorizationResponse: NSObject, NSCoding { @objc let authorizationCode: String? @objc let state: String? diff --git a/Sources/AuthFoundation/Utilities/DelegateCollection.swift b/Sources/AuthFoundation/Utilities/DelegateCollection.swift index 3cc11f39a..d5f430d3e 100644 --- a/Sources/AuthFoundation/Utilities/DelegateCollection.swift +++ b/Sources/AuthFoundation/Utilities/DelegateCollection.swift @@ -26,8 +26,7 @@ extension UsesDelegateCollection { } public final class DelegateCollection { - @WeakCollection - private var delegates: [AnyObject?] + @WeakCollection private var delegates: [AnyObject?] public init() { delegates = [] diff --git a/Sources/AuthFoundation/Utilities/TimeCoordinator.swift b/Sources/AuthFoundation/Utilities/TimeCoordinator.swift index 5b30fa44e..2ed13c487 100644 --- a/Sources/AuthFoundation/Utilities/TimeCoordinator.swift +++ b/Sources/AuthFoundation/Utilities/TimeCoordinator.swift @@ -53,8 +53,7 @@ class DefaultTimeCoordinator: TimeCoordinator, OAuth2ClientDelegate { Date.coordinator = DefaultTimeCoordinator() } - @ThreadSafe - private(set) var offset: TimeInterval + @ThreadSafe private(set) var offset: TimeInterval private var observer: NSObjectProtocol? diff --git a/Sources/OktaDirectAuth/DirectAuthFlow.swift b/Sources/OktaDirectAuth/DirectAuthFlow.swift index 193b7c765..9ef0ccbc7 100644 --- a/Sources/OktaDirectAuth/DirectAuthFlow.swift +++ b/Sources/OktaDirectAuth/DirectAuthFlow.swift @@ -39,7 +39,7 @@ public enum DirectAuthenticationFlowError: Error { /// This enables developers to build native sign-in workflows into their applications, while leveraging MFA to securely authenticate users, without the need to present a browser. Furthermore, this enables passwordless authentication scenarios by giving developers the power to choose which primary and secondary authentication factors to use when challenging a user for their credentials. public class DirectAuthenticationFlow: AuthenticationFlow { /// Enumeration defining the list of possible primary authentication factors. - /// + /// /// These values are used by the ``DirectAuthenticationFlow/start(_:with:)`` function. public enum PrimaryFactor: Equatable { /// Authenticate the user with the given password. diff --git a/Sources/OktaDirectAuth/Internal/Requests/OOBAuthenticateRequest.swift b/Sources/OktaDirectAuth/Internal/Requests/OOBAuthenticateRequest.swift index 7a017f304..9bc1dc402 100644 --- a/Sources/OktaDirectAuth/Internal/Requests/OOBAuthenticateRequest.swift +++ b/Sources/OktaDirectAuth/Internal/Requests/OOBAuthenticateRequest.swift @@ -36,7 +36,7 @@ struct OOBResponse: Codable, HasTokenParameters { self.bindingCode = bindingCode } - var tokenParameters: [String : Any]? { + var tokenParameters: [String: Any]? { ["oob_code": oobCode] } } diff --git a/Sources/OktaDirectAuth/Internal/Requests/WebAuthnRequest.swift b/Sources/OktaDirectAuth/Internal/Requests/WebAuthnRequest.swift index 539507820..77c43b86c 100644 --- a/Sources/OktaDirectAuth/Internal/Requests/WebAuthnRequest.swift +++ b/Sources/OktaDirectAuth/Internal/Requests/WebAuthnRequest.swift @@ -64,7 +64,7 @@ extension WebAuthnChallengeRequest: APIRequest, APIRequestBody { } extension WebAuthn.AuthenticatorAssertionResponse: HasTokenParameters { - var tokenParameters: [String : Any]? { + var tokenParameters: [String: Any]? { var result = [ "clientDataJSON": clientDataJSON, "authenticatorData": authenticatorData, diff --git a/Sources/OktaDirectAuth/WebAuthn/PublicKeyCredentialDescriptor.swift b/Sources/OktaDirectAuth/WebAuthn/PublicKeyCredentialDescriptor.swift index 52f1f4843..217eecdef 100644 --- a/Sources/OktaDirectAuth/WebAuthn/PublicKeyCredentialDescriptor.swift +++ b/Sources/OktaDirectAuth/WebAuthn/PublicKeyCredentialDescriptor.swift @@ -1,3 +1,4 @@ +// // Copyright (c) 2023-Present, Okta, Inc. and/or its affiliates. All rights reserved. // The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.") // diff --git a/Sources/OktaDirectAuth/WebAuthn/PublicKeyCredentialRequestOptions.swift b/Sources/OktaDirectAuth/WebAuthn/PublicKeyCredentialRequestOptions.swift index da77a6c7a..f1ed62380 100644 --- a/Sources/OktaDirectAuth/WebAuthn/PublicKeyCredentialRequestOptions.swift +++ b/Sources/OktaDirectAuth/WebAuthn/PublicKeyCredentialRequestOptions.swift @@ -1,3 +1,4 @@ +// // Copyright (c) 2023-Present, Okta, Inc. and/or its affiliates. All rights reserved. // The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.") // diff --git a/Sources/OktaDirectAuth/WebAuthn/Type/AuthenticatorTransport.swift b/Sources/OktaDirectAuth/WebAuthn/Type/AuthenticatorTransport.swift index 9b4a91d6a..cf916bef0 100644 --- a/Sources/OktaDirectAuth/WebAuthn/Type/AuthenticatorTransport.swift +++ b/Sources/OktaDirectAuth/WebAuthn/Type/AuthenticatorTransport.swift @@ -1,3 +1,4 @@ +// // Copyright (c) 2023-Present, Okta, Inc. and/or its affiliates. All rights reserved. // The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.") // diff --git a/Sources/OktaDirectAuth/WebAuthn/Type/PublicKeyCredentialType.swift b/Sources/OktaDirectAuth/WebAuthn/Type/PublicKeyCredentialType.swift index 2bf023594..b20354fc0 100644 --- a/Sources/OktaDirectAuth/WebAuthn/Type/PublicKeyCredentialType.swift +++ b/Sources/OktaDirectAuth/WebAuthn/Type/PublicKeyCredentialType.swift @@ -1,3 +1,4 @@ +// // Copyright (c) 2023-Present, Okta, Inc. and/or its affiliates. All rights reserved. // The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.") // diff --git a/Sources/OktaDirectAuth/WebAuthn/Type/UserVerificationRequirement.swift b/Sources/OktaDirectAuth/WebAuthn/Type/UserVerificationRequirement.swift index c51a40a1b..a787d86e5 100644 --- a/Sources/OktaDirectAuth/WebAuthn/Type/UserVerificationRequirement.swift +++ b/Sources/OktaDirectAuth/WebAuthn/Type/UserVerificationRequirement.swift @@ -1,3 +1,4 @@ +// // Copyright (c) 2023-Present, Okta, Inc. and/or its affiliates. All rights reserved. // The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.") //