Commit c896a357 authored by Joel Rennich's avatar Joel Rennich

wired up LocalFallback

parent 2e1b239a
Pipeline #48904883 passed with stage
in 1 minute and 37 seconds
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
// Copyright © 2017 NoMAD. All rights reserved. // Copyright © 2017 NoMAD. All rights reserved.
// //
enum HintType: String { enum HintType: String, CaseIterable {
case migratePass case migratePass
case migrateUser case migrateUser
case networkSignIn case networkSignIn
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
import Foundation import Foundation
enum Preferences: String { enum Preferences: String, CaseIterable {
/// The desired AD domain as a `String`. /// The desired AD domain as a `String`.
case ADDomain case ADDomain
/// Allows appending of other domains at the loginwindow. Set as a `Bool` to allow any, or as an Array of Strings to whitelist /// Allows appending of other domains at the loginwindow. Set as a `Bool` to allow any, or as an Array of Strings to whitelist
...@@ -95,6 +95,45 @@ enum Preferences: String { ...@@ -95,6 +95,45 @@ enum Preferences: String {
case UserInputMainText case UserInputMainText
} }
func printAllPrefs(writeOut: Bool=false) {
var result = ""
for key in Preferences.allCases {
let defaults = UserDefaults.init(suiteName: "menu.nomad.login.ad")
let pref = defaults?.object(forKey: key.rawValue) as AnyObject
switch String(describing: type(of: pref)) {
case "__NSCFBoolean" :
result.append("\t" + key.rawValue + ": " + String(describing: ( defaults?.bool(forKey: key.rawValue))))
case "__NSCFArray" :
result.append("\t" + key.rawValue + ": " + ( String(describing: (defaults?.array(forKey: key.rawValue)!))))
case "__NSTaggedDate", "__NSDate" :
result.append("\t" + key.rawValue + ": " + ( defaults?.object(forKey: key.rawValue) as! Date ).description(with: Locale.current))
case "__NSCFDictionary":
result.append("\t" + key.rawValue + ": " + String(describing: defaults?.dictionary(forKey: key.rawValue)!))
case "__NSCFData" :
result.append("\t" + key.rawValue + ": " + (defaults?.data(forKey: key.rawValue)?.base64EncodedString() ?? "ERROR"))
case "__NSCFNumber" :
result.append("\t" + key.rawValue + ": " + String(describing: defaults?.integer(forKey: key.rawValue)))
default :
result.append("\t" + key.rawValue + ": " + ( defaults?.object(forKey: key.rawValue) as? String ?? "Unset"))
}
if defaults?.objectIsForced(forKey: key.rawValue) ?? false {
result.append("\t\tForced")
}
result.append("\n")
}
if writeOut {
try? result.write(toFile: "/tmp/menu.nomad.login.ad.plist", atomically: true, encoding: String.Encoding.utf8)
} else {
print(result)
}
}
/// Looks in the `com.trusourcelabs.NoMAD`, `menu.nomad.NoMADLoginAD`, and `menu.nomad.login.ad` Defaults domains for a preference key. /// Looks in the `com.trusourcelabs.NoMAD`, `menu.nomad.NoMADLoginAD`, and `menu.nomad.login.ad` Defaults domains for a preference key.
/// This domain will override anything the user enters in the username field. /// This domain will override anything the user enters in the username field.
......
...@@ -74,6 +74,10 @@ class LogOnly : NoLoMechanism { ...@@ -74,6 +74,10 @@ class LogOnly : NoLoMechanism {
os_log("Hint item %{public}@: %{public}@", log: loggerMech, type: .default, item, result) os_log("Hint item %{public}@: %{public}@", log: loggerMech, type: .default, item, result)
} }
} }
os_log("Printing all preferences", log: loggerMech, type: .debug)
let _ = allowLogin() let _ = allowLogin()
os_log("LogOnly mech complete", log: loggerMech, type: .debug) os_log("LogOnly mech complete", log: loggerMech, type: .debug)
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
017F5D1722022A0700042737 /* NoMAD_ADAuth.framework.dSYM in CopyFiles */ = {isa = PBXBuildFile; fileRef = 017F5D1622022A0700042737 /* NoMAD_ADAuth.framework.dSYM */; }; 017F5D1722022A0700042737 /* NoMAD_ADAuth.framework.dSYM in CopyFiles */ = {isa = PBXBuildFile; fileRef = 017F5D1622022A0700042737 /* NoMAD_ADAuth.framework.dSYM */; };
1A43759E221CF00E00D1B976 /* LocalCheckAndMigrate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1A43759D221CF00E00D1B976 /* LocalCheckAndMigrate.swift */; }; 1A43759E221CF00E00D1B976 /* LocalCheckAndMigrate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1A43759D221CF00E00D1B976 /* LocalCheckAndMigrate.swift */; };
1A4375A0221CF08400D1B976 /* DSQueryable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1A43759F221CF08400D1B976 /* DSQueryable.swift */; }; 1A4375A0221CF08400D1B976 /* DSQueryable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1A43759F221CF08400D1B976 /* DSQueryable.swift */; };
1A4375A2221CF13500D1B976 /* DS+Okta.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1A4375A1221CF13500D1B976 /* DS+Okta.swift */; }; 1A4375A2221CF13500D1B976 /* DS+NoMAD.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1A4375A1221CF13500D1B976 /* DS+NoMAD.swift */; };
1AA58EF9216610B300431201 /* UserInput.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1AA58EF8216610B300431201 /* UserInput.swift */; }; 1AA58EF9216610B300431201 /* UserInput.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1AA58EF8216610B300431201 /* UserInput.swift */; };
1AA58EFB216610C300431201 /* Notify.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1AA58EFA216610C300431201 /* Notify.swift */; }; 1AA58EFB216610C300431201 /* Notify.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1AA58EFA216610C300431201 /* Notify.swift */; };
1AA58EFD216610C700431201 /* RunScript.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1AA58EFC216610C700431201 /* RunScript.swift */; }; 1AA58EFD216610C700431201 /* RunScript.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1AA58EFC216610C700431201 /* RunScript.swift */; };
...@@ -72,7 +72,7 @@ ...@@ -72,7 +72,7 @@
017F5D1622022A0700042737 /* NoMAD_ADAuth.framework.dSYM */ = {isa = PBXFileReference; lastKnownFileType = wrapper.dsym; path = NoMAD_ADAuth.framework.dSYM; sourceTree = "<group>"; }; 017F5D1622022A0700042737 /* NoMAD_ADAuth.framework.dSYM */ = {isa = PBXFileReference; lastKnownFileType = wrapper.dsym; path = NoMAD_ADAuth.framework.dSYM; sourceTree = "<group>"; };
1A43759D221CF00E00D1B976 /* LocalCheckAndMigrate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LocalCheckAndMigrate.swift; sourceTree = "<group>"; }; 1A43759D221CF00E00D1B976 /* LocalCheckAndMigrate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LocalCheckAndMigrate.swift; sourceTree = "<group>"; };
1A43759F221CF08400D1B976 /* DSQueryable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DSQueryable.swift; sourceTree = "<group>"; }; 1A43759F221CF08400D1B976 /* DSQueryable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DSQueryable.swift; sourceTree = "<group>"; };
1A4375A1221CF13500D1B976 /* DS+Okta.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "DS+Okta.swift"; sourceTree = "<group>"; }; 1A4375A1221CF13500D1B976 /* DS+NoMAD.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "DS+NoMAD.swift"; sourceTree = "<group>"; };
1AA58EEA2166101100431201 /* UserInputUI.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserInputUI.swift; sourceTree = "<group>"; }; 1AA58EEA2166101100431201 /* UserInputUI.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserInputUI.swift; sourceTree = "<group>"; };
1AA58EEB2166101100431201 /* UserInputUI.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = UserInputUI.xib; sourceTree = "<group>"; }; 1AA58EEB2166101100431201 /* UserInputUI.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = UserInputUI.xib; sourceTree = "<group>"; };
1AA58EED2166104400431201 /* NoLoNotify.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = NoLoNotify.xib; sourceTree = "<group>"; }; 1AA58EED2166104400431201 /* NoLoNotify.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = NoLoNotify.xib; sourceTree = "<group>"; };
...@@ -246,7 +246,7 @@ ...@@ -246,7 +246,7 @@
9CBDCFA71FC5CDB500CF73F4 /* NoMADLoginAD-Bridging-Header.h */, 9CBDCFA71FC5CDB500CF73F4 /* NoMADLoginAD-Bridging-Header.h */,
9CBDCFB41FC5CE2100CF73F4 /* NoMADLoginAD.h */, 9CBDCFB41FC5CE2100CF73F4 /* NoMADLoginAD.h */,
9CBDCFB31FC5CE2100CF73F4 /* NoMADLoginAD.m */, 9CBDCFB31FC5CE2100CF73F4 /* NoMADLoginAD.m */,
1A4375A1221CF13500D1B976 /* DS+Okta.swift */, 1A4375A1221CF13500D1B976 /* DS+NoMAD.swift */,
9C6027451FE8224000B99B51 /* ContextAndHintHandling.swift */, 9C6027451FE8224000B99B51 /* ContextAndHintHandling.swift */,
9C8A2608207D917900204336 /* DataExtension.swift */, 9C8A2608207D917900204336 /* DataExtension.swift */,
9C0A3EA31FF2CCD70030A04F /* LoggingDefinitions.swift */, 9C0A3EA31FF2CCD70030A04F /* LoggingDefinitions.swift */,
...@@ -356,7 +356,7 @@ ...@@ -356,7 +356,7 @@
1AA58F03216611C100431201 /* UserInputUI.swift in Sources */, 1AA58F03216611C100431201 /* UserInputUI.swift in Sources */,
9C8A2609207D917900204336 /* DataExtension.swift in Sources */, 9C8A2609207D917900204336 /* DataExtension.swift in Sources */,
9CBDCFAF1FC5CDB600CF73F4 /* NoLoMechanism.swift in Sources */, 9CBDCFAF1FC5CDB600CF73F4 /* NoLoMechanism.swift in Sources */,
1A4375A2221CF13500D1B976 /* DS+Okta.swift in Sources */, 1A4375A2221CF13500D1B976 /* DS+NoMAD.swift in Sources */,
9CC74CC91FFED59B00EBCCD5 /* DeMobilize.swift in Sources */, 9CC74CC91FFED59B00EBCCD5 /* DeMobilize.swift in Sources */,
1A4375A0221CF08400D1B976 /* DSQueryable.swift in Sources */, 1A4375A0221CF08400D1B976 /* DSQueryable.swift in Sources */,
1AA58EF9216610B300431201 /* UserInput.swift in Sources */, 1AA58EF9216610B300431201 /* UserInput.swift in Sources */,
......
...@@ -15,9 +15,9 @@ ...@@ -15,9 +15,9 @@
<key>CFBundlePackageType</key> <key>CFBundlePackageType</key>
<string>BNDL</string> <string>BNDL</string>
<key>CFBundleShortVersionString</key> <key>CFBundleShortVersionString</key>
<string>1.3.0-Beta</string> <string>1.4.0-Alpha</string>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
<string>331</string> <string>332</string>
<key>NSHumanReadableCopyright</key> <key>NSHumanReadableCopyright</key>
<string>Copyright © 2019 Orchard &amp; Grove. All rights reserved.</string> <string>Copyright © 2019 Orchard &amp; Grove. All rights reserved.</string>
<key>NSPrincipalClass</key> <key>NSPrincipalClass</key>
......
...@@ -297,10 +297,10 @@ class SignIn: NSWindowController, DSQueryable { ...@@ -297,10 +297,10 @@ class SignIn: NSWindowController, DSQueryable {
oldPassword.becomeFirstResponder() oldPassword.becomeFirstResponder()
} }
fileprivate func authFail() { fileprivate func authFail( _ message: String?=nil) {
session = nil session = nil
password.stringValue = "" password.stringValue = ""
alertText.stringValue = "Authentication Failed" alertText.stringValue = message ?? "Authentication Failed"
loginStartedUI() loginStartedUI()
} }
...@@ -563,6 +563,18 @@ extension SignIn: NoMADUserSessionDelegate { ...@@ -563,6 +563,18 @@ extension SignIn: NoMADUserSessionDelegate {
os_log("Password is expired or requires change.", log: uiLog, type: .default) os_log("Password is expired or requires change.", log: uiLog, type: .default)
showResetUI() showResetUI()
return return
case .OffDomain :
os_log("AD authentication failed, off domain.", log: uiLog, type: .default)
if getManagedPreference(key: .LocalFallback) as? Bool ?? false {
os_log("Local fallback enabled, passing off to local authentication", log: uiLog, type: .default)
setRequiredHintsAndContext()
completeLogin(authResult: .allow)
return
} else {
authFail()
return
}
default: default:
os_log("NoMAD Login Authentication failed with: %{public}@", log: uiLog, type: .error, description) os_log("NoMAD Login Authentication failed with: %{public}@", log: uiLog, type: .error, description)
authFail() authFail()
...@@ -672,7 +684,7 @@ extension SignIn: NoMADUserSessionDelegate { ...@@ -672,7 +684,7 @@ extension SignIn: NoMADUserSessionDelegate {
if self.didUpdateFail == true { if self.didUpdateFail == true {
self.migrateText.stringValue = "Invalid password. Try again." self.migrateText.stringValue = "Invalid password. Try again."
} else { } else {
self.migrateText.stringValue = "Cloud password does not match local password. Please enter your previous local password to update it." self.migrateText.stringValue = "Active Directory password does not match local password. Please enter your previous local password to update it."
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment