skycocker / NameAndPassword

A fixed 2014 version of Apple's NameAndPassword auth plugin sample
67 stars 14 forks source link

How to deploy in cocoa app #1

Open yarneo opened 9 years ago

yarneo commented 9 years ago

Hi, I am trying to create an app in which i can lock & unlock my mac using a cocoa OS X app running on that computer. Its very easy to lock, but unlocking is an issue, and then I came across this repo. Could you please give me some guidelines on how I can go about implementing the lock/unlock mechanism using this code?

Thanks!

skycocker commented 9 years ago

How do you want to implement the unlock mechanism? By typing a password?

yarneo commented 9 years ago

Not exactly, I'm interested to unlock it using a cocoa app that is invoked by an http get it is listening to in the background

skycocker commented 9 years ago

The simplest way would be to store the encrypted password somewhere, then decrypt it on the NameAndPassword side, fill the password field and programatically click the button:

Set the decrypted password as either mIPPasswordSecureTextField or mPPasswordSecureTextField (or both if necessary), then just run [self buttonPressed:SFButtonTypeOK] (in this file: https://github.com/skycocker/NameAndPassword/blob/master/NameAndPasswordPlugin.m)

yarneo commented 9 years ago

Do I run [self buttonPressed:SFButtonTypeOK] in my cocoa app? Do I understand correctly? Thanks so much!

Im essentially trying to understand how I invoke the bundle from my app.

skycocker commented 9 years ago

No, not the cocoa app. You call it in this NameAndPassword code application. You need to form all your desired code in this application.

If I understood your needs correctly, you will need to move at least some part of your application code into the NameAndPassword .m files.

yarneo commented 9 years ago

I wouldnt mind passing all of my code to it, although as far as reading all the stackoverflow threads it is to my understanding that i need to create a bundle beforehand and move it to a certain directory. I am trying to make a standalone mac app that involves locking and unlocking the mac, therefore i need to be able to invoke an unlock from it. Would i be able to run the nameandpassword entirely in my app, or must it be bundled?

Sent from my iPhone

On Nov 23, 2014, at 12:53 PM, Michał Siwek notifications@github.com wrote:

No, not the cocoa app. You call it in this NameAndPassword code application. You need to form all your desired code in this application.

If I understood your needs correctly, you will need to move at least some part of your application code into the NameAndPassword .m files.

— Reply to this email directly or view it on GitHub.