Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SecurityAgentPlugin not working anymore on Yosemite (SFAuthorizationPluginView)

We have developed an Authorization Plug-in that uses an SFAuthorizationPluginView to present UI to the user. This example is based on the "old" NameAndPassword example provided by Apple.

We are using this Authorization Plug-in to unlock the session (we have updated the "system.login.screensaver" authorization in the authorizationdb) using a custom view. This worked well until the last update to Yosemite. Since Yosemite, the SFAuthorizationPluginView is not closing anymore after the user logged into the session. We could update the example to force closing the window, by doing something like:

// confirm that we have authorized the user
[self callbacks]->SetResult ([self engineRef], kAuthorizationResultAllow);

// close the window
NSView* v = [self viewForType:SFViewTypeCredentials]; 
NSWindow* w = [v window]; 
[w close];

Now the SFAuthorizationPluginView is well closed once the user is logged in (after we have authorized the user), but something remains active in the background and the user has no focus in the session (the user cannot select something or write in a text edit for example). We have to manually kill the SecurityAgent in order to get the focus again. (note that the system seems to automatically kill the SecurityAgent after 30 seconds).

We have found a fixed 2014 version of Apple's NameAndPassword auth plugin sample at the following page, but we face the same issue on Yosemite: A fixed 2014 version of Apple's NameAndPassword auth plugin sample

This code was working fine for us until the Yosemite release.

Anyone experimenting a similar issue? Any idea or advice to fix this issue?

like image 864
skuallpa Avatar asked Nov 11 '22 00:11

skuallpa


1 Answers

Instead of close to the window you should overwrite didDeactivate method AND add call:

[self didDeactivate];

in the SFAuthorizationPluginView class AFTER you set the result to ALLOW.

Apple updated their documentation, you could re-read it, there are some good guidelines that would save me A LOT of time and effort one year ago.

like image 192
Jugoslav M. Avatar answered Nov 15 '22 05:11

Jugoslav M.