SFAuthorizationView dialog issues

I'm trying to use an SFAuthorizationView within a Preference Pane to present a user experience similar to system preference panes (e.g. Date & Time, Users & Groups, etc.) such that there is a lock icon. When the lock icon is clicked, I'd like it behave just like the system preference panes.


There are two issues that I've found:


1. When the lock is clicked, the dialog prompting the user for credentials is not presented as a sheet. Instead, it is a modal dialog window.


Is there some way to present the view as a panel/sheet similar to some of SFAuthorizationView's cousins? Clearly there is a way to do this since the system preferences do this.


2. On Mojave and earlier, the environment prompt text in the dialog is: "System Preferences wants to make changes." On Catalina, the environment prompt text in the dialog is "legacyLoader wants to make changes."


This difference in behavior between macOS versions is a problem. Clearly, the environment prompt text is being derived from the process that runs the preference pane. Is there some way to modify the environment prompt text? If I were able to create the authorization with AuthorizationCreate() passing an AuthorizationEnvironment, I could change the environment prompt according to my needs.


However, this doesn't appear to be possible with the limited methods available to SFAuthorizationView. The only thing remotely related is setAuthorizationRights: and when you add additional AuthorizationItems to the AuthorizationRights, they're apparently ignored.


Is there a solution to these short of having to write my own implementation?


Thanks.

1. … Clearly there is a way to do this since the system preferences do this.

Yeah, the thing is, System Preferences is part of the system and thus not limited to using public APIs.

2. On Mojave and earlier, the environment prompt text in the dialog is: "System Preferences wants to make changes." On Catalina, the environment prompt text in the dialog is "legacyLoader wants to make changes."

This is clearly a bug and I encourage you to file a bug report about it. Please post your bug number, just for the record.

As to how you might work around this, I don’t see any good options. As you’ve noted,

SFAuthorizationView
uses the default authorisation context (internally it calls
+[SFAuthorization authorization]
) and there doesn’t seem to be any way to override that. As to setting the environment for a specific authorisation request, there isn’t a way to do that either. The implementation makes liberal use of
kAuthorizationEmptyEnvironment
)-:

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

This is what I was afraid of 😐


For the record, FB7673690 has been filed for the bug and makes a suggestion to revisit SFAuthorizationView so that a consumer of the API can provide prompt text during the setup of the view.

SFAuthorizationView dialog issues
 
 
Q