gi-gio
CopyrightWill Thompson and Iñaki García Etxebarria
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria
Safe HaskellNone
LanguageHaskell2010

GI.Gio.Objects.Credentials

Description

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. socketGetCredentials.

Some operating systems supports securely sending and receiving credentials over a Unix Domain Socket, see UnixCredentialsMessage, unixConnectionSendCredentials and unixConnectionReceiveCredentials 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.

Since: 2.26

Synopsis

Exported types

newtype Credentials Source #

Memory-managed wrapper type.

Instances

Instances details
Eq Credentials Source # 
Instance details

Defined in GI.Gio.Objects.Credentials

GObject Credentials Source # 
Instance details

Defined in GI.Gio.Objects.Credentials

ManagedPtrNewtype Credentials Source # 
Instance details

Defined in GI.Gio.Objects.Credentials

TypedObject Credentials Source # 
Instance details

Defined in GI.Gio.Objects.Credentials

Methods

glibType :: IO GType #

HasParentTypes Credentials Source # 
Instance details

Defined in GI.Gio.Objects.Credentials

HasAttributeList Credentials Source # 
Instance details

Defined in GI.Gio.Objects.Credentials

(info ~ ResolveCredentialsMethod t Credentials, OverloadedMethod info Credentials p, HasField t Credentials p) => HasField (t :: Symbol) Credentials (p :: Type) Source # 
Instance details

Defined in GI.Gio.Objects.Credentials

Methods

getField :: Credentials -> p #

(info ~ ResolveCredentialsMethod t Credentials, OverloadedMethodInfo info Credentials) => IsLabel t (MethodProxy info Credentials) Source # 
Instance details

Defined in GI.Gio.Objects.Credentials

(info ~ ResolveCredentialsMethod t Credentials, OverloadedMethod info Credentials p) => IsLabel t (Credentials -> p) Source # 
Instance details

Defined in GI.Gio.Objects.Credentials

Methods

fromLabel :: Credentials -> p #

IsGValue (Maybe Credentials) Source #

Convert Credentials to and from GValue. See toGValue and fromGValue.

Instance details

Defined in GI.Gio.Objects.Credentials

type AttributeList Credentials Source # 
Instance details

Defined in GI.Gio.Objects.Credentials

type ParentTypes Credentials Source # 
Instance details

Defined in GI.Gio.Objects.Credentials

type SignalList Credentials Source # 
Instance details

Defined in GI.Gio.Objects.Credentials

class (GObject o, IsDescendantOf Credentials o) => IsCredentials o Source #

Type class for types which can be safely cast to Credentials, for instance with toCredentials.

Instances

Instances details
(GObject o, IsDescendantOf Credentials o) => IsCredentials o Source # 
Instance details

Defined in GI.Gio.Objects.Credentials

toCredentials :: (MonadIO m, IsCredentials o) => o -> m Credentials Source #

Cast to Credentials, for types for which this is known to be safe. For general casts, use castTo.

Methods

type family ResolveCredentialsMethod (t :: Symbol) o where ... Source #

Equations

