diff --git a/Network Share Mounter/DefaultValues.plist b/Network Share Mounter/DefaultValues.plist index 96ebff46fe32ff777fe6b3edba6c859b8577dc01..1e4bffe20e473af4845f3af2eabe52094d810c8a 100644 --- a/Network Share Mounter/DefaultValues.plist +++ b/Network Share Mounter/DefaultValues.plist @@ -12,8 +12,6 @@ <string>Network Share Mounter</string> <key>keyChainComment</key> <string>Generated and used by Network Share Mounter</string> - <key>keychainiCloudSync</key> - <false/> <key>authenticationDialogImage</key> <string>nsm_logo</string> <key>kerberosRealm</key> diff --git a/Network Share Mounter/managers/KeychainManager.swift b/Network Share Mounter/managers/KeychainManager.swift index cebcf6dd23451745ffef0c9703625d6ea3092aad..a8bb08d661b22e63fc3003095e1195bbe00c6f04 100644 --- a/Network Share Mounter/managers/KeychainManager.swift +++ b/Network Share Mounter/managers/KeychainManager.swift @@ -45,7 +45,7 @@ struct Credentials { var password: String } -enum KeychainError: Error { +enum KeychainError: Error, Equatable { case noPassword case malformedShare case unexpectedPasswordData @@ -78,7 +78,7 @@ class KeychainManager: NSObject { kSecAttrServer as String: host, kSecAttrPath as String: path, kSecAttrLabel as String: host, - kSecAttrSynchronizable as String: prefs.bool(for: .keychainiCloudSync) ? kCFBooleanTrue as Any : kCFBooleanFalse as Any + kSecAttrSynchronizable as String: kCFBooleanFalse ] switch urlScheme { case "https": @@ -110,10 +110,11 @@ class KeychainManager: NSObject { /// - Parameter accessGroup: ``String?`` optional string with access group to keychain entry /// - Parameter label: ``String`` string containing keychain label name /// - Parameter comment: ``String?`` optional string with a comment to the keychain entry - func makeQuery(username: String, service: String = Defaults.keyChainService, accessGroup: String? = nil, label: String? = nil, comment: String? = nil, iCloudSync: Bool? = nil) throws -> [String: Any] { + func makeQuery(username: String, service: String = Defaults.keyChainService, accessGroup: String? = nil, label: String? = nil, comment: String? = nil) throws -> [String: Any] { var query: [String: Any] = [kSecClass as String: kSecClassGenericPassword, kSecAttrAccount as String: username, kSecAttrService as String: service, + kSecAttrSynchronizable as String: kCFBooleanFalse ] if let kcComment = comment { query[kSecAttrComment as String] = kcComment @@ -124,12 +125,7 @@ class KeychainManager: NSObject { if let kSecAttrLabel = label { query[kSecAttrLabel as String] = kSecAttrLabel } - if let synchronizable = iCloudSync { - query[kSecAttrSynchronizable as String] = synchronizable ? kCFBooleanTrue : kCFBooleanFalse - } else { - query[kSecAttrSynchronizable as String] = prefs.bool(for: .keychainiCloudSync) ? kCFBooleanTrue : kCFBooleanFalse - } - + return query } @@ -223,8 +219,8 @@ class KeychainManager: NSObject { /// delete a specific keychain entry defined by /// - Parameter forhUsername: ``String`` login for share /// - Parameter andService: ``String`` keychain service - /// - Parameter label: ``String`` keychain label - func removeCredential(forUsername username: String, andService service: String = Defaults.keyChainService, accessGroup: String = Defaults.keyChainAccessGroup, iCloudSync: Bool? = nil) throws { + /// - Parameter accessGroup: ``String`` access group + func removeCredential(forUsername username: String, andService service: String = Defaults.keyChainService, accessGroup: String = Defaults.keyChainAccessGroup) throws { do { // Check if an entry exists without retrieving the password guard credentialExists(forUsername: username, andService: service, accessGroup: accessGroup) else { @@ -232,12 +228,7 @@ class KeychainManager: NSObject { return } - var doiCloudSync = prefs.bool(for: .keychainiCloudSync) - if let doSync = iCloudSync { - doiCloudSync = doSync - } - - let query = try makeQuery(username: username, service: service, accessGroup: accessGroup, iCloudSync: doiCloudSync) + let query = try makeQuery(username: username, service: service, accessGroup: accessGroup) let status = SecItemDelete(query as CFDictionary) guard status == errSecSuccess else { @@ -280,7 +271,6 @@ class KeychainManager: NSObject { /// - Parameter forUsername: ``String`` username /// - Parameter andService: ``String`` service, defaults to Defaults.keyChainService /// - Parameter accessGroup: ``String`` accessGroup, defaults to Defaults.keyChainAccessGroup - /// - Parameter iCLoudSync: ``Bool?`` if account is iCLoud synced func retrievePassword(forUsername username: String, andService service: String = Defaults.keyChainService, accessGroup: String? = nil) throws -> String? { do { var query = try makeQuery(username: username, service: service, accessGroup: accessGroup) diff --git a/Network Share Mounter/preferences/PreferenceKeys.swift b/Network Share Mounter/preferences/PreferenceKeys.swift index 81653b1e7eb0df4cb40afa4898eadc56f359f94c..34ca053eb38f462ecd18f2874564c4112d2b7ebb 100644 --- a/Network Share Mounter/preferences/PreferenceKeys.swift +++ b/Network Share Mounter/preferences/PreferenceKeys.swift @@ -176,7 +176,6 @@ enum PreferenceKeys: String, CaseIterable { case customSharesKey = "customNetworkShares" case userNetworkShares = "userNetworkShares" case location = "location" - case keychainiCloudSync = "keychainiCloudSync" case authenticationDialogImage = "authenticationDialogImage" case keyChainService = "keyChainService" case keyChainLabel = "keyChainLabel" diff --git a/NetworkShareMounterTests/ManagerTests/KeychainManagerMockTests.swift b/NetworkShareMounterTests/ManagerTests/KeychainManagerMockTests.swift index a4d93ed8742aad728b9fe6aa08e28cfa6289d429..7288bc44c94d982abffd794bce6916db57cc2199 100644 --- a/NetworkShareMounterTests/ManagerTests/KeychainManagerMockTests.swift +++ b/NetworkShareMounterTests/ManagerTests/KeychainManagerMockTests.swift @@ -21,7 +21,7 @@ final class KeychainManagerMockTests: XCTestCase { return ["mockKey": "mockValue"] } - override func makeQuery(username: String, service: String = Defaults.keyChainService, accessGroup: String? = nil, label: String? = nil, comment: String? = nil, iCloudSync: Bool? = nil) throws -> [String: Any] { + override func makeQuery(username: String, service: String = Defaults.keyChainService, accessGroup: String? = nil, label: String? = nil, comment: String? = nil) throws -> [String: Any] { makeQueryCalled = true if shouldThrowOnMakeQuery { @@ -72,7 +72,7 @@ final class KeychainManagerMockTests: XCTestCase { savedCredentials.removeValue(forKey: key) } - override func removeCredential(forUsername username: String, andService service: String = Defaults.keyChainService, accessGroup: String = Defaults.keyChainAccessGroup, iCloudSync: Bool? = nil) throws { + override func removeCredential(forUsername username: String, andService service: String = Defaults.keyChainService, accessGroup: String = Defaults.keyChainAccessGroup) throws { let key = "\(service)|\(username)" savedCredentials.removeValue(forKey: key) } diff --git a/jamf-manifests/Network Share Mounter.json b/jamf-manifests/Network Share Mounter.json index 806f20ad852b396df8fe447f788cb2c866bf0926..8a35d689ffd692ad40824bc008a59ffa464f60ea 100644 --- a/jamf-manifests/Network Share Mounter.json +++ b/jamf-manifests/Network Share Mounter.json @@ -131,12 +131,6 @@ "type": "string", "default": "" }, - "keychainiCloudSync": { - "title": "Keychain iCloud sync", - "description": "Enable iCloud sync for Network Share Mounter keychain entries if the user's iCloud keychain is available.", - "type": "boolean", - "default": false - }, "keyChainService": { "title": "Keychain Service", "description": "Human readable service name of keychain item entry", diff --git a/networkShareMounter.xcodeproj/project.pbxproj b/networkShareMounter.xcodeproj/project.pbxproj index ca8d1899e268912c749638f9e163142dea7d9ada..e174b3e96902ba626ded8aff43959db7afd1951d 100644 --- a/networkShareMounter.xcodeproj/project.pbxproj +++ b/networkShareMounter.xcodeproj/project.pbxproj @@ -71,13 +71,6 @@ remoteGlobalIDString = F79B1594274E722000C322A8; remoteInfo = "Network Share Mounter"; }; - F79B15B0274E722100C322A8 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = D60FA5141E7FBE1300D9B5A5 /* Project object */; - proxyType = 1; - remoteGlobalIDString = F79B1594274E722000C322A8; - remoteInfo = "Network Share Mounter"; - }; /* End PBXContainerItemProxy section */ /* Begin PBXFileReference section */ @@ -103,7 +96,6 @@ F79B159B274E722100C322A8 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; }; F79B159E274E722100C322A8 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; }; F79B15A0274E722100C322A8 /* Network_Share_Mounter.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Network_Share_Mounter.entitlements; sourceTree = "<group>"; }; - F79B15AF274E722100C322A8 /* Network Share MounterUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "Network Share MounterUITests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; F79B15C2274E7D3600C322A8 /* Network-Share-Mounter-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist; path = "Network-Share-Mounter-Info.plist"; sourceTree = SOURCE_ROOT; }; F79B15C3274E800C00C322A8 /* NetworkShareMounterViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NetworkShareMounterViewController.swift; sourceTree = "<group>"; }; F7A383EC2B065E1400CA70E2 /* UserShare.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserShare.swift; sourceTree = "<group>"; }; @@ -162,13 +154,6 @@ ); runOnlyForDeploymentPostprocessing = 0; }; - F79B15AC274E722100C322A8 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ @@ -185,7 +170,6 @@ isa = PBXGroup; children = ( F79B1595274E722000C322A8 /* Network Share Mounter.app */, - F79B15AF274E722100C322A8 /* Network Share MounterUITests.xctest */, F706FED12D8EABCF001C2785 /* Network Share MounterTests.xctest */, ); name = Products; @@ -356,24 +340,6 @@ productReference = F79B1595274E722000C322A8 /* Network Share Mounter.app */; productType = "com.apple.product-type.application"; }; - F79B15AE274E722100C322A8 /* Network Share MounterUITests */ = { - isa = PBXNativeTarget; - buildConfigurationList = F79B15BF274E722100C322A8 /* Build configuration list for PBXNativeTarget "Network Share MounterUITests" */; - buildPhases = ( - F79B15AB274E722100C322A8 /* Sources */, - F79B15AC274E722100C322A8 /* Frameworks */, - F79B15AD274E722100C322A8 /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - F79B15B1274E722100C322A8 /* PBXTargetDependency */, - ); - name = "Network Share MounterUITests"; - productName = "Network Share MounterUITests"; - productReference = F79B15AF274E722100C322A8 /* Network Share MounterUITests.xctest */; - productType = "com.apple.product-type.bundle.ui-testing"; - }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ @@ -395,10 +361,6 @@ F79B1594274E722000C322A8 = { CreatedOnToolsVersion = 13.2; }; - F79B15AE274E722100C322A8 = { - CreatedOnToolsVersion = 13.2; - TestTargetID = F79B1594274E722000C322A8; - }; }; }; buildConfigurationList = D60FA5171E7FBE1300D9B5A5 /* Build configuration list for PBXProject "networkShareMounter" */; @@ -426,7 +388,6 @@ projectRoot = ""; targets = ( F79B1594274E722000C322A8 /* Network Share Mounter */, - F79B15AE274E722100C322A8 /* Network Share MounterUITests */, F706FED02D8EABCF001C2785 /* Network Share MounterTests */, ); }; @@ -451,13 +412,6 @@ ); runOnlyForDeploymentPostprocessing = 0; }; - F79B15AD274E722100C322A8 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ @@ -536,13 +490,6 @@ ); runOnlyForDeploymentPostprocessing = 0; }; - F79B15AB274E722100C322A8 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; /* End PBXSourcesBuildPhase section */ /* Begin PBXTargetDependency section */ @@ -551,11 +498,6 @@ target = F79B1594274E722000C322A8 /* Network Share Mounter */; targetProxy = F706FED52D8EABCF001C2785 /* PBXContainerItemProxy */; }; - F79B15B1274E722100C322A8 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = F79B1594274E722000C322A8 /* Network Share Mounter */; - targetProxy = F79B15B0274E722100C322A8 /* PBXContainerItemProxy */; - }; /* End PBXTargetDependency section */ /* Begin PBXVariantGroup section */ @@ -849,65 +791,6 @@ }; name = Release; }; - F79B15BB274E722100C322A8 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++17"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_OBJC_WEAK = YES; - CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; - CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; - CODE_SIGN_IDENTITY = "Apple Development"; - CODE_SIGN_STYLE = Manual; - CURRENT_PROJECT_VERSION = 195; - DEAD_CODE_STRIPPING = YES; - DEVELOPMENT_TEAM = 73H7Y3TZRJ; - GCC_C_LANGUAGE_STANDARD = gnu11; - GENERATE_INFOPLIST_FILE = YES; - MACOSX_DEPLOYMENT_TARGET = 12.1; - MARKETING_VERSION = 1.0; - MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; - MTL_FAST_MATH = YES; - PRODUCT_BUNDLE_IDENTIFIER = "de.fau.rrze.Network-Share-MounterUITests"; - PRODUCT_NAME = "$(TARGET_NAME)"; - PROVISIONING_PROFILE_SPECIFIER = ""; - SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; - SWIFT_EMIT_LOC_STRINGS = NO; - SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 5.0; - TEST_TARGET_NAME = "Network Share Mounter"; - }; - name = Debug; - }; - F79B15BC274E722100C322A8 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++17"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_OBJC_WEAK = YES; - CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; - CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; - CODE_SIGN_IDENTITY = "Apple Development"; - CODE_SIGN_STYLE = Manual; - CURRENT_PROJECT_VERSION = 195; - DEAD_CODE_STRIPPING = YES; - DEVELOPMENT_TEAM = 73H7Y3TZRJ; - GCC_C_LANGUAGE_STANDARD = gnu11; - GENERATE_INFOPLIST_FILE = YES; - MACOSX_DEPLOYMENT_TARGET = 12.1; - MARKETING_VERSION = 1.0; - MTL_FAST_MATH = YES; - PRODUCT_BUNDLE_IDENTIFIER = "de.fau.rrze.Network-Share-MounterUITests"; - PRODUCT_NAME = "$(TARGET_NAME)"; - PROVISIONING_PROFILE_SPECIFIER = ""; - SWIFT_EMIT_LOC_STRINGS = NO; - SWIFT_VERSION = 5.0; - TEST_TARGET_NAME = "Network Share Mounter"; - }; - name = Release; - }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ @@ -938,15 +821,6 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - F79B15BF274E722100C322A8 /* Build configuration list for PBXNativeTarget "Network Share MounterUITests" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - F79B15BB274E722100C322A8 /* Debug */, - F79B15BC274E722100C322A8 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; /* End XCConfigurationList section */ /* Begin XCRemoteSwiftPackageReference section */