Skip to content

Commit

Permalink
XCreds breaking Munki's logout/install @loginscreen logic #102. Test …
Browse files Browse the repository at this point in the history
…by defining hideIfPathExists to a path like /tmp/hide and then add/remove and UI should show /hide. Or use sample profile xcreds_example_azure_hide.mobileconfig
  • Loading branch information
twocanoes committed Jan 1, 2024
1 parent 0b85b4f commit 770c179
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 8 deletions.
12 changes: 12 additions & 0 deletions Profile Manifest/com.twocanoes.xcreds.plist
Original file line number Diff line number Diff line change
Expand Up @@ -561,6 +561,18 @@ Note that Google does not support the offline_access scope so instead use the pr
<key>pfm_type</key>
<string>string</string>
</dict>
<dict>
<key>pfm_description</key>
<string>Don't show the UI if this key is defined and a file or folder exists at this path.</string>
<key>pfm_documentation_url</key>
<string>https://twocanoes.com/knowledge-base/xcreds-admin-guide/#preferences</string>
<key>pfm_name</key>
<string>hideIfPathExists</string>
<key>pfm_title</key>
<string>Hide If Path Exists</string>
<key>pfm_type</key>
<string>string</string>
</dict>
<dict>
<key>pfm_description</key>
<string>Name of OIDC claim that contains an alias to add to a user account. Usually this is the "upn" (eg [email protected]) so the user can log in at the standard login window the same as the IdP login window. Adds the value to record name of the user account as an alias.</string>
Expand Down
21 changes: 20 additions & 1 deletion XCreds/MainLoginWindowController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class MainLoginWindowController: NSWindowController,NSWindowDelegate {
var networkChangeObserver:Any?
var centerView:NSView?
var mechanism:XCredsMechanismProtocol?

var timer:Timer?
override func windowDidLoad() {
TCSLogWithMark()
super.windowDidLoad()
Expand All @@ -25,6 +25,25 @@ class MainLoginWindowController: NSWindowController,NSWindowDelegate {
let screenRect = NSScreen.screens[0].frame
window?.setFrame(screenRect, display: true, animate: false)
window?.alphaValue=0.9

timer = Timer.scheduledTimer(withTimeInterval: 5, repeats: true, block: { timer in

if let path = DefaultsOverride.standardOverride.string(forKey: PrefKeys.hideIfPathExists.rawValue), FileManager.default.fileExists(atPath:path ) {

if self.window?.isVisible==true {
TCSLogWithMark("window is visible and hide path has item at it so hiding window")
self.window?.orderOut(self)
}
}
else { //
if self.window?.isVisible==false {
TCSLogWithMark("window is not visible and default does exist so moving to front")

self.window?.makeKeyAndOrderFront(self)
}

}
})
}

override func awakeFromNib() {
Expand Down
2 changes: 1 addition & 1 deletion 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,refreshRateMinutes, showDebug, verifyPassword, shouldShowQuitMenu, shouldShowPreferencesOnStart, shouldSetGoogleAccessTypeToOffline, passwordChangeURL, shouldShowAboutMenu, username, idpHostName, passwordElementID, shouldFindPasswordElement, shouldShowVersionInfo, shouldShowSupportStatus,shouldShowConfigureWifiButton,shouldShowMacLoginButton, loginWindowBackgroundImageURL, shouldShowCloudLoginByDefault, shouldPreferLocalLoginInsteadOfCloudLogin, idpHostNames,autoRefreshLoginTimer, loginWindowWidth, loginWindowHeight, shouldShowRefreshBanner, shouldSwitchToLoginWindowWhenLocked,accounts = "Accounts",
windowSignIn = "WindowSignIn", settingsOverrideScriptPath, localAdminUserName, localAdminPassword, usernamePlaceholder, passwordPlaceholder, shouldShowLocalOnlyCheckbox, shouldShowTokenUpdateStatus, shouldDetectNetworkToDetermineLoginWindow, showLoginWindowDelaySeconds, shouldPromptForMigration, shouldAllowKeyComboForMacLoginWindow, aliasName,claimsToAddToLocalUserAccount, loadPageTitle, loadPageInfo,shouldPromptForADPasswordChange
windowSignIn = "WindowSignIn", settingsOverrideScriptPath, localAdminUserName, localAdminPassword, usernamePlaceholder, passwordPlaceholder, shouldShowLocalOnlyCheckbox, shouldShowTokenUpdateStatus, shouldDetectNetworkToDetermineLoginWindow, showLoginWindowDelaySeconds, shouldPromptForMigration, shouldAllowKeyComboForMacLoginWindow, aliasName,claimsToAddToLocalUserAccount, loadPageTitle, loadPageInfo,shouldPromptForADPasswordChange, hideIfPathExists
//, filePathToPreventShowingUI
case shouldVerifyPasswordWithRopg
case shouldUseROPGForOIDCLogin
Expand Down
12 changes: 6 additions & 6 deletions xCreds.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1424,7 +1424,7 @@
buildSettings = {
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 6177;
CURRENT_PROJECT_VERSION = 6180;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = UXP6YEHSPW;
FRAMEWORK_SEARCH_PATHS = (
Expand Down Expand Up @@ -1461,7 +1461,7 @@
buildSettings = {
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 6177;
CURRENT_PROJECT_VERSION = 6180;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = UXP6YEHSPW;
FRAMEWORK_SEARCH_PATHS = (
Expand Down Expand Up @@ -1582,7 +1582,7 @@
CODE_SIGN_ENTITLEMENTS = "XCreds Login Overlay/XCreds_Login_Overlay.entitlements";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 6177;
CURRENT_PROJECT_VERSION = 6180;
DEVELOPMENT_TEAM = UXP6YEHSPW;
ENABLE_HARDENED_RUNTIME = YES;
FRAMEWORK_SEARCH_PATHS = (
Expand Down Expand Up @@ -1619,7 +1619,7 @@
CODE_SIGN_ENTITLEMENTS = "XCreds Login Overlay/XCreds_Login_Overlay.entitlements";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 6177;
CURRENT_PROJECT_VERSION = 6180;
DEVELOPMENT_TEAM = UXP6YEHSPW;
ENABLE_HARDENED_RUNTIME = YES;
FRAMEWORK_SEARCH_PATHS = (
Expand Down Expand Up @@ -1769,7 +1769,7 @@
CODE_SIGN_ENTITLEMENTS = XCreds/xCreds.entitlements;
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 6177;
CURRENT_PROJECT_VERSION = 6180;
DEVELOPMENT_TEAM = UXP6YEHSPW;
ENABLE_HARDENED_RUNTIME = YES;
FRAMEWORK_SEARCH_PATHS = (
Expand Down Expand Up @@ -1811,7 +1811,7 @@
CODE_SIGN_ENTITLEMENTS = XCreds/xCreds.entitlements;
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 6177;
CURRENT_PROJECT_VERSION = 6180;
DEVELOPMENT_TEAM = UXP6YEHSPW;
ENABLE_HARDENED_RUNTIME = YES;
FRAMEWORK_SEARCH_PATHS = (
Expand Down
Binary file not shown.

0 comments on commit 770c179

Please sign in to comment.