ResolveCredentialsMethod "bindProperty" o = ObjectBindPropertyMethodInfo 
ResolveCredentialsMethod "bindPropertyFull" o = ObjectBindPropertyFullMethodInfo 
ResolveCredentialsMethod "forceFloating" o = ObjectForceFloatingMethodInfo 
ResolveCredentialsMethod "freezeNotify" o = ObjectFreezeNotifyMethodInfo 
ResolveCredentialsMethod "getv" o = ObjectGetvMethodInfo 
ResolveCredentialsMethod "isFloating" o = ObjectIsFloatingMethodInfo 
ResolveCredentialsMethod "isSameUser" o = CredentialsIsSameUserMethodInfo 
ResolveCredentialsMethod "notify" o = ObjectNotifyMethodInfo 
ResolveCredentialsMethod "notifyByPspec" o = ObjectNotifyByPspecMethodInfo 
ResolveCredentialsMethod "ref" o = ObjectRefMethodInfo 
ResolveCredentialsMethod "refSink" o = ObjectRefSinkMethodInfo 
ResolveCredentialsMethod "runDispose" o = ObjectRunDisposeMethodInfo 
ResolveCredentialsMethod "stealData" o = ObjectStealDataMethodInfo 
ResolveCredentialsMethod "stealQdata" o = ObjectStealQdataMethodInfo 
ResolveCredentialsMethod "thawNotify" o = ObjectThawNotifyMethodInfo 
ResolveCredentialsMethod "toString" o = CredentialsToStringMethodInfo 
ResolveCredentialsMethod "unref" o = ObjectUnrefMethodInfo 
ResolveCredentialsMethod "watchClosure" o = ObjectWatchClosureMethodInfo 
ResolveCredentialsMethod "getData" o = ObjectGetDataMethodInfo 
ResolveCredentialsMethod "getProperty" o = ObjectGetPropertyMethodInfo 
ResolveCredentialsMethod "getQdata" o = ObjectGetQdataMethodInfo 
ResolveCredentialsMethod "getUnixPid" o = CredentialsGetUnixPidMethodInfo 
ResolveCredentialsMethod "getUnixUser" o = CredentialsGetUnixUserMethodInfo 
ResolveCredentialsMethod "setData" o = ObjectSetDataMethodInfo 
ResolveCredentialsMethod "setDataFull" o = ObjectSetDataFullMethodInfo 
ResolveCredentialsMethod "setNative" o = CredentialsSetNativeMethodInfo 
ResolveCredentialsMethod "setProperty" o = ObjectSetPropertyMethodInfo 
ResolveCredentialsMethod "setUnixUser" o = CredentialsSetUnixUserMethodInfo 
ResolveCredentialsMethod l o = MethodResolutionFailed l o :: Type 

getUnixPid

credentialsGetUnixPid Source #

Arguments

:: (HasCallStack, MonadIO m, IsCredentials a) 
=> a

credentials: A Credentials

-> m Int32

Returns: The UNIX process ID, or -1 if error is set. (Can throw GError)

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

This operation can fail if Credentials is not supported on the OS or if the native credentials type does not contain information about the UNIX process ID.

Since: 2.36

getUnixUser

credentialsGetUnixUser Source #

Arguments

:: (HasCallStack, MonadIO m, IsCredentials a) 
=> a

credentials: A Credentials

-> m Word32

Returns: The UNIX user identifier or -1 if error is set. (Can throw GError)

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

This operation can fail if Credentials is not supported on the OS or if the native credentials type does not contain information about the UNIX user.

Since: 2.26

isSameUser

credentialsIsSameUser Source #

Arguments

:: (HasCallStack, MonadIO m, IsCredentials a, IsCredentials b) 
=> a

credentials: A Credentials.

-> b

otherCredentials: A Credentials.

-> m ()

(Can throw GError)

Checks if credentials and otherCredentials is the same user.

This operation can fail if Credentials is not supported on the the OS.

Since: 2.26

new

credentialsNew Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> m Credentials

Returns: A Credentials. Free with objectUnref.

Creates a new Credentials object with credentials matching the the current process.

Since: 2.26

setNative

data CredentialsSetNativeMethodInfo Source #

Instances

Instances details
(signature ~ (CredentialsType -> Ptr () -> m ()), MonadIO m, IsCredentials a) => OverloadedMethod CredentialsSetNativeMethodInfo a signature Source # 
Instance details

Defined in GI.Gio.Objects.Credentials

Methods

overloadedMethod :: a -> signature #

OverloadedMethodInfo CredentialsSetNativeMethodInfo (a :: Type) Source # 
Instance details

Defined in GI.Gio.Objects.Credentials

credentialsSetNative Source #

Arguments

:: (HasCallStack, MonadIO m, IsCredentials a) 
=> a

credentials: A Credentials.

-> CredentialsType

nativeType: The type of native credentials to set.

-> Ptr ()

native: A pointer to native credentials.

-> m () 

Copies the native credentials of type nativeType from native into credentials.

It is a programming error (which will cause a warning to be logged) to use this method if there is no Credentials support for the OS or if nativeType isn't supported by the OS.

Since: 2.26

setUnixUser

credentialsSetUnixUser Source #

Arguments

:: (HasCallStack, MonadIO m, IsCredentials a) 
=> a

credentials: A Credentials.

-> Word32

uid: The UNIX user identifier to set.

-> m ()

(Can throw GError)

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

This operation can fail if Credentials 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.

Since: 2.26

toString

credentialsToString Source #

Arguments

:: (HasCallStack, MonadIO m, IsCredentials a) 
=> a

credentials: A Credentials object.

-> m Text

Returns: A string that should be freed with free.

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