Re: Passing Around AuthorizationRefs
Re: Passing Around AuthorizationRefs
- Subject: Re: Passing Around AuthorizationRefs
- From: James Masasaki <email@hidden>
- Date: Thu, 23 Oct 2003 22:59:05 -0700
At 9:54 PM -0700 10/23/03, Quinn wrote:
Is it possible to have the parent app create the AuthorizationRef,
have the child process copy it via
AuthorizationCreateFromExternalForm, and then have the child
process use it?
Yep. That's exactly what this API is designed for. We strongly
recommend you use it in this way. MoreAuthSample shows how it's
done.
Oh joy! That is what I wanted to hear!
If you do this correctly then, in Panther at least, your
authorization dialogs will get keyboard focus (yay!). Authorization
Services knows that the AuthorizationRef originated in a GUI
application and, if that GUI application is at the front, any dialog
put up by that AuthorizationRef will have focus, even if it's
triggered by a non-GUI tool.
"We don't need no stinking dialogs". :-) Actually my hackish plan was
to create the AR in the parent app, copy it in the child app via
AuthorizationCreateFromExternalForm and then set the expiration
timeout on its rights to zero so that once the child app has it, the
child app will never require an authorization dialog again for that
session.
Apple didn't consider one case when designing the authorization API:
my case. In other words, I have a "control panel/GUI" parent app that
starts an stops a child "engine/faceless" app every time the user
clicks a button in the parent app. Every time that button is clicked,
the parent app has to launch the child app. When the user clicks the
button again, the parent app kills the child app. But.......
Each time the child app starts and stops it *must* save current
System Preferences settings, then insert its own settings into System
Prefs, then when terminated, restore the original system prefs.
Without the ability of the parent app to create *one* AR that never
times out, the child app would constantly be prompting the user
*twice* with an authentication dialog every single time it starts and
stops. Not exactly user friendly.
James
_______________________________________________
macnetworkprog mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/macnetworkprog
Do not post admin requests to the list. They will be ignored.