New topic: Authentication prompt
<http://forums.realsoftware.com/viewtopic.php?t=45571> Page 1 of 1 [ 5 posts ] Previous topic | Next topic Author Message DirkM Post subject: Authentication promptPosted: Wed Oct 10, 2012 6:52 am Joined: Tue Oct 02, 2012 8:13 am Posts: 5 Hi all, I'm still pretty new to OS X programming and this is one of those situations where I don't know what keyword to search for. Is there a way on OS X / Real Studio to flag an application so that it prompts for authentication when the app opens? Thanks, Dirk Top Goofie Post subject: Re: Authentication promptPosted: Wed Oct 10, 2012 8:50 am Joined: Tue Nov 13, 2007 11:48 am Posts: 180 Location: Belgium I'm not sure what you exactly mean. I try to help you with some pseudocode to illustrate what is possible... (1) If you want a sort of login-window at startup, that's easy... Create 2 windows, let's call it loginwindow and applicationwindow. At startup you show your loginwindow. (You can select the starting window in the IDE...) When you create your loginwindow, give it a textfield and a button Put some code in the button.action, and according to your rules if textfield1.text=whatIwant true then applicationwindow.show self.close else self.close application.quit end if 2) If you want a window with "administrator"-priviliges, there are some classes and snippets for that if you search the forum... That would mean that you ask the OS to check for your (root) priviliges. To check your credentials as an ordinary user is not necessary, since you're already logged in... Top DirkM Post subject: Re: Authentication promptPosted: Wed Oct 10, 2012 9:04 am Joined: Tue Oct 02, 2012 8:13 am Posts: 5 Goofie, thanks for the quick reply. In Windows an executable can be flagged as "require admin" privileges which will show the UAC elevation prompt on launch where an admin user authenticates and after doing so the application can perform tasks that require "root" access. I have an application that will always require root access, so I'm looking for a method to do a "sudo MyDesktopApp.app" whenever a user doubleclicks the MyDesktopApp icon. I found the AppleScript method for launching some executable with root access but this requires relaunching MyDesktopApp which may confuse scripts it is being used in. I also found the AuthorizationShell class which I'm currently trying to understand. But from what I got so far it will also require to relaunch MyDesktopApp which is not really what I want. Maybe what I want doesn't really exist in OS X, maybe I will always need to relaunch MyDesktopApp if it requires root access? Thanks, Dirk Top npalardy Post subject: Re: Authentication promptPosted: Wed Oct 10, 2012 9:34 am Real Software Engineer Joined: Sat Dec 24, 2005 8:18 pm Posts: 7464 Location: Canada, Alberta, Near Red Deer DirkM wrote:In Windows an executable can be flagged as "require admin" privileges which will show the UAC elevation prompt on launch where an admin user authenticates and after doing so the application can perform tasks that require "root" access. I have an application that will always require root access, so I'm looking for a method to do a "sudo MyDesktopApp.app" whenever a user doubleclicks the MyDesktopApp icon. I found the AppleScript method for launching some executable with root access but this requires relaunching MyDesktopApp which may confuse scripts it is being used in. I also found the AuthorizationShell class which I'm currently trying to understand. But from what I got so far it will also require to relaunch MyDesktopApp which is not really what I want. Maybe what I want doesn't really exist in OS X, maybe I will always need to relaunch MyDesktopApp if it requires root access? Thanks, Dirk Apple has deprecated the code used in AuthorizationShell as it's also got security issues. The "right" way to do this on OS X is quite complex - but VERY secure - which "run as admin" on Windows isn't (a nefarious attacker could hijack the executable & then get rights to run as admin something that is viral or malicious) For OS X start by reading this https://developer.apple.com/library/mac ... ction.html _________________ My web site Great White Software RBLibrary.com REALbasic learning Top DirkM Post subject: Re: Authentication promptPosted: Wed Oct 10, 2012 9:55 am Joined: Tue Oct 02, 2012 8:13 am Posts: 5 Unfortunately that's way over my head. But I suppose that my assumption of "not being possible" is somehow accurate. I admit that my knowledge about OS X is very limited, even the difference between Carbon and Cocoa still confuses me. My task is to come up with a nice user interface to build machines which includes asking for some data about the end user, apply a base image, reboot, do some post imaging tasks and finally present the user with the first logon screen on a fresh imaged computer. If you donât mind, maybe you guys can comment on the following statements: - If I logon as the ârootâ user then anything I execute is automatically "elevated". - How are âservicesâ programmed that allow root tasks without authentication prompt? Not in detail but the general concept. - Are there examples (RB or MBS) that show how to implement the authentication prompt? For example how to have a âcontinueâ button prompt for authentication and then continue the rest of the code âelevatedâ? Sorry for all the noob questions and thanks for any feedback. Dirk Top Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending Page 1 of 1 [ 5 posts ]
-- Over 1500 classes with 29000 functions in one REALbasic plug-in collection. The Monkeybread Software Realbasic Plugin v9.3. http://www.monkeybreadsoftware.de/realbasic/plugins.shtml [email protected]
