Skip to content

Commit

Permalink
final touches
Browse files Browse the repository at this point in the history
  • Loading branch information
twocanoes committed Jun 22, 2023
1 parent c630495 commit df5f111
Show file tree
Hide file tree
Showing 8 changed files with 57 additions and 19 deletions.
15 changes: 14 additions & 1 deletion History.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ When set to true and the user locks the current session, XCreds will tell the sy
If group membership is returned in the "groups" claim and matches the group defined in the "CreateAdminIfGroupMember" preference, the user will be created as admin.

### kerberos ticket ###
When app is first launched and their is a keychain item with a AD account and local password, a kerberos ticket will be attempted.
When app is first launched and there is a keychain item with a AD account and local password, a kerberos ticket will be attempted.

### Override Preference Script ###

Expand Down Expand Up @@ -89,6 +89,19 @@ plist:

The desired AD domain

**usernamePlaceholder*

Placeholder text in local / AD login window for username

**passwordPlaceholder**

Placeholder text in local / AD login window for password

**shouldShowLocalOnlyCheckbox**

Show the local only checkbox on the local login page


**CreateAdminIfGroupMember**

List of groups that should have its members created as local administrators. Set as an Array of Strings of the group name.
Expand Down
34 changes: 27 additions & 7 deletions NomadLogin/UI/SignInWindowController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,11 @@ class SignInWindowController: NSWindowController, DSQueryable {


override func awakeFromNib() {

TCSLogWithMark()
if setupDone == false {
prepareAccountStrings()
setupDone=true
self.localOnlyCheckBox.isHidden = self.domainName.isEmpty


TCSLogWithMark("Configure login window")
loginAppearance()
Expand Down Expand Up @@ -211,6 +212,7 @@ class SignInWindowController: NSWindowController, DSQueryable {


fileprivate func loginAppearance() {
TCSLogWithMark()
os_log("Setting window level", log: uiLog, type: .debug)

self.window?.level = .normal
Expand All @@ -220,6 +222,28 @@ class SignInWindowController: NSWindowController, DSQueryable {
// make things look better

os_log("Tweaking appearance", log: uiLog, type: .debug)



if let usernamePlaceholder = UserDefaults.standard.string(forKey: PrefKeys.usernamePlaceholder.rawValue){
TCSLogWithMark("Setting username placeholder: \(usernamePlaceholder)")
self.username.placeholderString=usernamePlaceholder
}

if let passwordPlaceholder = UserDefaults.standard.string(forKey: PrefKeys.passwordPlaceholder.rawValue){
TCSLogWithMark("Setting password placeholder")

self.password.placeholderString=passwordPlaceholder

}
if UserDefaults.standard.bool(forKey: PrefKeys.shouldShowLocalOnlyCheckbox.rawValue) == false {
self.localOnlyCheckBox.isHidden = true
}
else {
//show based on if there is an AD domain or not
self.localOnlyCheckBox.isHidden = self.domainName.isEmpty
}

if getManagedPreference(key: .LoginScreen) as? Bool == false {
os_log("Present as login screen", log: uiLog, type: .debug)
self.window?.isOpaque = false
Expand All @@ -231,13 +255,8 @@ class SignInWindowController: NSWindowController, DSQueryable {
}
self.window?.titlebarAppearsTransparent = true
if !self.domainName.isEmpty {
username.placeholderString = "Username"
self.isDomainManaged = true
}
if let usernamePlaceholder = getManagedPreference(key: .UsernameFieldPlaceholder) as? String {
os_log("Username Field Placeholder preferences found.", log: uiLog, type: .debug)
username.placeholderString = usernamePlaceholder
}

// if let domainList = getManagedPreference(key: .AdditionalADDomainList) as? [String] {
// domain.isHidden = false
Expand Down Expand Up @@ -374,6 +393,7 @@ class SignInWindowController: NSWindowController, DSQueryable {

username.isEnabled = !username.isEnabled
password.isEnabled = !password.isEnabled
localOnlyCheckBox.isEnabled = !localOnlyCheckBox.isEnabled
}


Expand Down
4 changes: 1 addition & 3 deletions XCreds/PrefKeys.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import Foundation

enum PrefKeys: String {
case clientID, clientSecret, password="xcreds local password",discoveryURL, redirectURI, scopes, accessToken, idToken, refreshToken, tokenEndpoint, expirationDate, invalidToken, refreshRateHours, showDebug, verifyPassword, shouldShowQuitMenu, shouldShowPreferencesOnStart, shouldSetGoogleAccessTypeToOffline, passwordChangeURL, shouldShowAboutMenu, username, idpHostName, passwordElementID, shouldFindPasswordElement, shouldShowVersionInfo, shouldShowSupportStatus,shouldShowConfigureWifiButton,shouldShowMacLoginButton, loginWindowBackgroundImageURL, shouldShowCloudLoginByDefault,idpHostNames,autoRefreshLoginTimer, loginWindowWidth, loginWindowHeight, shouldShowRefreshBanner, shouldSwitchToLoginWindowWhenLocked,accounts = "Accounts",
windowSignIn = "WindowSignIn", settingsOverrideScriptPath, localAdminUserName, localAdminPassword
windowSignIn = "WindowSignIn", settingsOverrideScriptPath, localAdminUserName, localAdminPassword, usernamePlaceholder, passwordPlaceholder, shouldShowLocalOnlyCheckbox
case actionItemOnly = "ActionItemOnly"
case aDDomain = "ADDomain"
case aDSite = "ADSite"
Expand Down Expand Up @@ -318,8 +318,6 @@ enum Preferences: String {
/// A string to show as the placeholder in the Username textfield
case UseCNForFullNameFallback
/// Uses the CN as the fullname on the account when the givenName and sn fields are blank
case UsernameFieldPlaceholder
/// A filesystem path to an image to set the user profile image to as a `String`
case UserProfileImage

case NormalWindowLevel
Expand Down
6 changes: 6 additions & 0 deletions XCreds/defaults.plist
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,11 @@
<true/>
<key>autoRefreshLoginTimer</key>
<integer>0</integer>
<key>usernamePlaceholder</key>
<string>Enter Username</string>
<key>shouldShowLocalOnlyCheckbox</key>
<true/>
<key>passwordPlaceholder</key>
<string>Password</string>
</dict>
</plist>
4 changes: 2 additions & 2 deletions XCredsLoginPlugIn/LoginWindow/LocalUsersViewController.xib
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
<constraints>
<constraint firstAttribute="width" constant="200" id="DC3-pa-LqT"/>
</constraints>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" alignment="left" placeholderString="Name" usesSingleLineMode="YES" bezelStyle="round" id="IEP-jE-4l7">
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" alignment="left" usesSingleLineMode="YES" bezelStyle="round" id="IEP-jE-4l7">
<font key="font" metaFont="system"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
Expand All @@ -54,7 +54,7 @@
<constraints>
<constraint firstAttribute="width" constant="200" id="QA1-E9-AfT"/>
</constraints>
<secureTextFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" borderStyle="bezel" alignment="left" placeholderString="Enter Password" usesSingleLineMode="YES" bezelStyle="round" id="l3D-fM-8kU">
<secureTextFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" borderStyle="bezel" alignment="left" usesSingleLineMode="YES" bezelStyle="round" id="l3D-fM-8kU">
<font key="font" metaFont="system"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
Expand Down
1 change: 1 addition & 0 deletions XCredsLoginPlugIn/Mechanisms/XCredsBaseMechanism.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ protocol XCredsMechanismProtocol {
self.mechEngine = mechanism.pointee.fEngine

super.init()
TCSLogWithMark("Setting up prefs")
setupPrefs()

}
Expand Down
12 changes: 6 additions & 6 deletions xCreds.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1233,7 +1233,7 @@
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 4165;
CURRENT_PROJECT_VERSION = 4182;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = UXP6YEHSPW;
FRAMEWORK_SEARCH_PATHS = (
Expand Down Expand Up @@ -1270,7 +1270,7 @@
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 4165;
CURRENT_PROJECT_VERSION = 4182;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = UXP6YEHSPW;
FRAMEWORK_SEARCH_PATHS = (
Expand Down Expand Up @@ -1389,7 +1389,7 @@
CODE_SIGN_ENTITLEMENTS = "XCreds Login Overlay/XCreds_Login_Overlay.entitlements";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 4165;
CURRENT_PROJECT_VERSION = 4182;
DEVELOPMENT_TEAM = UXP6YEHSPW;
ENABLE_HARDENED_RUNTIME = YES;
FRAMEWORK_SEARCH_PATHS = (
Expand Down Expand Up @@ -1425,7 +1425,7 @@
CODE_SIGN_ENTITLEMENTS = "XCreds Login Overlay/XCreds_Login_Overlay.entitlements";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 4165;
CURRENT_PROJECT_VERSION = 4182;
DEVELOPMENT_TEAM = UXP6YEHSPW;
ENABLE_HARDENED_RUNTIME = YES;
FRAMEWORK_SEARCH_PATHS = (
Expand Down Expand Up @@ -1574,7 +1574,7 @@
CODE_SIGN_ENTITLEMENTS = XCreds/xCreds.entitlements;
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 4165;
CURRENT_PROJECT_VERSION = 4182;
DEVELOPMENT_TEAM = UXP6YEHSPW;
ENABLE_HARDENED_RUNTIME = YES;
FRAMEWORK_SEARCH_PATHS = (
Expand Down Expand Up @@ -1610,7 +1610,7 @@
CODE_SIGN_ENTITLEMENTS = XCreds/xCreds.entitlements;
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 4165;
CURRENT_PROJECT_VERSION = 4182;
DEVELOPMENT_TEAM = UXP6YEHSPW;
ENABLE_HARDENED_RUNTIME = YES;
FRAMEWORK_SEARCH_PATHS = (
Expand Down
Binary file not shown.

0 comments on commit df5f111

Please sign in to comment.