I have used functionality of changing user's password programmatically using the OpenDirectory framework. Once the password is updated successfully, can be use this password for Login sessions and authentication wherever required. But the same password is failing authenticate with Local Authentication Framework that is with LAContext and prefers always older password. Even restarting machine won't work.
Changing current user's password using below method -
do {
let node = try ODNode(session: ODSession.default(), type: ODNodeType(kODNodeTypeLocalNodes))
let user = try node.record(withRecordType: kODRecordTypeUsers, name: NSUserName(), attributes: nil)
try user.changePassword(currentPassword, toPassword: newPassword)
print("Password changed successfully")
} catch var error {
print(error)
}
Once password is updated, then trying to authenticate password with LAContext using,
let context = LAContext()
context.evaluatePolicy(.deviceOwnerAuthentication, localizedReason: "AuthenticationMessage".localized()) { success, error in
DispatchQueue.main.async {
completion(success, error)
}
print("authentication error = (String(describing: error?.localizedDescription))")
}
It won't accept the updated password. Any idea how to solve this problem?
Post
Replies
Boosts
Views
Activity
My application supports Custom URL Schema which is used to perform an open operation. My application is used as a helper app for MDM, hence it will be installed as a Managed Application. I want only the other Managed Applications to be able to invoke the Custom URL Schema and not allow it for unmanaged applications. Is there any such provision provided by Apple MDM protocol?