• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Authorization Samples for Cocoa?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Authorization Samples for Cocoa?


  • Subject: Re: Authorization Samples for Cocoa?
  • From: Laurent Daudelin <email@hidden>
  • Date: Mon, 16 Nov 2009 09:53:14 -0800

On Nov 16, 2009, at 09:37, Nick Zitzmann wrote:

>
> On Nov 15, 2009, at 7:09 PM, Laurent Daudelin wrote:
>
>> The BLAuthentication class uses "AuthorizationExecuteWithPrivileges" which doesn't seem to allow to pass a description like "AuthorizationRightSet" seems to allow. I've searched for some samples but they are all very outdated (from 2005 (AuthForAll) and 2007 (BetterAuthorizationSample)) and are way too complex to understand in like one hour. I can't imagine that all that crap hasn't been encapsulated under some Objective-C classes. Anyone has any idea or pointer to something basic I don't need to take a few hours to figure it out?
>
> Typed in Mail, untested, use at your own risk but it ought to work, and all that:
>
> #import <SecurityFoundation/SFAuthorization.h>
>
> const char *myFancyMessage = "We humbly ask for your password so we can do this and that.";
> AuthorizationItem promptItem = {kAuthorizationEnvironmentPrompt, strlen(myFancyMessage), myFancyMessage, 0};
> AuthorizationEnvironment myEnvironment = {1, &promptItem};
> AuthorizationItem myRight = {kAuthorizationRightExecute, 0, NULL, 0};
> AuthorizationRights myRights = {1, &myRight};
> SFAuthorization *sfAuthorization = [SFAuthorization authorizationWithFlags:kAuthorizationFlagInterationAllowed|kAuthorizationFlagPreAuthorize rights:myRights environment:myEnvironment];
>
> At that last line, the security server ought to pre-authorize with the message in myFancyMessage instead of the default message. Then you use AEWP() with the AuthorizationRef obtained from the SFAuthorization to do whatever it is you need to do.


Thanks, Nick, I'll give it a shot!

-Laurent.
--
Laurent Daudelin
AIM/iChat/Skype:LaurentDaudelin 				http://nemesys.dyndns.org
Logiciels Nemesys Software              				email@hidden
Photo Gallery Store: http://laurentdaudelin.shutterbugstorefront.com/g/galleries



_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Authorization Samples for Cocoa? (From: Laurent Daudelin <email@hidden>)
 >Re: Authorization Samples for Cocoa? (From: Nick Zitzmann <email@hidden>)

  • Prev by Date: Re: iPhone: Having a touch point want to find layer it is in
  • Next by Date: Re: Synchronization & Core Data
  • Previous by thread: Re: Authorization Samples for Cocoa?
  • Next by thread: Synchronization & Core Data
  • Index(es):
    • Date
    • Thread