Multiple credentials in a Cocoa application

I am writing a cocoa application that needs to change proxy server settings (for this I use networksetup). The problem is that access to the proxy server settings requires a level of access to the system administrator. I tried running both administrators NSTaskas an administrator using the default Apple API (I used the wrapper STPrivilagedTaskfor it) and running the shell script as administrator. It works great anyway, but the problem is that my application needs to change settings so many times, and the user must type their password each time.

Anyway, can I get the privilege once and use it again and again?

+3
source share
1 answer

What you want to do is write a “privileged helper tool” that will be included (or delivered or integrated) in your application package, and you can call using SMJobBless().

Creating a helper tool is not for the faint of heart, but here is a related question with answers that can turn you off in the right way.

+1
source

All Articles