Skip to content

Commit

Permalink
fixed timer minutes
Browse files Browse the repository at this point in the history
  • Loading branch information
twocanoes committed Jul 6, 2023
1 parent 6aa3ec4 commit e78b306
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 29 deletions.
36 changes: 18 additions & 18 deletions Profile Manifest/com.twocanoes.xcreds.plist
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<key>pfm_app_url</key>
<string>https://github.com/twocanoes/xcreds</string>
<key>pfm_description</key>
<string>XCreds 3.1 (5081) OAuth Settings</string>
<string>XCreds 3.1 (5083) OAuth Settings</string>
<key>pfm_documentation_url</key>
<string>https://github.com/twocanoes/xcreds/wiki/AdminGuide</string>
<key>pfm_domain</key>
Expand Down Expand Up @@ -388,29 +388,29 @@ A profile can consist of payloads with different version numbers. For example, c
<key>pfm_value_unit</key>
<string>minutes</string>
</dict>
<dict>
<key>pfm_default</key>
<string>profile openid offline_access</string>
<key>pfm_description</key>
<string>Scopes tell the identify provider what information to return. Note that the values are provided with a single space between them.
<dict>
<key>pfm_default</key>
<string>profile openid offline_access</string>
<key>pfm_description</key>
<string>Scopes tell the identify provider what information to return. Note that the values are provided with a single space between them.
Provide the following values the follow IdPs:
Google: profile openid email
Azure: profile openid offline_access
Note that Google does not support the offline_access scope so instead use the preference shouldSetGoogleAccessTypeToOffline. Azure provides unique_name which is mapped to the local user account by using the prefix before “@” in unique_name and matching to the short name of a user account. Google provides “email” and is matched in the same way.</string>
<key>pfm_documentation_url</key>
<string>https://github.com/twocanoes/xcreds/wiki/AdminGuide#scopes</string>
<key>pfm_name</key>
<string>scopes</string>
<key>pfm_note</key>
<string>All scopes should be lowercase and separated by single spaces</string>
<key>pfm_title</key>
<string>Scopes</string>
<key>pfm_type</key>
<string>string</string>
</dict>
<key>pfm_documentation_url</key>
<string>https://github.com/twocanoes/xcreds/wiki/AdminGuide#scopes</string>
<key>pfm_name</key>
<string>scopes</string>
<key>pfm_note</key>
<string>All scopes should be lowercase and separated by single spaces</string>
<key>pfm_title</key>
<string>Scopes</string>
<key>pfm_type</key>
<string>string</string>
</dict>
<dict>
<key>pfm_default</key>
<false/>
Expand Down Expand Up @@ -845,6 +845,6 @@ changing “passwordID” to the correct element ID. If the value you typed into
<key>pfm_unique</key>
<false/>
<key>pfm_version</key>
<integer>5081</integer>
<integer>5083</integer>
</dict>
</plist>
2 changes: 1 addition & 1 deletion XCreds/PrefKeys.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,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",
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,idpHostNames,autoRefreshLoginTimer, loginWindowWidth, loginWindowHeight, shouldShowRefreshBanner, shouldSwitchToLoginWindowWhenLocked,accounts = "Accounts",
windowSignIn = "WindowSignIn", settingsOverrideScriptPath, localAdminUserName, localAdminPassword, usernamePlaceholder, passwordPlaceholder, shouldShowLocalOnlyCheckbox, shouldShowTokenUpdateStatus
case actionItemOnly = "ActionItemOnly"
case aDDomain = "ADDomain"
Expand Down
18 changes: 14 additions & 4 deletions XCreds/ScheduleManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,28 @@ class ScheduleManager {
var timer:Timer?
func setNextCheckTime() {
var rate = DefaultsOverride.standardOverride.double(forKey: PrefKeys.refreshRateHours.rawValue)
var minutesRate = DefaultsOverride.standardOverride.double(forKey: PrefKeys.refreshRateMinutes.rawValue)

if rate < 1 {
rate = 1
if minutesRate < 0 {
minutesRate=0
}

else if minutesRate > 60 {
minutesRate=60
}
if rate < 0 {
rate = 0
}
else if rate > 168 {
rate = 168
}
nextCheckTime = Date(timeIntervalSinceNow: rate*60*60)
nextCheckTime = Date(timeIntervalSinceNow: (rate*60+minutesRate)*60)
NotificationCenter.default.post(name: NSNotification.Name("CheckTokenStatus"), object: self, userInfo:["NextCheckTime":nextCheckTime])

}
func startCredentialCheck() {
TCSLogWithMark()

if let timer = timer, timer.isValid==true {
return
}
Expand All @@ -43,7 +53,7 @@ class ScheduleManager {
}
}
func checkToken() {

TCSLogWithMark("checking token")
if nextCheckTime>Date() {
TCSLogWithMark("Token will be checked at \(nextCheckTime)")

Expand Down
2 changes: 2 additions & 0 deletions XCreds/defaults.plist
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
<string>xcreds://auth/</string>
<key>refreshRateHours</key>
<integer>3</integer>
<key>refreshRateMinutes</key>
<integer>0</integer>
<key>showDebug</key>
<false/>
<key>verifyPassword</key>
Expand Down
12 changes: 6 additions & 6 deletions xCreds.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1229,7 +1229,7 @@
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 5081;
CURRENT_PROJECT_VERSION = 5083;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = UXP6YEHSPW;
FRAMEWORK_SEARCH_PATHS = (
Expand Down Expand Up @@ -1267,7 +1267,7 @@
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 5081;
CURRENT_PROJECT_VERSION = 5083;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = UXP6YEHSPW;
FRAMEWORK_SEARCH_PATHS = (
Expand Down Expand Up @@ -1387,7 +1387,7 @@
CODE_SIGN_ENTITLEMENTS = "XCreds Login Overlay/XCreds_Login_Overlay.entitlements";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 5081;
CURRENT_PROJECT_VERSION = 5083;
DEVELOPMENT_TEAM = UXP6YEHSPW;
ENABLE_HARDENED_RUNTIME = YES;
FRAMEWORK_SEARCH_PATHS = (
Expand Down Expand Up @@ -1424,7 +1424,7 @@
CODE_SIGN_ENTITLEMENTS = "XCreds Login Overlay/XCreds_Login_Overlay.entitlements";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 5081;
CURRENT_PROJECT_VERSION = 5083;
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 = 5081;
CURRENT_PROJECT_VERSION = 5083;
DEVELOPMENT_TEAM = UXP6YEHSPW;
ENABLE_HARDENED_RUNTIME = YES;
FRAMEWORK_SEARCH_PATHS = (
Expand Down Expand Up @@ -1611,7 +1611,7 @@
CODE_SIGN_ENTITLEMENTS = XCreds/xCreds.entitlements;
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 5081;
CURRENT_PROJECT_VERSION = 5083;
DEVELOPMENT_TEAM = UXP6YEHSPW;
ENABLE_HARDENED_RUNTIME = YES;
FRAMEWORK_SEARCH_PATHS = (
Expand Down
Binary file not shown.

0 comments on commit e78b306

Please sign in to comment.