Gio.Credentials
Description: Reference for Gio.Credentials

### Class

# GioCredentials

since: 2.26

#### Description

    final class Gio.Credentials : GObject.Object
    {
      /* No available fields */
    }

The `GCredentials` type is a reference-counted wrapper for native credentials.

The information in `GCredentials` 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. `g_socket_get_credentials()`.

Some operating systems supports securely sending and receiving credentials over a Unix Domain Socket, see `GUnixCredentialsMessage`, `g_unix_connection_send_credentials()` and `g_unix_connection_receive_credentials()` for details.

On Linux, the native credential type is a `struct ucred` - see the `unix(7)` man page for details. This corresponds to `G_CREDENTIALS_TYPE_LINUX_UCRED`.

On Apple operating systems (including iOS, tvOS, and macOS), the native credential type is a `struct xucred`. This corresponds to `G_CREDENTIALS_TYPE_APPLE_XUCRED`.

On FreeBSD, Debian GNU/kFreeBSD, and GNU/Hurd, the native credential type is a `struct cmsgcred`. This corresponds to `G_CREDENTIALS_TYPE_FREEBSD_CMSGCRED`.

On NetBSD, the native credential type is a `struct unpcbid`. This corresponds to `G_CREDENTIALS_TYPE_NETBSD_UNPCBID`.

On OpenBSD, the native credential type is a `struct sockpeercred`. This corresponds to `G_CREDENTIALS_TYPE_OPENBSD_SOCKPEERCRED`.

On Solaris (including OpenSolaris and its derivatives), the native credential type is a `ucred_t`. This corresponds to `G_CREDENTIALS_TYPE_SOLARIS_UCRED`.

Since GLib 2.72, on Windows, the native credentials may contain the PID of a process. This corresponds to `G_CREDENTIALS_TYPE_WIN32_PID`.

Available since: 2.26

#### Ancestors

- GObject

#### Constructors

###### g_credentials_new

Creates a new `GCredentials` object with credentials matching the the current process.

since: 2.26

#### Instance methods

###### g_credentials_get_native

Gets a pointer to native credentials of type `native_type` from `credentials`.

since: 2.26

###### g_credentials_get_unix_pid

Tries to get the UNIX process identifier from `credentials`. This method is only available on UNIX platforms.

since: 2.36

###### g_credentials_get_unix_user

Tries to get the UNIX user identifier from `credentials`. This method is only available on UNIX platforms.

since: 2.26

###### g_credentials_is_same_user

Checks if `credentials` and `other_credentials` is the same user.

since: 2.26

###### g_credentials_set_native

Copies the native credentials of type `native_type` from `native` into `credentials`.

since: 2.26

###### g_credentials_set_unix_user

Tries to set the UNIX user identifier on `credentials`. This method is only available on UNIX platforms.

since: 2.26

###### g_credentials_to_string

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.

since: 2.26

##### Methods inherited from GObject (43)

Please see GObject for a full list of methods.

#### Signals

##### Signals inherited from GObject (1)

###### GObject::notify

The notify signal is emitted on an object when one of its properties has its value set through g_object_set_property(), g_object_set(), et al.

since: 2.0

#### Class structure

    struct GioCredentialsClass {
      /* no available fields */
    }

Class structure for `GCredentials`.