#PolkitAgentListener is an abstract base class used for implementing authentication
agents. To implement an authentication agent, simply subclass #PolkitAgentListener and
implement the @initiate_authentication and @initiate_authentication_finish methods.
Typically authentication agents use #PolkitAgentSession to
authenticate users (via passwords) and communicate back the
authentication result to the PolicyKit daemon.
To register a #PolkitAgentListener with the PolicyKit daemon, use
polkit_agent_listener_register() or
polkit_agent_listener_register_with_options().
Unregisters @listener.
A handle obtained from polkit_agent_listener_register().
Called on a registered authentication agent (see
polkit_agent_listener_register()) when the user owning the session
needs to prove he is one of the identities listed in @identities.
When the user is done authenticating (for example by dismissing an
authentication dialog or by successfully entering a password or
otherwise proving the user is one of the identities in
@identities), @callback will be invoked. The caller then calls
polkit_agent_listener_initiate_authentication_finish() to get the
result.
#PolkitAgentListener derived subclasses imlementing this method
<emphasis>MUST</emphasis> not ignore @cancellable; callers of this
function can and will use it. Additionally, @callback must be
invoked in the <link
linkend="g-main-context-push-thread-default">thread-default main
loop</link> of the thread that this method is called from.
A #PolkitAgentListener.
The action to authenticate for.
The message to present to the user.
A themed icon name representing the action or %NULL.
Details describing the action.
The cookie for the authentication request.
A list of #PolkitIdentity objects that the user can choose to authenticate as.
A #GCancellable.
Function to call when the user is done authenticating.
Data to pass to @callback.
Finishes an authentication request from the PolicyKit daemon, see
polkit_agent_listener_initiate_authentication() for details.
%TRUE if @error is set.
A #PolkitAgentListener.
A #GAsyncResult obtained from the #GAsyncReadyCallback function passed to polkit_agent_listener_initiate_authentication().
Called on a registered authentication agent (see
polkit_agent_listener_register()) when the user owning the session
needs to prove he is one of the identities listed in @identities.
When the user is done authenticating (for example by dismissing an
authentication dialog or by successfully entering a password or
otherwise proving the user is one of the identities in
@identities), @callback will be invoked. The caller then calls
polkit_agent_listener_initiate_authentication_finish() to get the
result.
#PolkitAgentListener derived subclasses imlementing this method
<emphasis>MUST</emphasis> not ignore @cancellable; callers of this
function can and will use it. Additionally, @callback must be
invoked in the <link
linkend="g-main-context-push-thread-default">thread-default main
loop</link> of the thread that this method is called from.
A #PolkitAgentListener.
The action to authenticate for.
The message to present to the user.
A themed icon name representing the action or %NULL.
Details describing the action.
The cookie for the authentication request.
A list of #PolkitIdentity objects that the user can choose to authenticate as.
A #GCancellable.
Function to call when the user is done authenticating.
Data to pass to @callback.
Finishes an authentication request from the PolicyKit daemon, see
polkit_agent_listener_initiate_authentication() for details.
%TRUE if @error is set.
A #PolkitAgentListener.
A #GAsyncResult obtained from the #GAsyncReadyCallback function passed to polkit_agent_listener_initiate_authentication().
Registers @listener with the PolicyKit daemon as an authentication
agent for @subject. This is implemented by registering a D-Bus
object at @object_path on the unique name assigned by the system
message bus.
Whenever the PolicyKit daemon needs to authenticate a processes
that is related to @subject, the methods
polkit_agent_listener_initiate_authentication() and
polkit_agent_listener_initiate_authentication_finish() will be
invoked on @listener.
Note that registration of an authentication agent can fail; for
example another authentication agent may already be registered for
@subject.
Note that the calling thread is blocked until a reply is received.
%NULL if @error is set, otherwise a
registration handle that can be used with
polkit_agent_listener_unregister().
A #PolkitAgentListener.
A set of flags from the #PolkitAgentRegisterFlags enumeration.
The subject to become an authentication agent for, typically a #PolkitUnixSession object.
The D-Bus object path to use for the authentication agent or %NULL for the default object path.
A #GCancellable or %NULL.
Like polkit_agent_listener_register() but takes options to influence registration. See the
<link linkend="eggdbus-method-org.freedesktop.PolicyKit1.Authority.RegisterAuthenticationAgentWithOptions">RegisterAuthenticationAgentWithOptions()</link> D-Bus method for details.
%NULL if @error is set, otherwise a
registration handle that can be used with
polkit_agent_listener_unregister().
A #PolkitAgentListener.
A set of flags from the #PolkitAgentRegisterFlags enumeration.
The subject to become an authentication agent for, typically a #PolkitUnixSession object.
The D-Bus object path to use for the authentication agent or %NULL for the default object path.
A #GVariant with options or %NULL.
A #GCancellable or %NULL.
VFuncs that authentication agents needs to implement.
The parent class.
A #PolkitAgentListener.
The action to authenticate for.
The message to present to the user.
A themed icon name representing the action or %NULL.
Details describing the action.
The cookie for the authentication request.
A list of #PolkitIdentity objects that the user can choose to authenticate as.
A #GCancellable.
Function to call when the user is done authenticating.
Data to pass to @callback.
%TRUE if @error is set.
A #PolkitAgentListener.
A #GAsyncResult obtained from the #GAsyncReadyCallback function passed to polkit_agent_listener_initiate_authentication().
Flags used in polkit_agent_listener_register().
No flags are set.
Run the listener in a dedicated thread.
The #PolkitAgentSession class is an abstraction used for interacting with the
native authentication system (for example PAM) for obtaining authorizations.
This class is typically used together with instances that are derived from
the #PolkitAgentListener abstract base class.
To perform the actual authentication, #PolkitAgentSession uses a trusted suid helper.
The authentication conversation is done through a pipe. This is transparent; the user
only need to handle the
#PolkitAgentSession::request,
#PolkitAgentSession::show-info,
#PolkitAgentSession::show-error and
#PolkitAgentSession::completed
signals and invoke polkit_agent_session_response() in response to requests.
If the user successfully authenticates, the authentication helper will invoke
a method on the PolicyKit daemon (see polkit_authority_authentication_agent_response_sync())
with the given @cookie. Upon receiving a positive response from the PolicyKit daemon (via
the authentication helper), the #PolkitAgentSession::completed signal will be emitted
with the @gained_authorization paramter set to %TRUE.
If the user is unable to authenticate, the #PolkitAgentSession::completed signal will
be emitted with the @gained_authorization paramter set to %FALSE.
Creates a new authentication session.
The caller should connect to the
#PolkitAgentSession::request,
#PolkitAgentSession::show-info,
#PolkitAgentSession::show-error and
#PolkitAgentSession::completed
signals and then call polkit_agent_session_initiate() to initiate the authentication session.
A #PolkitAgentSession. Free with g_object_unref().
The identity to authenticate.
The cookie obtained from the PolicyKit daemon
Cancels an authentication session. This will make @session emit the #PolkitAgentSession::completed
signal.
A #PolkitAgentSession.
Initiates the authentication session. Before calling this method,
make sure to connect to the various signals. The signals will be
emitted in the <link
linkend="g-main-context-push-thread-default">thread-default main
loop</link> that this method is invoked from.
Use polkit_agent_session_cancel() to cancel the session.
A #PolkitAgentSession.
Function for providing response to requests received
via the #PolkitAgentSession::request signal.
A #PolkitAgentSession.
Response from the user, typically a password.
The cookie obtained from the PolicyKit daemon
The identity to authenticate.
Emitted when the authentication session has been completed or
cancelled. The @gained_authorization parameter is %TRUE only if
the user successfully authenticated.
Upon receiving this signal, the user should free @session using g_object_unref().
%TRUE only if the authorization was successfully obtained.
Emitted when the user is requested to answer a question.
When the response has been collected from the user, call polkit_agent_session_response().
The request to show the user, e.g. "name: " or "password: ".
%TRUE if the response to the request SHOULD be echoed on the
screen, %FALSE if the response MUST NOT be echoed to the screen.
Emitted when there is information related to an error condition to be displayed to the user.
An error string to display to the user.
Emitted when there is information to be displayed to the user.
A string to display to the user.
#PolkitAgentTextListener is an #PolkitAgentListener implementation
that interacts with the user using a textual interface.
Creates a new #PolkitAgentTextListener for authenticating the user
via an textual interface on the controlling terminal
(e.g. <filename>/dev/tty</filename>). This can fail if e.g. the
current process has no controlling terminal.
A #PolkitAgentTextListener or %NULL if @error is set. Free with g_object_unref() when done with it.
A #GCancellable or %NULL.
(deprecated)
A #PolkitAgentListener.
The subject to become an authentication agent for, typically a #PolkitUnixSession object.
The D-Bus object path to use for the authentication agent or %NULL for the default object path.