Copyright | Will Thompson, Iñaki García Etxebarria and Jonas Platte |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria (garetxe@gmail.com) |
Safe Haskell | None |
Language | Haskell2010 |
The Credentials
type 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.
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
CredentialsTypeLinuxUcred
.
On FreeBSD, Debian GNU/kFreeBSD, and GNU/Hurd, the native
credential type is a struct cmsgcred. This corresponds
to CredentialsTypeFreebsdCmsgcred
.
On NetBSD, the native credential type is a struct unpcbid.
This corresponds to CredentialsTypeNetbsdUnpcbid
.
On OpenBSD, the native credential type is a struct sockpeercred.
This corresponds to CredentialsTypeOpenbsdSockpeercred
.
On Solaris (including OpenSolaris and its derivatives), the native
credential type is a ucred_t. This corresponds to
CredentialsTypeSolarisUcred
.
- newtype Credentials = Credentials (ManagedPtr Credentials)
- class GObject o => IsCredentials o
- toCredentials :: IsCredentials o => o -> IO Credentials
- noCredentials :: Maybe Credentials
- data CredentialsGetUnixPidMethodInfo
- credentialsGetUnixPid :: (HasCallStack, MonadIO m, IsCredentials a) => a -> m Int32
- data CredentialsGetUnixUserMethodInfo
- credentialsGetUnixUser :: (HasCallStack, MonadIO m, IsCredentials a) => a -> m Word32
- data CredentialsIsSameUserMethodInfo
- credentialsIsSameUser :: (HasCallStack, MonadIO m, IsCredentials a, IsCredentials b) => a -> b -> m ()
- credentialsNew :: (HasCallStack, MonadIO m) => m Credentials
- data CredentialsSetNativeMethodInfo
- credentialsSetNative :: (HasCallStack, MonadIO m, IsCredentials a) => a -> CredentialsType -> Ptr () -> m ()
- data CredentialsSetUnixUserMethodInfo
- credentialsSetUnixUser :: (HasCallStack, MonadIO m, IsCredentials a) => a -> Word32 -> m ()
- data CredentialsToStringMethodInfo
- credentialsToString :: (HasCallStack, MonadIO m, IsCredentials a) => a -> m Text
Exported types
newtype Credentials Source #
GObject Credentials Source # | |
IsObject Credentials Source # | |
IsCredentials Credentials Source # | |
((~) * info (ResolveCredentialsMethod t Credentials), MethodInfo * info Credentials p) => IsLabel t (Credentials -> p) Source # | |
((~) * info (ResolveCredentialsMethod t Credentials), MethodInfo * info Credentials p) => IsLabelProxy t (Credentials -> p) Source # | |
HasAttributeList * Credentials Source # | |
type AttributeList Credentials Source # | |
type SignalList Credentials Source # | |
class GObject o => IsCredentials o Source #
toCredentials :: IsCredentials o => o -> IO Credentials Source #
Methods
getUnixPid
data CredentialsGetUnixPidMethodInfo Source #
((~) * signature (m Int32), MonadIO m, IsCredentials a) => MethodInfo * CredentialsGetUnixPidMethodInfo a signature Source # | |
credentialsGetUnixPid Source #
:: (HasCallStack, MonadIO m, IsCredentials a) | |
=> a |
|
-> m Int32 | Returns: The UNIX process ID, or -1 if |
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
data CredentialsGetUnixUserMethodInfo Source #
((~) * signature (m Word32), MonadIO m, IsCredentials a) => MethodInfo * CredentialsGetUnixUserMethodInfo a signature Source # | |
credentialsGetUnixUser Source #
:: (HasCallStack, MonadIO m, IsCredentials a) | |
=> a |
|
-> m Word32 | Returns: The UNIX user identifier or -1 if |
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
data CredentialsIsSameUserMethodInfo Source #
((~) * signature (b -> m ()), MonadIO m, IsCredentials a, IsCredentials b) => MethodInfo * CredentialsIsSameUserMethodInfo a signature Source # | |
credentialsIsSameUser Source #
:: (HasCallStack, MonadIO m, IsCredentials a, IsCredentials b) | |
=> a |
|
-> b |
|
-> m () | (Can throw |
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
:: (HasCallStack, MonadIO m) | |
=> m Credentials | Returns: A |
Creates a new Credentials
object with credentials matching the
the current process.
Since: 2.26
setNative
data CredentialsSetNativeMethodInfo Source #
((~) * signature (CredentialsType -> Ptr () -> m ()), MonadIO m, IsCredentials a) => MethodInfo * CredentialsSetNativeMethodInfo a signature Source # | |
:: (HasCallStack, MonadIO m, IsCredentials a) | |
=> a |
|
-> CredentialsType |
|
-> Ptr () |
|
-> m () |
Copies the native credentials of type nativeType
from native
into credentials
.
It is a programming error (which will cause an 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
data CredentialsSetUnixUserMethodInfo Source #
((~) * signature (Word32 -> m ()), MonadIO m, IsCredentials a) => MethodInfo * CredentialsSetUnixUserMethodInfo a signature Source # | |
credentialsSetUnixUser Source #
:: (HasCallStack, MonadIO m, IsCredentials a) | |
=> a |
|
-> Word32 |
|
-> m () | (Can throw |
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
data CredentialsToStringMethodInfo Source #
((~) * signature (m Text), MonadIO m, IsCredentials a) => MethodInfo * CredentialsToStringMethodInfo a signature Source # | |
:: (HasCallStack, MonadIO m, IsCredentials a) | |
=> a |
|
-> m Text | Returns: A string that should be freed with |
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