Re: Standard authentication interface
Re: Standard authentication interface
- Subject: Re: Standard authentication interface
- From: James Bucanek <email@hidden>
- Date: Fri, 28 Apr 2006 07:20:16 -0700
Julio Bianco wrote on Thursday, April 27, 2006:
>Hi again,
>I try to create a dialog interface able to ask for a user and
>password, and then be able to run a program with this user
>permissions. I need to know if there is a standard way to solve it.
>Is there a class that provides us with this kind of dialog boxes?
There is no Cocoa interface for this, but the C/Carbon interface to authorization and authentication services are pretty straight forward.
Essentially, you need to obtain an authorization to perform your action. This, indirectly, calls the authentication services. In the absence of any other kind of authentication, the system will present the user with the standard authentication dialog asking for their administrator's account name and password. Once you have an authorization, you want to call AuthorizationExecuteWithPrivileges() to run your program.
[ Note: This technique is simple but not a particularly secure or safe way of executing code. Simply getting an authorization and executing some program with root privileges should not be use in programs you plan on distributing to others. The Authorization Services documentation explains how to create a more secure "helper tool" arrangement that passes the authorization to the tool for use there. There are also example projects which demonstrate this. ]
Start here to learn about the details: <http://developer.apple.com/documentation/Security/Conceptual/authorization_concepts/index.html#//apple_ref/doc/uid/TP30000995>
--
James Bucanek
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden