NM.SecretAgentOld

g GObject.GInterface GObject.GInterface Gio.AsyncInitable Gio.AsyncInitable GObject.GInterface->Gio.AsyncInitable Gio.Initable Gio.Initable GObject.GInterface->Gio.Initable GObject.Object GObject.Object NM.SecretAgentOld NM.SecretAgentOld GObject.Object->NM.SecretAgentOld Gio.AsyncInitable->NM.SecretAgentOld Gio.Initable->NM.SecretAgentOld

Subclasses:

None

Methods

Inherited:

GObject.Object (37), Gio.AsyncInitable (4), Gio.Initable (2)

Structs:

GObject.ObjectClass (5)

delete_secrets (connection, callback, *user_data)

destroy ()

enable (enable)

get_context_busy_watcher ()

get_dbus_connection ()

get_dbus_name_owner ()

get_main_context ()

get_registered ()

get_secrets (connection, setting_name, hints, flags, callback, *user_data)

register (cancellable)

register_async (cancellable, callback, *user_data)

register_finish (result)

save_secrets (connection, callback, *user_data)

unregister (cancellable)

unregister_async (cancellable, callback, *user_data)

unregister_finish (result)

Virtual Methods

Inherited:

GObject.Object (7), Gio.AsyncInitable (2), Gio.Initable (1)

do_cancel_get_secrets (connection_path, setting_name)

do_delete_secrets (connection, connection_path, callback, *user_data)

do_get_secrets (connection, connection_path, setting_name, hints, flags, callback, *user_data)

do_save_secrets (connection, connection_path, callback, *user_data)

Properties

Name

Type

Flags

Short Description

auto-register

bool

r/w/c

capabilities

NM.SecretAgentCapabilities

r/w/c

dbus-connection

Gio.DBusConnection

r/w/co

identifier

str

r/w/co

registered

bool

r

Signals

Inherited:

GObject.Object (1)

Fields

Inherited:

GObject.Object (1)

Name

Type

Access

Description

parent

GObject.Object

r

Class Details

class NM.SecretAgentOld(**kwargs)
Bases:

GObject.Object, Gio.AsyncInitable, Gio.Initable

Abstract:

Yes

Structure:

NM.SecretAgentOldClass

delete_secrets(connection, callback, *user_data)
Parameters:

Asynchronously asks the agent to delete all saved secrets belonging to connection.

destroy()

Since 1.24, the instance will already register a D-Bus object on the D-Bus connection during initialization. That object will stay registered until self gets unrefed (destroyed) or this function is called. This function performs the necessary cleanup to tear down the instance. Afterwards, the function can not longer be used. This is optional, but necessary to ensure unregistering the D-Bus object at a define point, when other users might still have a reference on self.

You may call this function any time and repeatedly. However, after destroying the instance, it is a bug to still use the instance for other purposes. The instance becomes defunct and cannot re-register.

New in version 1.24.

enable(enable)
Parameters:

enable (bool) – whether to enable or disable the listener.

This has the same effect as setting NM.SECRET_AGENT_OLD_AUTO_REGISTER property.

Unlike most other functions, you may already call this function before initialization completes.

New in version 1.24.

get_context_busy_watcher()
Returns:

a GObject.Object that you may register a weak pointer to know that the GLib.MainContext is still kept busy by self.

Return type:

GObject.Object

Returns a GObject.Object that stays alive as long as there are pending requests in the Gio.DBusConnection. Such requests keep the GLib.MainContext alive, and thus you may want to keep iterating the context as long until a weak reference indicates that this object is gone. This is useful because even when you destroy the instance right away (and all the internally pending requests get cancelled), any pending Gio.DBusConnection.call() requests will still invoke the result on the GLib.MainContext. Hence, this allows you to know how long you must iterate the context to know that all remains are cleaned up.

New in version 1.24.

get_dbus_connection()
Returns:

the Gio.DBusConnection used by the secret agent. You may either set this as construct property NM.SECRET_AGENT_OLD_DBUS_CONNECTION, or it will automatically set during initialization.

Return type:

Gio.DBusConnection

New in version 1.24.

get_dbus_name_owner()
Returns:

