GDBusAuthObserver
GDBusAuthObserver — Object used for authenticating connections
|
|
Object Hierarchy
GObject
╰── GDBusAuthObserver
Includes
#include <gio/gio.h>
Description
The GDBusAuthObserver type provides a mechanism for participating
in how a GDBusServer (or a GDBusConnection) authenticates remote
peers. Simply instantiate a GDBusAuthObserver and connect to the
signals you are interested in. Note that new signals may be added
in the future
Controlling Authentication Mechanisms
By default, a GDBusServer or server-side GDBusConnection will allow
any authentication mechanism to be used. If you only
want to allow D-Bus connections with the EXTERNAL mechanism,
which makes use of credentials passing and is the recommended
mechanism for modern Unix platforms such as Linux and the BSD family,
you would use a signal handler like this:
Controlling Authorization
By default, a GDBusServer or server-side GDBusConnection will accept
connections from any successfully authenticated user (but not from
anonymous connections using the ANONYMOUS mechanism). If you only
want to allow D-Bus connections from processes owned by the same uid
as the server, you would use a signal handler like the following:
Functions
g_dbus_auth_observer_allow_mechanism ()
gboolean
g_dbus_auth_observer_allow_mechanism (GDBusAuthObserver *observer,
const gchar *mechanism);
Emits the “allow-mechanism” signal on observer
.
Returns
TRUE if mechanism
can be used to authenticate the other peer, FALSE if not.
Since: 2.34
Types and Values
GDBusAuthObserver
typedef struct _GDBusAuthObserver GDBusAuthObserver;
The GDBusAuthObserver structure contains only private data and
should only be accessed using the provided API.
Since: 2.26
Signal Details
The “allow-mechanism” signal
gboolean
user_function (GDBusAuthObserver *observer,
gchar *mechanism,
gpointer user_data)
Emitted to check if mechanism
is allowed to be used.
Returns
TRUE if mechanism
can be used to authenticate the other peer, FALSE if not.
Flags: Run Last
Since: 2.34
The “authorize-authenticated-peer” signal
gboolean
user_function (GDBusAuthObserver *observer,
GIOStream *stream,
GCredentials *credentials,
gpointer user_data)
Emitted to check if a peer that is successfully authenticated
is authorized.
Returns
TRUE if the peer is authorized, FALSE if not.
Flags: Run Last
Since: 2.26