It derives from <GObject>.
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. socket:get-credentials.
Some operating systems supports securely sending and receiving
credentials over a Unix Domain Socket, see
<GUnixCredentialsMessage>,
unix-connection:send-credentials? and
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
linux-ucred.
On Apple operating systems (including iOS, tvOS, and macOS), the native
credential type is a struct xucred. This corresponds to
apple-xucred.
On FreeBSD, Debian GNU/kFreeBSD, and GNU/Hurd, the native credential
type is a struct cmsgcred. This corresponds to
freebsd-cmsgcred.
On NetBSD, the native credential type is a struct unpcbid. This
corresponds to netbsd-unpcbid.
On OpenBSD, the native credential type is a struct sockpeercred.
This corresponds to openbsd-sockpeercred.
On Solaris (including OpenSolaris and its derivatives), the native
credential type is a ucred_t. This corresponds to
solaris-ucred.
Since GLib 2.72, on Windows, the native credentials may contain the PID
of a process. This corresponds to
win32-pid.
Tries to get the UNIX process identifier from self. This method is only available on UNIX platforms.
This operation can fail if <GCredentials> is
not supported on the OS or if the native credentials type does not
contain information about the UNIX process ID.
Passed: a <GCredentials>.
Returned: a 32-bit integer.
The UNIX process ID, or -1 if error is set.
Tries to get the UNIX user identifier from self. This method is only available on UNIX platforms.
This operation can fail if <GCredentials> is
not supported on the OS or if the native credentials type does not
contain information about the UNIX user.
As the signedness of uid_t is not specified by POSIX, it is
recommended to check error for failure rather than trying to check
the return value, particularly in language bindings.
Passed: a <GCredentials>.
Returned: an unsigned 32-bit integer.
The UNIX user identifier or (uid_t) -1 if error is set.
Checks if self and other-credentials is the same user.
This operation can fail if <GCredentials> is
not supported on the the OS.
Passed: a <GCredentials>.
Passed: a <GCredentials>.
Returned: a boolean.
#t if self and other-credentials has the same user,
#f otherwise or if error is set.
Creates a new <GCredentials> object with
credentials matching the the current process.
Returned: a <GCredentials>.
A <GCredentials>. Free with object:unref.
Copies the native credentials of type native-type from native into self.
It is a programming error (which will cause a warning to be logged) to
use this method if there is no <GCredentials>
support for the OS or if native-type isn’t supported by the OS.
Passed: a <GCredentials>.
Passed: a <GCredentialsType>, or one of
its symbols.
The type of native credentials to set.
Passed: a foreign pointer, or a bytevector.
A pointer to native credentials.
Tries to set the UNIX user identifier on self. This method is only available on UNIX platforms.
This operation can fail if <GCredentials> is
not supported on the OS or if the native credentials type does not
contain information about the UNIX user. It can also fail if the OS
does not allow the use of "spoofed" credentials.
Passed: a <GCredentials>.
Passed: an unsigned 32-bit integer.
The UNIX user identifier to set.
Returned: a boolean.
#t if uid was set, #f if error is set.
Creates a human-readable textual representation of self that can be used in logging and debug messages. The format of the returned string may change in future GLib release.
Passed: a <GCredentials>.
A <GCredentials> object.
Returned: a string.
A string that should be freed with
byte-array:free.