DBusAuthObserver

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 # {[auth-observer|auth-observer]}

For example, 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:

1 
2 static gboolean
3 on_authorize_authenticated_peer (GDBusAuthObserver *observer,
4 GIOStream         *stream,
5 GCredentials      *credentials,
6 gpointer           user_data)
7 {
8 gboolean authorized;
9 
10 authorized = FALSE;
11 if (credentials != NULL)
12 {
13 GCredentials *own_credentials;
14 own_credentials = g_credentials_new ();
15 if (g_credentials_is_same_user (credentials, own_credentials, NULL))
16 authorized = TRUE;
17 g_object_unref (own_credentials);
18 }
19 
20 return authorized;
21 }

Constructors

this
this(GDBusAuthObserver* gDBusAuthObserver, bool ownedRef = false)

Sets our main struct and passes it to the parent class.

this
this()

Creates a new GDBusAuthObserver object.

Members

Functions

addOnAllowMechanism
gulong addOnAllowMechanism(bool delegate(string, DBusAuthObserver) dlg, ConnectFlags connectFlags = cast(ConnectFlags)0)

Emitted to check if mechanism is allowed to be used.

addOnAuthorizeAuthenticatedPeer
gulong addOnAuthorizeAuthenticatedPeer(bool delegate(IOStream, Credentials, DBusAuthObserver) dlg, ConnectFlags connectFlags = cast(ConnectFlags)0)

Emitted to check if a peer that is successfully authenticated is authorized.

allowMechanism
bool allowMechanism(string mechanism)

Emits the allow-mechanism signal on observer.

authorizeAuthenticatedPeer
bool authorizeAuthenticatedPeer(IOStream stream, Credentials credentials)

Emits the authorize-authenticated-peer signal on observer.

getDBusAuthObserverStruct
GDBusAuthObserver* getDBusAuthObserverStruct(bool transferOwnership = false)

Get the main Gtk struct

getStruct
void* getStruct()

the main Gtk struct as a void*

Static functions

getType
GType getType()

Variables

gDBusAuthObserver
GDBusAuthObserver* gDBusAuthObserver;

the main Gtk struct

Meta

Since

2.26