Prelogin agent does not appear for various power options(restart, sleep, lock,start) in Mac

We have a requirement to launch the prelogin agent in the different modes when a mac machine is powered on. But, we are able to see the prelogin agent only in the case where the mac machine is logged out. We will be requiring to see the prelogin agent in the below mentioned power options as well. Please provide an appropriate solution to this or direct me to the right way of implementing this.

Power options:

RESTART

START

LOCK

SLEEP


Do write back on any clarifications or questions?


Reference code below

https://developer.apple.com/library/archive/samplecode/PreLoginAgents/Introduction/Intro.html#//apple_ref/doc/uid/DTS10004414

Replies

What does your pre-login agent do? Given your list of requirements, it sounds like you’d be better off with an authorisation plug-in. See Technote 2228 Running At Login for context.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

Our Pre login agent is implemented basically to get it launched on the right hand side of the Mac Login window and on clicking the same we launch the website, which basically allows us to reset the password. This is the reason we are looking for the prelogin agent to be appearing on the mac login screen for the different power options. However, as per our testing the Mac machine, we only see the pre login agent in case of log out.


So, with the different power options like Shout down, Sleep, Restart, we do not see the pre login agent appearing on the logon screen. Please suggest.



Currently we are using launchd Agent below is the path

https://developer.apple.com/library/archive/technotes/tn2083/_index.html

Our Pre login agent is implemented basically to get it launched on the right hand side of the Mac Login window and on clicking the same we launch the website, which basically allows us to reset the password.

You will not be able to make this work during screen lock or waking the screen saver. macOS takes specific steps to ensure that third-party UI does not appear on top of the screen saver. The only way to display a third-party UI at this point is via

SFAuthorizationPluginView
.

The restart case is interesting, because there are two login UIs:

  • If you have FileVault enabled, the login UI is actually displayed by EFI and that means your pre-login agent isn’t running at all.

  • Without FileVault, this should work, assuming you use the tricks from the PreLoginAgents sample code.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

I am not sure if you have understood our requirement exactly. I would like to re-iterate that the prelogin agent when insitalled, simply appears on with URL that we have configured. On Mac, we are able to see this pre login agent in case of only logout of the user. We have a requirement to see tha prelogin agent in case of the different power options: Start, Lock, Sleep, Restart.


With the suggestion of SFAuthorizationPluginView, it seems like we will have to implement a custom login screen for Mac and have our prelogin agent displayed in the same. But, this seems like implementing the entire login window for the sake of just a component with in the login screen.


Also, we tried the FileVault scenario you have described. On disabling the FileVault using the following steps, we are still not able to see our pre login agent, post restart:

  1. Choose Apple menu > System Preferences, then click Security & Privacy.
  2. Click the FileVault tab.
  3. Click , then enter an administrator name and password.
  4. Click Turn Off FileVault.

It is better to avoid agreeing to requirements on systems that you do not control.

I am not sure if you have understood our requirement exactly.

I’m pretty sure I understand what you’re requesting. If you want me to go into more detail you should open a DTS tech support incident and we can discuss things in that context. However, I very much doubt we’ll find a simple solution meets all of your requirements.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"