Remove keychain password with profile removal
This commit is contained in:
parent
b051f8118f
commit
f75fbfb4bb
|
@ -72,4 +72,11 @@ extension ConnectionProfile {
|
||||||
}
|
}
|
||||||
try keychain.set(password: password, for: key, label: key)
|
try keychain.set(password: password, for: key, label: key)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func removePassword(in keychain: Keychain) {
|
||||||
|
guard let key = passwordKey else {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
keychain.removePassword(for: key)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -395,10 +395,11 @@ class ConnectionService: Codable {
|
||||||
}
|
}
|
||||||
|
|
||||||
func removeProfile(_ key: ProfileKey) {
|
func removeProfile(_ key: ProfileKey) {
|
||||||
guard let i = cache.index(forKey: key) else {
|
guard let profile = cache[key] else {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
cache.remove(at: i)
|
cache.removeValue(forKey: key)
|
||||||
|
removeCredentials(for: profile)
|
||||||
pendingRemoval.insert(key)
|
pendingRemoval.insert(key)
|
||||||
if cache.isEmpty {
|
if cache.isEmpty {
|
||||||
activeProfileKey = nil
|
activeProfileKey = nil
|
||||||
|
@ -458,6 +459,10 @@ class ConnectionService: Codable {
|
||||||
try profile.setPassword(credentials?.password, in: keychain)
|
try profile.setPassword(credentials?.password, in: keychain)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func removeCredentials(for profile: ConnectionProfile) {
|
||||||
|
profile.removePassword(in: keychain)
|
||||||
|
}
|
||||||
|
|
||||||
// MARK: VPN
|
// MARK: VPN
|
||||||
|
|
||||||
func vpnConfiguration() throws -> NetworkExtensionVPNConfiguration {
|
func vpnConfiguration() throws -> NetworkExtensionVPNConfiguration {
|
||||||
|
|
Loading…
Reference in New Issue