Skip to content

Commit d17509b

Browse files
committed
updated AD support: kerb ticket now obtained at user space app launch from password in keychain. udpated profile manifest with better comments; delete cookes on webview each time it appears; added local login button; shows username password if discoveryURL is not defined
1 parent b7f7ad6 commit d17509b

File tree

9 files changed

+50
-944
lines changed

9 files changed

+50
-944
lines changed

Profile Manifest/com.twocanoes.xcreds.plist

-796
This file was deleted.

XCreds/MainController.swift

+3-3
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ class MainController: NSObject, NoMADUserSessionDelegate {
1414
}
1515

1616
func NoMADAuthenticationFailed(error: NoMAD_ADAuth.NoMADSessionError, description: String) {
17-
TCSLogErrorWithMark(description)
17+
TCSLogErrorWithMark("NoMADAuthenticationFailed:\(description)")
1818
}
19-
19+
2020
func NoMADUserInformation(user: NoMAD_ADAuth.ADUserRecord) {
21-
21+
TCSLogWithMark("AD user password expires: \(user.passwordExpire?.description ?? "unknown")")
2222
}
2323

2424

XCreds/TokenManager.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ class TokenManager {
106106
if creds.password.count>0 {
107107
TCSLogWithMark("Saving cloud password")
108108

109-
if keychainUtil.updatePassword(serviceName: "xcreds",accountName:PrefKeys.password.rawValue, pass: creds.password,shouldUpdateACL: setACL, keychainPassword:password) == false {
109+
if keychainUtil.updatePassword(serviceName: "xcreds local password",accountName:PrefKeys.password.rawValue, pass: creds.password,shouldUpdateACL: setACL, keychainPassword:password) == false {
110110
TCSLogErrorWithMark("Error Updating password")
111111

112112
return false
@@ -144,7 +144,7 @@ TCSLogWithMark()
144144
let refreshAccountAndToken = try? keychainUtil.findPassword(serviceName: "xcreds",accountName:PrefKeys.refreshToken.rawValue)
145145

146146
let clientID = defaults.string(forKey: PrefKeys.clientID.rawValue)
147-
let keychainAccountAndPassword = try? keychainUtil.findPassword(serviceName: "xcreds",accountName:PrefKeys.password.rawValue)
147+
let keychainAccountAndPassword = try? keychainUtil.findPassword(serviceName: "xcreds local password",accountName:PrefKeys.password.rawValue)
148148
TCSLogWithMark()
149149
if let refreshAccountAndToken = refreshAccountAndToken, let refreshToken = refreshAccountAndToken.1, let clientID = clientID, let keychainAccountAndPassword = keychainAccountAndPassword, let keychainPassword = keychainAccountAndPassword.1 {
150150
TCSLogWithMark()

XCreds/WebViewWindowController.swift

+20-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ class WebViewWindowController: NSWindowController {
2323
var password:String?
2424

2525
func loadPage() {
26-
26+
TCSLogWithMark("Clearing cookies")
27+
webView.cleanAllCookies()
2728
TCSLogWithMark()
2829
let licenseState = LicenseChecker().currentLicenseState()
2930
if let refreshTitleTextField = refreshTitleTextField {
@@ -320,3 +321,21 @@ extension String {
320321
self = self.sanitized()
321322
}
322323
}
324+
extension WKWebView {
325+
326+
func cleanAllCookies() {
327+
HTTPCookieStorage.shared.removeCookies(since: Date.distantPast)
328+
print("All cookies deleted")
329+
330+
WKWebsiteDataStore.default().fetchDataRecords(ofTypes: WKWebsiteDataStore.allWebsiteDataTypes()) { records in
331+
records.forEach { record in
332+
WKWebsiteDataStore.default().removeData(ofTypes: record.dataTypes, for: [record], completionHandler: {})
333+
print("Cookie ::: \(record) deleted")
334+
}
335+
}
336+
}
337+
338+
func refreshCookies() {
339+
self.configuration.processPool = WKProcessPool()
340+
}
341+
}

XCredsLoginPlugIn/Mechanisms/XCredsLoginMechanism.swift

+12-1
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,18 @@ import Cocoa
147147
allowLogin()
148148
return
149149
}
150-
showLoginWindowType(loginWindowType: .cloud)
150+
let discoveryURL=DefaultsOverride.standardOverride.value(forKey: PrefKeys.discoveryURL.rawValue)
151+
152+
153+
if let _ = discoveryURL {
154+
showLoginWindowType(loginWindowType: .cloud)
155+
156+
}
157+
else {
158+
showLoginWindowType(loginWindowType: .usernamePassword)
159+
160+
}
161+
151162
// if (false){
152163
//
153164
// os_log("Activating app", log: checkADLog, type: .debug)

xCreds.xcodeproj/project.pbxproj

+6-6
Original file line numberDiff line numberDiff line change
@@ -1233,7 +1233,7 @@
12331233
CLANG_ENABLE_MODULES = YES;
12341234
CODE_SIGN_STYLE = Automatic;
12351235
COMBINE_HIDPI_IMAGES = YES;
1236-
CURRENT_PROJECT_VERSION = 4138;
1236+
CURRENT_PROJECT_VERSION = 4143;
12371237
DEFINES_MODULE = YES;
12381238
DEVELOPMENT_TEAM = UXP6YEHSPW;
12391239
FRAMEWORK_SEARCH_PATHS = (
@@ -1270,7 +1270,7 @@
12701270
CLANG_ENABLE_MODULES = YES;
12711271
CODE_SIGN_STYLE = Automatic;
12721272
COMBINE_HIDPI_IMAGES = YES;
1273-
CURRENT_PROJECT_VERSION = 4138;
1273+
CURRENT_PROJECT_VERSION = 4143;
12741274
DEFINES_MODULE = YES;
12751275
DEVELOPMENT_TEAM = UXP6YEHSPW;
12761276
FRAMEWORK_SEARCH_PATHS = (
@@ -1389,7 +1389,7 @@
13891389
CODE_SIGN_ENTITLEMENTS = "XCreds Login Overlay/XCreds_Login_Overlay.entitlements";
13901390
CODE_SIGN_STYLE = Automatic;
13911391
COMBINE_HIDPI_IMAGES = YES;
1392-
CURRENT_PROJECT_VERSION = 4138;
1392+
CURRENT_PROJECT_VERSION = 4143;
13931393
DEVELOPMENT_TEAM = UXP6YEHSPW;
13941394
ENABLE_HARDENED_RUNTIME = YES;
13951395
FRAMEWORK_SEARCH_PATHS = (
@@ -1425,7 +1425,7 @@
14251425
CODE_SIGN_ENTITLEMENTS = "XCreds Login Overlay/XCreds_Login_Overlay.entitlements";
14261426
CODE_SIGN_STYLE = Automatic;
14271427
COMBINE_HIDPI_IMAGES = YES;
1428-
CURRENT_PROJECT_VERSION = 4138;
1428+
CURRENT_PROJECT_VERSION = 4143;
14291429
DEVELOPMENT_TEAM = UXP6YEHSPW;
14301430
ENABLE_HARDENED_RUNTIME = YES;
14311431
FRAMEWORK_SEARCH_PATHS = (
@@ -1574,7 +1574,7 @@
15741574
CODE_SIGN_ENTITLEMENTS = XCreds/xCreds.entitlements;
15751575
CODE_SIGN_STYLE = Automatic;
15761576
COMBINE_HIDPI_IMAGES = YES;
1577-
CURRENT_PROJECT_VERSION = 4138;
1577+
CURRENT_PROJECT_VERSION = 4143;
15781578
DEVELOPMENT_TEAM = UXP6YEHSPW;
15791579
ENABLE_HARDENED_RUNTIME = YES;
15801580
FRAMEWORK_SEARCH_PATHS = (
@@ -1610,7 +1610,7 @@
16101610
CODE_SIGN_ENTITLEMENTS = XCreds/xCreds.entitlements;
16111611
CODE_SIGN_STYLE = Automatic;
16121612
COMBINE_HIDPI_IMAGES = YES;
1613-
CURRENT_PROJECT_VERSION = 4138;
1613+
CURRENT_PROJECT_VERSION = 4143;
16141614
DEVELOPMENT_TEAM = UXP6YEHSPW;
16151615
ENABLE_HARDENED_RUNTIME = YES;
16161616
FRAMEWORK_SEARCH_PATHS = (

xCreds.xcodeproj/xcuserdata/tperfitt.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist

+5-133
Original file line numberDiff line numberDiff line change
@@ -7,145 +7,17 @@
77
<BreakpointProxy
88
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
99
<BreakpointContent
10-
uuid = "759CA819-0DBE-4AF3-8E8F-619D2FFA886C"
10+
uuid = "B835CF57-4699-45EB-9D7D-FCB99468A05F"
1111
shouldBeEnabled = "Yes"
1212
ignoreCount = "0"
1313
continueAfterRunningActions = "No"
14-
filePath = "XCreds/MainController.swift"
14+
filePath = "XCreds/KeychainUtil.swift"
1515
startingColumnNumber = "9223372036854775807"
1616
endingColumnNumber = "9223372036854775807"
17-
startingLineNumber = "12"
18-
endingLineNumber = "12"
19-
landmarkName = "NoMADAuthenticationSucceded()"
17+
startingLineNumber = "61"
18+
endingLineNumber = "61"
19+
landmarkName = "findPassword(serviceName:accountName:)"
2020
landmarkType = "7">
21-
<Locations>
22-
<Location
23-
uuid = "759CA819-0DBE-4AF3-8E8F-619D2FFA886C - effc79e05f43d2dc"
24-
shouldBeEnabled = "Yes"
25-
ignoreCount = "0"
26-
continueAfterRunningActions = "No"
27-
symbolName = "XCreds.MainController.NoMADAuthenticationSucceded() -&gt; ()"
28-
moduleName = "XCreds"
29-
usesParentBreakpointCondition = "Yes"
30-
urlString = "file:///Users/tperfitt/Documents/Projects/xcreds/XCreds/MainController.swift"
31-
startingColumnNumber = "9223372036854775807"
32-
endingColumnNumber = "9223372036854775807"
33-
startingLineNumber = "13"
34-
endingLineNumber = "13"
35-
offsetFromSymbolStart = "12">
36-
</Location>
37-
<Location
38-
uuid = "759CA819-0DBE-4AF3-8E8F-619D2FFA886C - effc79e05f43d223"
39-
shouldBeEnabled = "Yes"
40-
ignoreCount = "0"
41-
continueAfterRunningActions = "No"
42-
symbolName = "XCreds.MainController.NoMADAuthenticationSucceded() -&gt; ()"
43-
moduleName = "XCreds"
44-
usesParentBreakpointCondition = "Yes"
45-
urlString = "file:///Users/tperfitt/Documents/Projects/xcreds/XCreds/MainController.swift"
46-
startingColumnNumber = "9223372036854775807"
47-
endingColumnNumber = "9223372036854775807"
48-
startingLineNumber = "12"
49-
endingLineNumber = "12"
50-
offsetFromSymbolStart = "28">
51-
</Location>
52-
</Locations>
53-
</BreakpointContent>
54-
</BreakpointProxy>
55-
<BreakpointProxy
56-
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
57-
<BreakpointContent
58-
uuid = "1032FA1F-C7EB-4C5B-98BF-0F1A088E9205"
59-
shouldBeEnabled = "Yes"
60-
ignoreCount = "0"
61-
continueAfterRunningActions = "No"
62-
filePath = "XCreds/MainController.swift"
63-
startingColumnNumber = "9223372036854775807"
64-
endingColumnNumber = "9223372036854775807"
65-
startingLineNumber = "17"
66-
endingLineNumber = "17"
67-
landmarkName = "NoMADAuthenticationFailed(error:description:)"
68-
landmarkType = "7">
69-
<Locations>
70-
<Location
71-
uuid = "1032FA1F-C7EB-4C5B-98BF-0F1A088E9205 - c92aeb92f11cf5ff"
72-
shouldBeEnabled = "Yes"
73-
ignoreCount = "0"
74-
continueAfterRunningActions = "No"
75-
symbolName = "XCreds.MainController.NoMADAuthenticationFailed(error: NoMAD_ADAuth.NoMADSessionError, description: Swift.String) -&gt; ()"
76-
moduleName = "XCreds"
77-
usesParentBreakpointCondition = "Yes"
78-
urlString = "file:///Users/tperfitt/Documents/Projects/xcreds/XCreds/MainController.swift"
79-
startingColumnNumber = "9223372036854775807"
80-
endingColumnNumber = "9223372036854775807"
81-
startingLineNumber = "17"
82-
endingLineNumber = "17"
83-
offsetFromSymbolStart = "36">
84-
</Location>
85-
<Location
86-
uuid = "1032FA1F-C7EB-4C5B-98BF-0F1A088E9205 - c92aeb92f11cf5ff"
87-
shouldBeEnabled = "Yes"
88-
ignoreCount = "0"
89-
continueAfterRunningActions = "No"
90-
symbolName = "XCreds.MainController.NoMADAuthenticationFailed(error: NoMAD_ADAuth.NoMADSessionError, description: Swift.String) -&gt; ()"
91-
moduleName = "XCreds"
92-
usesParentBreakpointCondition = "Yes"
93-
urlString = "file:///Users/tperfitt/Documents/Projects/xcreds/XCreds/MainController.swift"
94-
startingColumnNumber = "9223372036854775807"
95-
endingColumnNumber = "9223372036854775807"
96-
startingLineNumber = "17"
97-
endingLineNumber = "17"
98-
offsetFromSymbolStart = "76">
99-
</Location>
100-
</Locations>
101-
</BreakpointContent>
102-
</BreakpointProxy>
103-
<BreakpointProxy
104-
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
105-
<BreakpointContent
106-
uuid = "6250C6DE-EF23-424F-A0E8-0D42CE5A9025"
107-
shouldBeEnabled = "Yes"
108-
ignoreCount = "0"
109-
continueAfterRunningActions = "No"
110-
filePath = "XCreds/MainController.swift"
111-
startingColumnNumber = "9223372036854775807"
112-
endingColumnNumber = "9223372036854775807"
113-
startingLineNumber = "21"
114-
endingLineNumber = "21"
115-
landmarkName = "NoMADUserInformation(user:)"
116-
landmarkType = "7">
117-
<Locations>
118-
<Location
119-
uuid = "6250C6DE-EF23-424F-A0E8-0D42CE5A9025 - 4ca5d5e0e4e88f8"
120-
shouldBeEnabled = "Yes"
121-
ignoreCount = "0"
122-
continueAfterRunningActions = "No"
123-
symbolName = "XCreds.MainController.NoMADUserInformation(user: NoMAD_ADAuth.ADUserRecord) -&gt; ()"
124-
moduleName = "XCreds"
125-
usesParentBreakpointCondition = "Yes"
126-
urlString = "file:///Users/tperfitt/Documents/Projects/xcreds/XCreds/MainController.swift"
127-
startingColumnNumber = "9223372036854775807"
128-
endingColumnNumber = "9223372036854775807"
129-
startingLineNumber = "21"
130-
endingLineNumber = "21"
131-
offsetFromSymbolStart = "20">
132-
</Location>
133-
<Location
134-
uuid = "6250C6DE-EF23-424F-A0E8-0D42CE5A9025 - 4ca5d5e0e4e88d9"
135-
shouldBeEnabled = "Yes"
136-
ignoreCount = "0"
137-
continueAfterRunningActions = "No"
138-
symbolName = "XCreds.MainController.NoMADUserInformation(user: NoMAD_ADAuth.ADUserRecord) -&gt; ()"
139-
moduleName = "XCreds"
140-
usesParentBreakpointCondition = "Yes"
141-
urlString = "file:///Users/tperfitt/Documents/Projects/xcreds/XCreds/MainController.swift"
142-
startingColumnNumber = "9223372036854775807"
143-
endingColumnNumber = "9223372036854775807"
144-
startingLineNumber = "22"
145-
endingLineNumber = "22"
146-
offsetFromSymbolStart = "20">
147-
</Location>
148-
</Locations>
14921
</BreakpointContent>
15022
</BreakpointProxy>
15123
</Breakpoints>

xCreds.xcodeproj/xcuserdata/tperfitt.xcuserdatad/xcschemes/xcschememanagement.plist

+2-2
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
<key>auth_mech_fixup.xcscheme_^#shared#^_</key>
3333
<dict>
3434
<key>orderHint</key>
35-
<integer>7</integer>
35+
<integer>8</integer>
3636
</dict>
3737
<key>authrights.xcscheme_^#shared#^_</key>
3838
<dict>
@@ -42,7 +42,7 @@
4242
<key>test.xcscheme_^#shared#^_</key>
4343
<dict>
4444
<key>orderHint</key>
45-
<integer>8</integer>
45+
<integer>7</integer>
4646
</dict>
4747
</dict>
4848
<key>SuppressBuildableAutocreation</key>

0 commit comments

Comments
 (0)