Skip to content

Gio.UnixCredentialsMessage

class — extends SocketControlMessage

This SocketControlMessage contains a Credentials instance. It may be sent using Socket.send_message and received using Socket.receive_message over UNIX sockets (ie: sockets in the G_SOCKET_FAMILY_UNIX family).

For an easier way to send and receive credentials over stream-oriented UNIX sockets, see UnixConnection.send_credentials and UnixConnection.receive_credentials. To receive credentials of a foreign process connected to a socket, use Socket.get_credentials.

Since GLib 2.72, GUnixCredentialMessage is available on all platforms. It requires underlying system support (such as Windows 10 with AF_UNIX) at run time.

Before GLib 2.72, <gio/gunixcredentialsmessage.h> belonged to the UNIX-specific GIO interfaces, thus you had to use the gio-unix-2.0.pc pkg-config file when using it. This is no longer necessary since GLib 2.72.

Constructors

new

@classmethod
def new(cls) -> SocketControlMessage

Creates a new UnixCredentialsMessage with credentials matching the current processes.

new_with_credentials

@classmethod
def new_with_credentials(cls, credentials: Credentials) -> SocketControlMessage

Creates a new UnixCredentialsMessage holding credentials.

Parameters:

Methods

get_credentials

def get_credentials(self) -> Credentials

Gets the credentials stored in message.

Static functions

is_supported

@staticmethod
def is_supported() -> bool

Checks if passing Credentials on a Socket is supported on this platform.

Properties

credentials

credentials: Credentials  # read/write

The credentials stored in the message.