Credentials

open class Credentials(pointer: <Error class: unknown class><<Error class: unknown class>>)

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. method@Gio.Socket.get_credentials.

Some operating systems supports securely sending and receiving credentials over a Unix Domain Socket, see class@Gio.UnixCredentialsMessage, method@Gio.UnixConnection.send_credentials and method@Gio.UnixConnection.receive_credentials for details.

On Linux, the native credential type is a struct ucred - see the man:unix(7) 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.

Skipped during bindings generation

  • method get_unix_pid: Return type pid_t is unsupported

  • method get_unix_user: Return type uid_t is unsupported

  • parameter uid: uid_t

Since

2.26

Constructors

Link copied to clipboard
constructor()

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

constructor(pointer: <Error class: unknown class><<Error class: unknown class>>)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
val gioCredentialsPointer: <Error class: unknown class><<Error class: unknown class>>

Functions

Link copied to clipboard
open fun getNative(nativeType: CredentialsType): <Error class: unknown class>?

Gets a pointer to native credentials of type @native_type from

Link copied to clipboard
open fun isSameUser(otherCredentials: Credentials): <Error class: unknown class><Boolean>

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

Link copied to clipboard
open fun setNative(nativeType: CredentialsType, native: <Error class: unknown class>)

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

Link copied to clipboard
open override fun toString(): 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.