gio.credentials

Module for [Credentials] class

Types 3

The [gio.credentials.Credentials] type is a reference-counted wrapper for native credentials.

The information in [gio.credentials.Credentials] is typically used for identifying, authenticating and authorizing other processes.

Some operating systems supports looking up the credentials of the remote peer of a communication endpoint - see e.g. [gio.socket.Socket.getCredentials].

Some operating systems supports securely sending and receiving credentials over a Unix Domain Socket, see [gio.unix_credentials_message.UnixCredentialsMessage], [gio.unix_connection.UnixConnection.sendCredentials] and [gio.unix_connection.UnixConnection.receiveCredentials] for details.

On Linux, the native credential type is a struct ucred - see the

unix(7) man page) for details. This corresponds to

[gio.types.CredentialsType.LinuxUcred].

On Apple operating systems (including iOS, tvOS, and macOS), the native credential type is a struct xucred. This corresponds to [gio.types.CredentialsType.AppleXucred].

On FreeBSD, Debian GNU/kFreeBSD, and GNU/Hurd, the native credential type is a struct cmsgcred. This corresponds to [gio.types.CredentialsType.FreebsdCmsgcred].

On NetBSD, the native credential type is a struct unpcbid. This corresponds to [gio.types.CredentialsType.NetbsdUnpcbid].

On OpenBSD, the native credential type is a struct sockpeercred. This corresponds to [gio.types.CredentialsType.OpenbsdSockpeercred].

On Solaris (including OpenSolaris and its derivatives), the native credential type is a ucred_t. This corresponds to [gio.types.CredentialsType.SolarisUcred].

Since GLib 2.72, on Windows, the native credentials may contain the PID of a process. This corresponds to [gio.types.CredentialsType.Win32Pid].

Methods
GType _gType() @property
Credentials self()Returns `this`, for use in `with` statements.
CredentialsGidBuilder builder()Get builder for [gio.credentials.Credentials] Returns: New builder object
int getUnixPid()Tries to get the UNIX process identifier from credentials. This method is only available on UNIX platforms.
uint getUnixUser()Tries to get the UNIX user identifier from credentials. This method is only available on UNIX platforms.
bool isSameUser(gio.credentials.Credentials otherCredentials)Checks if credentials and other_credentials is the same user.
void setNative(gio.types.CredentialsType nativeType, void * native)Copies the native credentials of type native_type from native into credentials.
bool setUnixUser(uint uid)Tries to set the UNIX user identifier on credentials. This method is only available on UNIX platforms.
string toString_()Creates a human-readable textual representation of credentials that can be used in logging and debug messages. The format of the returned string may change in future GLib release. Returns: A string...
Constructors
this(void * ptr, Flag!"Take" take)
this()Creates a new #GCredentials object with credentials matching the the current process. Returns: A #GCredentials. Free with [gobject.object.ObjectWrap.unref].

Fluent builder for [gio.credentials.Credentials]