Post

Replies

Boosts

Views

Activity

Mechanisms not destroyed when both of them are in AuthorizationDB at the same time
I have included two mechanisms in the LoginUIAuthPlugin (Authorization Plugin for MacOS). The authorization mechanisms run very well but second gets invoked before first is destroyed and then first gets invoked by itself. Both of them keep getting invoked infinitely. They run perfectly and destroy nicely when either one of them is used separately. But, the issue is when both of them are in AuthorizationDB at the same time. A class instance in Swift is destroyed automatically just like it destroys when only one mechanism is called. So, how can I fix this? Can I somehow call the destroy function manually? Or? My AuthorizationDB: . . <key>mechanisms</key> <array> <string>builtin:policy-banner</string> <string>LoginUIAuthPlugin:login</string> <string>builtin:login-begin</string> <string>LoginUIAuthPlugin:createUser,privileged</string> <string>builtin:reset-password,privileged</string> <string>loginwindow:FDESupport,privileged</string> . . I've just replaced the "loginwindow:login" with "LoginUIAuthPlugin:login" and added "LoginUIAuthPlugin:createUser,privileged" in the original AuthorizationDB file. The log I get: . . . #Ending of First Mechanism: 2020-10-16 10:55:51.551925+0500 0x240c&#9;&#9; mechanism -1 will set context username 2020-10-16 10:55:51.552335+0500 0x240c&#9;&#9; mechanism -1 did set context username 2020-10-16 10:55:51.552454+0500 0x240c&#9;&#9; mechanism -1 will set context password 2020-10-16 10:55:51.552520+0500 0x240c&#9;&#9; mechanism -1 did set context password 2020-10-16 10:55:51.552633+0500 0x240c&#9;&#9; mechanism -1 will set result 0 2020-10-16 10:55:51.554216+0500 0x240c&#9;&#9; mechanism -1 did set result 0 2020-10-16 10:55:51.554443+0500 0x240c&#9;&#9; mechanism -1 will did deactivate 2020-10-16 10:55:51.554508+0500 0x240c&#9;&#9; mechanism -1 did did deactivate #Second Mechanism Starts here: 2020-10-16 10:55:51.566353+0500 0x24af&#9;&#9; mechanism -1 will invoke 2020-10-16 10:55:51.566462+0500 0x24af&#9;&#9; LoginUICreateUserMechanism: invoke 2020-10-16 10:55:51.581631+0500 0x24af&#9;&#9; mechanism -1 will set result 0 2020-10-16 10:55:51.582208+0500 0x24af&#9;&#9; mechanism -1 did set result 0 2020-10-16 10:55:51.582247+0500 0x24af&#9;&#9; mechanism -1 will did deactivate 2020-10-16 10:55:51.582272+0500 0x24af&#9;&#9; mechanism -1 did did deactivate #First Mechanism invokes again: 2020-10-16 10:55:51.582314+0500 0x24af&#9;&#9; mechanism -1 did invoke 2020-10-16 10:55:53.869029+0500 0x240c&#9;&#9; mechanism -1 will invoke 2020-10-16 10:55:53.869406+0500 0x240c&#9;&#9; LoginUIAuthMechanism: invoke 2020-10-16 10:55:53.869520+0500 0x240c&#9;&#9; will display view 2020-10-16 10:55:53.874812+0500 0x240c&#9;&#9; will enable 2020-10-16 10:55:53.893029+0500 0x240c&#9;&#9; will return view for Username 2020-10-16 10:55:53.908530+0500 0x240c&#9;&#9; mechanism -1 did invoke All that repeats infinitly. :( Mechanisms are created by this code: extension AuthPlugin: AuthPluginEntry { . . . return AuthPlugin.start( &#9;&#9;&#9;&#9;&#9;&#9;log: OSLog(subsystem: "com.example.apple-samplecode.LoginUIAuthPlugin", category: "plugin"), &#9;&#9;&#9;&#9;&#9;&#9;mechanismForID: { &#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;mechID, context in &#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;guard mechID.rawValue == "login" || mechID.rawValue == "createUserMech" else { throw AuthPlugin.noSuchMechanismError } &#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;switch mechID.rawValue { &#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;case "login": &#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;return LoginUIAuthMechanism(context: context) &#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;case "createUserMech": &#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;return LoginUICreateUserMechanism(context: context); &#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;default: &#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;throw AuthPlugin.noSuchMechanismError; &#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;} &#9;&#9;&#9;&#9;&#9;&#9;}, . . . The class handling the second mechanism: class LoginUICreateUserMechanism:AuthPlugin.Mechanism { &#9;&#9;var context: AuthPlugin.Context &#9;&#9; &#9;&#9;func invoke() throws { try! self.context.setResult(.allow) try! self.context.didDeactivate() &#9;&#9;} &#9;&#9; &#9;&#9;func deactivate() throws { &#9;&#9;&#9;&#9;globalLogger("LoginUICreateUserMechanism: deactivate") &#9;&#9;} &#9;&#9; &#9;&#9;func destroy() { &#9;&#9;&#9;&#9;globalLogger("LoginUICreateUserMechanism: destroy") &#9;&#9;} &#9;&#9; &#9;&#9;init(context: AuthPlugin.Context) { &#9;&#9;&#9;&#9;globalLogger("LoginUICreateUserMechanism: init") &#9;&#9;&#9;&#9;self.context = context &#9;&#9;} &#9;&#9; &#9;&#9;deinit { &#9;&#9;&#9;&#9;globalLogger("LoginUICreateUserMechanism: deinit") &#9;&#9;}
0
0
442
Oct ’20