the current D-Bus name owner. While this property is set while registering, it really only makes sense when the NM.SecretAgentOld.get_registered() indicates that registration is successful.

Return type:

str

New in version 1.24.

get_main_context()
Returns:

the GLib.MainContext instance associate with the instance. This is the GLib.MainContext.get_thread_default() at the time when creating the instance.

Return type:

GLib.MainContext

New in version 1.24.

get_registered()
Returns:

a True if the agent is registered, False if it is not.

Return type:

bool

Note that the secret agent transparently registers and re-registers as the D-Bus name owner appears. Hence, this property is not really useful. Also, to be graceful against races during registration, the instance will already accept requests while being in the process of registering. If you need to avoid races and want to wait until self is registered, call NM.SecretAgentOld.register_async(). If that function completes with success, you know the instance is registered.

get_secrets(connection, setting_name, hints, flags, callback, *user_data)
Parameters:

Asynchronously retrieves secrets belonging to connection for the setting setting_name. flags indicate specific behavior that the secret agent should use when performing the request, for example returning only existing secrets without user interaction, or requesting entirely new secrets from the user.

register(cancellable)
Parameters:

cancellable (Gio.Cancellable or None) – a Gio.Cancellable, or None

Raises:

GLib.Error

Returns:

True if registration was successful, False on error.

Since 1.24, this can no longer fail unless the cancellable gets cancelled. Contrary to NM.SecretAgentOld.register_async(), this also does not wait for the registration to succeed. You cannot synchronously (without iterating the caller’s GLib.MainContext) wait for registration.

Since 1.24, registration is idempotent. It has the same effect as setting NM.SECRET_AGENT_OLD_AUTO_REGISTER to True or NM.SecretAgentOld.enable().

Return type:

bool

Registers the NM.SecretAgentOld with the NetworkManager secret manager, indicating to NetworkManager that the agent is able to provide and save secrets for connections on behalf of its user.

Deprecated since version 1.24: Use NM.SecretAgentOld.enable() or NM.SecretAgentOld.register_async().

register_async(cancellable, callback, *user_data)
Parameters:

Asynchronously registers the NM.SecretAgentOld with the NetworkManager secret manager, indicating to NetworkManager that the agent is able to provide and save secrets for connections on behalf of its user.

Since 1.24, registration cannot fail and is idempotent. It has the same effect as setting NM.SECRET_AGENT_OLD_AUTO_REGISTER to True or NM.SecretAgentOld.enable().

Since 1.24, the asynchronous result indicates whether the instance is successfully registered. In any case, this call enables the agent and it will automatically try to register and handle secret requests. A failure of this function only indicates that currently the instance might not be ready (but since it will automatically try to recover, it might be ready in a moment afterwards). Use this function if you want to check and ensure that the agent is registered.

register_finish(result)
Parameters:

result (Gio.AsyncResult) – the result passed to the Gio.AsyncReadyCallback

Raises:

GLib.Error

Returns:

True if registration was successful, False on error.

Since 1.24, registration cannot fail and is idempotent. It has the same effect as setting NM.SECRET_AGENT_OLD_AUTO_REGISTER to True or NM.SecretAgentOld.enable().

Return type:

bool

Gets the result of a call to NM.SecretAgentOld.register_async().

save_secrets(connection, callback, *user_data)
Parameters:

Asynchronously ensures that all secrets inside connection are stored to disk.

unregister(cancellable)
Parameters:

cancellable (Gio.Cancellable or None) – a Gio.Cancellable, or None

Raises:

GLib.Error

Returns:

True if unregistration was successful, False on error

Since 1.24, registration cannot fail and is idempotent. It has the same effect as setting NM.SECRET_AGENT_OLD_AUTO_REGISTER to False or NM.SecretAgentOld.enable().

Return type:

bool

Unregisters the NM.SecretAgentOld with the NetworkManager secret manager, indicating to NetworkManager that the agent will no longer provide or store secrets on behalf of this user.

Deprecated since version 1.24: Use NM.SecretAgentOld.enable().

unregister_async(cancellable, callback, *user_data)
Parameters:

