PolkitAgent.Listener

g GObject.Object GObject.Object PolkitAgent.Listener PolkitAgent.Listener GObject.Object->PolkitAgent.Listener

Subclasses:PolkitAgent.TextListener

Methods

Inherited:GObject.Object (37)
Structs:GObject.ObjectClass (5)
class unregister (registration_handle)
  initiate_authentication_finish (res)
  register (flags, subject, object_path, cancellable)
  register_with_options (flags, subject, object_path, options, cancellable)

Virtual Methods

Inherited:GObject.Object (7)
  do_initiate_authentication_finish (res)

Properties

None

Signals

Inherited:GObject.Object (1)

Fields

Inherited:GObject.Object (1)
Name Type Access Description
parent_instance GObject.Object r  

Class Details

class PolkitAgent.Listener(**kwargs)
Bases:GObject.Object
Abstract:Yes
Structure:PolkitAgent.ListenerClass

PolkitAgent.Listener is an abstract base class used for implementing authentication agents. To implement an authentication agent, simply subclass PolkitAgent.Listener and implement the initiate_authentication and initiate_authentication_finish methods.

Typically authentication agents use PolkitAgent.Session to authenticate users (via passwords) and communicate back the authentication result to the PolicyKit daemon.

To register a PolkitAgent.Listener with the PolicyKit daemon, use PolkitAgent.Listener.register() or PolkitAgent.Listener.register_with_options().

classmethod unregister(registration_handle)
Parameters:registration_handle (object or None) – A handle obtained from PolkitAgent.Listener.register().

Unregisters listener.

initiate_authentication_finish(res)
Parameters:res (Gio.AsyncResult) – A Gio.AsyncResult obtained from the Gio.AsyncReadyCallback function passed to polkit_agent_listener_initiate_authentication().
Raises:GLib.Error
Returns:True if error is set.
Return type:bool

Finishes an authentication request from the PolicyKit daemon, see polkit_agent_listener_initiate_authentication() for details.

register(flags, subject, object_path, cancellable)
Parameters:
Raises:

GLib.Error

Returns:

None if error is set, otherwise a registration handle that can be used with PolkitAgent.Listener.unregister().

Return type:

object or None

Registers self 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 PolkitAgent.Listener.initiate_authentication_finish() will be invoked on self.

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.

register_with_options(flags, subject, object_path, options, cancellable)
Parameters:
Raises:

GLib.Error

Returns:

None if error is set, otherwise a registration handle that can be used with PolkitAgent.Listener.unregister().

Return type:

object or None

Like PolkitAgent.Listener.register() but takes options to influence registration. See the

‘RegisterAuthenticationAgentWithOptions() [eggdbus-method-org.freedesktop.PolicyKit1.Authority.RegisterAuthenticationAgentWithOptions]’ D-Bus method for details.

do_initiate_authentication_finish(res) virtual
Parameters:res (Gio.AsyncResult) – A Gio.AsyncResult obtained from the Gio.AsyncReadyCallback function passed to polkit_agent_listener_initiate_authentication().
Returns:True if error is set.
Return type:bool

Finishes an authentication request from the PolicyKit daemon, see polkit_agent_listener_initiate_authentication() for details.