Gio.Credentials¶
| Subclasses: | None | 
|---|
Methods¶
| Inherited: | GObject.Object (37) | 
|---|---|
| Structs: | GObject.ObjectClass (5) | 
| class | new() | 
| get_unix_pid() | |
| get_unix_user() | |
| is_same_user(other_credentials) | |
| set_native(native_type, native) | |
| set_unix_user(uid) | |
| to_string() | 
Virtual Methods¶
| Inherited: | GObject.Object (7) | 
|---|
Properties¶
None
Signals¶
| Inherited: | GObject.Object (1) | 
|---|
Fields¶
| Inherited: | GObject.Object (1) | 
|---|
Class Details¶
- 
class Gio.Credentials(**kwargs)¶
- Bases: - GObject.Object- Abstract: - No - Structure: - Gio.CredentialsClass- The - Gio.Credentialstype is a reference-counted wrapper for native credentials. This information 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.get_credentials().- Some operating systems supports securely sending and receiving credentials over a Unix Domain Socket, see - Gio.UnixCredentialsMessage,- Gio.UnixConnection.send_credentials() and- Gio.UnixConnection.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- Gio.CredentialsType.LINUX_UCRED.- On Apple operating systems (including iOS, tvOS, and macOS), the native credential type is a - struct xucred. This corresponds to- Gio.CredentialsType.APPLE_XUCRED.- On FreeBSD, Debian GNU/kFreeBSD, and GNU/Hurd, the native credential type is a - struct cmsgcred. This corresponds to- Gio.CredentialsType.FREEBSD_CMSGCRED.- On NetBSD, the native credential type is a - struct unpcbid. This corresponds to- Gio.CredentialsType.NETBSD_UNPCBID.- On OpenBSD, the native credential type is a - struct sockpeercred. This corresponds to- Gio.CredentialsType.OPENBSD_SOCKPEERCRED.- On Solaris (including OpenSolaris and its derivatives), the native credential type is a - ucred_t. This corresponds to- Gio.CredentialsType.SOLARIS_UCRED.- New in version 2.26. - 
classmethod new()[source]¶
- Returns: - A - Gio.Credentials. Free with- GObject.Object.unref().- Return type: - Gio.Credentials- Creates a new - Gio.Credentialsobject with credentials matching the the current process.- New in version 2.26. 
 - 
get_unix_pid()[source]¶
- Raises: - GLib.Error- Returns: - The UNIX process ID, or -1 if error is set. - Return type: - int- Tries to get the UNIX process identifier from self. This method is only available on UNIX platforms. - This operation can fail if - Gio.Credentialsis not supported on the OS or if the native credentials type does not contain information about the UNIX process ID (for example this is the case for- Gio.CredentialsType.APPLE_XUCRED).- New in version 2.36. 
 - 
get_unix_user()[source]¶
- Raises: - GLib.Error- Returns: - The UNIX user identifier or -1 if error is set. - Return type: - int- Tries to get the UNIX user identifier from self. This method is only available on UNIX platforms. - This operation can fail if - Gio.Credentialsis not supported on the OS or if the native credentials type does not contain information about the UNIX user.- New in version 2.26. 
 - 
is_same_user(other_credentials)[source]¶
- Parameters: - other_credentials ( - Gio.Credentials) – A- Gio.Credentials.- Raises: - GLib.Error- Returns: - Trueif self and other_credentials has the same user,- Falseotherwise or if error is set.- Return type: - bool- Checks if self and other_credentials is the same user. - This operation can fail if - Gio.Credentialsis not supported on the the OS.- New in version 2.26. 
 - 
set_native(native_type, native)[source]¶
- Parameters: - native_type (Gio.CredentialsType) – The type of native credentials to set.
- native (object) – A pointer to native credentials.
 - 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 - Gio.Credentialssupport for the OS or if native_type isn’t supported by the OS.- New in version 2.26. 
- native_type (
 - 
set_unix_user(uid)[source]¶
- Parameters: - uid ( - int) – The UNIX user identifier to set.- Raises: - GLib.Error- Returns: - Trueif uid was set,- Falseif error is set.- Return type: - bool- Tries to set the UNIX user identifier on self. This method is only available on UNIX platforms. - This operation can fail if - Gio.Credentialsis 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.- New in version 2.26. 
 
- 
classmethod