Writing polkit Authentication Agents

Authentication agents are provided by desktop environments. When an user session starts, the agent registers with the polkit Authority using the RegisterAuthenticationAgent() method. When services are needed, the authority will invoke methods on the org.freedesktop.PolicyKit1.AuthenticationAgent D-Bus interface. Once the user is authenticated, (a privileged part of) the agent invokes the AuthenticationAgentResponse2() method. This method should be treated as an internal implementation detail, and callers should use the PolkitAgentSession API to invoke it, which currently uses a setuid helper program.

The libpolkit-agent-1 library provides helpers to make it easy to build authentication agents that use the native authentication system e.g. pam(8).

If the environment variable POLKIT_DEBUG is set, the libpolkit-agent-1 library prints out diagnostic information on standard output.