Asynchronously unregisters the NM.SecretAgentOld with the NetworkManager secret manager, indicating to NetworkManager that the agent will no longer provide or store secrets on behalf of this user.

Since 1.24, registration cannot fail and is idempotent. It has the same effect as setting NM.SECRET_AGENT_OLD_AUTO_REGISTER to False or NM.SecretAgentOld.enable().

Deprecated since version 1.24: Use NM.SecretAgentOld.enable().

unregister_finish(result)
Parameters:

result (Gio.AsyncResult) – the result passed to the Gio.AsyncReadyCallback

Raises:

GLib.Error

Returns:

True if unregistration was successful, False on error.

Since 1.24, registration cannot fail and is idempotent. It has the same effect as setting NM.SECRET_AGENT_OLD_AUTO_REGISTER to False or NM.SecretAgentOld.enable().

Return type:

bool

Gets the result of a call to NM.SecretAgentOld.unregister_async().

Deprecated since version 1.24: Use NM.SecretAgentOld.enable().

do_cancel_get_secrets(connection_path, setting_name) virtual
Parameters:
  • connection_path (str) –

  • setting_name (str) –

do_delete_secrets(connection, connection_path, callback, *user_data) virtual
Parameters:

Asynchronously asks the agent to delete all saved secrets belonging to connection.

do_get_secrets(connection, connection_path, setting_name, hints, flags, callback, *user_data) virtual
Parameters:

Asynchronously retrieves secrets belonging to connection for the setting setting_name. flags indicate specific behavior that the secret agent should use when performing the request, for example returning only existing secrets without user interaction, or requesting entirely new secrets from the user.

do_save_secrets(connection, connection_path, callback, *user_data) virtual
Parameters:

Asynchronously ensures that all secrets inside connection are stored to disk.

Property Details

NM.SecretAgentOld.props.auto_register
Name:

auto-register

Type:

bool

Default Value:

True

Flags:

READABLE, WRITABLE, CONSTRUCT

If True (the default), the agent will always be registered when NetworkManager is running; if NetworkManager exits and restarts, the agent will re-register itself automatically.

In particular, if this property is True at construct time, then the agent will register itself with NetworkManager during construction/initialization and initialization will only complete after registration is completed (either successfully or unsuccessfully). Since 1.24, a failure to register will no longer cause initialization of NM.SecretAgentOld to fail.

If the property is False, the agent will not automatically register with NetworkManager, and NM.SecretAgentOld.enable() or NM.SecretAgentOld.register_async() must be called to register it.

Calling NM.SecretAgentOld.enable() has the same effect as setting this property.

NM.SecretAgentOld.props.capabilities
Name:

capabilities

Type:

NM.SecretAgentCapabilities

Default Value:

NM.SecretAgentCapabilities.NONE

Flags:

READABLE, WRITABLE, CONSTRUCT

A bitfield of NM.SecretAgentCapabilities.

Changing this property is possible at any time. In case the secret agent is currently registered, this will cause a re-registration.

NM.SecretAgentOld.props.dbus_connection
Name:

dbus-connection

Type:

Gio.DBusConnection

Default Value:

None

Flags:

READABLE, WRITABLE, CONSTRUCT_ONLY

The Gio.DBusConnection used by the instance. You may either set this as construct-only property, or otherwise NM.SecretAgentOld will choose a connection via Gio.bus_get() during initialization.

New in version 1.24.

NM.SecretAgentOld.props.identifier
Name:

identifier

Type:

str

Default Value:

None

Flags:

READABLE, WRITABLE, CONSTRUCT_ONLY

Identifies this agent; only one agent in each user session may use the same identifier. Identifier formatting follows the same rules as D-Bus bus names with the exception that the ‘:’ character is not allowed. The valid set of characters is “‘A-Z [a-z]’[0-9]_-.” and the identifier is limited in length to 255 characters with a minimum of 3 characters. An example valid identifier is ‘org.gnome.nm-applet’ (without quotes).

NM.SecretAgentOld.props.registered
Name:

registered

Type:

bool

Default Value:

False

Flags:

READABLE

True if the agent is registered with NetworkManager, False if not.