Basics

Guides

API Reference

Menu

Basics

Guides

API Reference

class: DBusAuthObserverMeta

[359:14] static extends: object

Generated metadata helpers for DBusAuthObserver class surfaces.

Methods

  • signals ()

    Returns signal metadata for DBusAuthObserver.

    • @r A list.

class: DBusAuthObserver

[36:7] extends: object

GDBusAuthObserver provides a mechanism for participating in how a [class@Gio.DBusServer] (or a [class@Gio.DBusConnection]) 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: c static gboolean on_allow_mechanism (GDBusAuthObserver *observer, const gchar *mechanism, gpointer user_data) { if (g_strcmp0 (mechanism, "EXTERNAL") == 0) { return TRUE; } return FALSE; } ## 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, since GLib 2.68, you should use the G_DBUS_SERVER_FLAGS_AUTHENTICATION_REQUIRE_SAME_USER flag. It’s equivalent to the following signal handler: c static gboolean on_authorize_authenticated_peer (GDBusAuthObserver *observer, GIOStream *stream, GCredentials *credentials, gpointer user_data) { gboolean authorized; authorized = FALSE; if (credentials != NULL) { GCredentials *own_credentials; own_credentials = g_credentials_new (); if (g_credentials_is_same_user (credentials, own_credentials, NULL)) authorized = TRUE; g_object_unref (own_credentials); } return authorized; }

Members

  • handleObj
  • lib
  • retainedCallbacks
  • signalHandlerNames
  • signalSetterHandlers

Methods

  • DBusAuthObserver ()

    Creates a new #GDBusAuthObserver object.

  • toNativeHandle (Source)

    Normalizes a constructor argument into a raw pointer carrier. Accepts a raw NativeHandle, a raw NativeBuffer returned from fn.call(...), another generated wrapper exposing handle(), or null. Returns null when the argument carries no pointer.

    • @p Source is the raw handle, raw buffer, wrapper, or null.
    • @r A raw pointer carrier or null when no pointer is present.
  • getLib ()

    Returns the opened native library for this generated wrapper.

    • @r The opened native library.
  • handle ()

    Returns the wrapped NativeHandle.

    • @r The wrapped NativeHandle.
  • isNull ()

    Returns true when the wrapped handle is null.

    • @r A bool.
  • describe ()

    Returns a small string for debugging generated wrappers.

    • @r A string.
  • asObject ()

    Wraps this handle as Object.

    • @r A Object object.
  • connectSignal (string Name, CallbackObj)

    Connects one generated callback wrapper to a named signal.

    • @p Name is the signal name.
    • @p CallbackObj is the generated callback wrapper to connect.
    • @r The connected handler id.
  • disconnectSignalHandler (int HandlerId)

    Disconnects one retained signal handler id.

    • @p HandlerId is the signal handler id to disconnect.
    • @r None.
  • setOnAllowmechanism (callback Fn, UserData = null)

    Emitted to check if @mechanism is allowed to be used.

    • @p Fn is the Aussom callback.
    • @p Fn is called with (DBusAuthObserver Self, string Mechanism).
    • @p UserData is retained and passed through to the generated callback wrapper when provided.
    • @r The connected handler id.
  • setOnAuthorizeauthenticatedpeer (callback Fn, UserData = null)

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

    • @p Fn is the Aussom callback.
    • @p Fn is called with (DBusAuthObserver Self, IOStream Stream, Credentials Credentials).
    • @p UserData is retained and passed through to the generated callback wrapper when provided.
    • @r The connected handler id.
  • allow_mechanism (string mechanism)

    Emits the #GDBusAuthObserver::allow-mechanism signal on @observer.

    • @p mechanism is The name of the mechanism, e.g. DBUS_COOKIE_SHA1..
  • authorize_authenticated_peer (object stream, object credentials)

    Emits the #GDBusAuthObserver::authorize-authenticated-peer signal on

    • @observer. ``
    • @p stream is A #GIOStream for the #GDBusConnection..
    • @p credentials is Credentials received from the peer or %NULL..

class: DBusAuthObserverAllowmechanismCallback

[216:7] extends: object

Generated low-level callback wrapper for GIR callback allow-mechanism.

Members

  • callbackObj
  • userFn
  • userData
  • hasUserData

Methods

  • DBusAuthObserverAllowmechanismCallback (callback Fn, UserData = null)

    Creates one native callback wrapper. The wrapper owns a trampoline that converts native pointers into generated wrapper objects before invoking Fn.

    • @p Fn is the Aussom callback implementation.
    • @p UserData is retained and passed through to Fn on each invocation when provided.
  • trampoline (nativeSelf, mechanism, nativeUserData)

    Internal trampoline. Converts native pointer arguments into generated wrapper instances, then invokes the user's callback.

  • callback ()

    Returns the wrapped NativeCallback.

  • handle ()

    Returns the callback as a NativeHandle.

  • close ()

    Closes the underlying NativeCallback.

  • isClosed ()

    Returns true when the callback has been closed.

class: DBusAuthObserverAuthorizeauthenticatedpeerCallback

[287:7] extends: object

Generated low-level callback wrapper for GIR callback authorize-authenticated-peer.

Members

  • callbackObj
  • userFn
  • userData
  • hasUserData

Methods

  • DBusAuthObserverAuthorizeauthenticatedpeerCallback (callback Fn, UserData = null)

    Creates one native callback wrapper. The wrapper owns a trampoline that converts native pointers into generated wrapper objects before invoking Fn.

    • @p Fn is the Aussom callback implementation.
    • @p UserData is retained and passed through to Fn on each invocation when provided.
  • trampoline (nativeSelf, stream, credentials, nativeUserData)

    Internal trampoline. Converts native pointer arguments into generated wrapper instances, then invokes the user's callback.

  • callback ()

    Returns the wrapped NativeCallback.

  • handle ()

    Returns the callback as a NativeHandle.

  • close ()

    Closes the underlying NativeCallback.

  • isClosed ()

    Returns true when the callback has been closed.