| Copyright | Will Thompson Iñaki García Etxebarria and Jonas Platte |
|---|---|
| License | LGPL-2.1 |
| Maintainer | Iñaki García Etxebarria |
| Safe Haskell | None |
| Language | Haskell2010 |
GI.Gio.Objects.DBusAuthObserver
Description
The DBusAuthObserver type provides a mechanism for participating
in how a DBusServer (or a DBusConnection) authenticates remote
peers. Simply instantiate a DBusAuthObserver and connect to the
signals you are interested in. Note that new signals may be added
in the future
For example, if you only want to allow D-Bus connections from processes owned by the same uid as the server, you would use a signal handler like the following:
C code
static gboolean
on_authorize_authenticated_peer (GDBusAuthObserver *observer,
GIOStream *stream,
GCredentials *credentials,
gpointer user_data)
{
gboolean authorized;
authorized = FALSE;
if (credentials != NULL)
{
GCredentials *own_credentials;
own_credentials = g_credentials_new ();
if (g_credentials_is_same_user (credentials, own_credentials, NULL))
authorized = TRUE;
g_object_unref (own_credentials);
}
return authorized;
}Since: 2.26
Synopsis
- newtype DBusAuthObserver = DBusAuthObserver (ManagedPtr DBusAuthObserver)
- class (GObject o, IsDescendantOf DBusAuthObserver o) => IsDBusAuthObserver o
- toDBusAuthObserver :: (MonadIO m, IsDBusAuthObserver o) => o -> m DBusAuthObserver
- noDBusAuthObserver :: Maybe DBusAuthObserver
- dBusAuthObserverAllowMechanism :: (HasCallStack, MonadIO m, IsDBusAuthObserver a) => a -> Text -> m Bool
- dBusAuthObserverAuthorizeAuthenticatedPeer :: (HasCallStack, MonadIO m, IsDBusAuthObserver a, IsIOStream b, IsCredentials c) => a -> b -> Maybe c -> m Bool
- dBusAuthObserverNew :: (HasCallStack, MonadIO m) => m DBusAuthObserver
- type C_DBusAuthObserverAllowMechanismCallback = Ptr () -> CString -> Ptr () -> IO CInt
- type DBusAuthObserverAllowMechanismCallback = Text -> IO Bool
- afterDBusAuthObserverAllowMechanism :: (IsDBusAuthObserver a, MonadIO m) => a -> DBusAuthObserverAllowMechanismCallback -> m SignalHandlerId
- genClosure_DBusAuthObserverAllowMechanism :: MonadIO m => DBusAuthObserverAllowMechanismCallback -> m (GClosure C_DBusAuthObserverAllowMechanismCallback)
- mk_DBusAuthObserverAllowMechanismCallback :: C_DBusAuthObserverAllowMechanismCallback -> IO (FunPtr C_DBusAuthObserverAllowMechanismCallback)
- noDBusAuthObserverAllowMechanismCallback :: Maybe DBusAuthObserverAllowMechanismCallback
- onDBusAuthObserverAllowMechanism :: (IsDBusAuthObserver a, MonadIO m) => a -> DBusAuthObserverAllowMechanismCallback -> m SignalHandlerId
- wrap_DBusAuthObserverAllowMechanismCallback :: DBusAuthObserverAllowMechanismCallback -> C_DBusAuthObserverAllowMechanismCallback
- type C_DBusAuthObserverAuthorizeAuthenticatedPeerCallback = Ptr () -> Ptr IOStream -> Ptr Credentials -> Ptr () -> IO CInt
- type DBusAuthObserverAuthorizeAuthenticatedPeerCallback = IOStream -> Maybe Credentials -> IO Bool
- afterDBusAuthObserverAuthorizeAuthenticatedPeer :: (IsDBusAuthObserver a, MonadIO m) => a -> DBusAuthObserverAuthorizeAuthenticatedPeerCallback -> m SignalHandlerId
- genClosure_DBusAuthObserverAuthorizeAuthenticatedPeer :: MonadIO m => DBusAuthObserverAuthorizeAuthenticatedPeerCallback -> m (GClosure C_DBusAuthObserverAuthorizeAuthenticatedPeerCallback)
- mk_DBusAuthObserverAuthorizeAuthenticatedPeerCallback :: C_DBusAuthObserverAuthorizeAuthenticatedPeerCallback -> IO (FunPtr C_DBusAuthObserverAuthorizeAuthenticatedPeerCallback)
- noDBusAuthObserverAuthorizeAuthenticatedPeerCallback :: Maybe DBusAuthObserverAuthorizeAuthenticatedPeerCallback
- onDBusAuthObserverAuthorizeAuthenticatedPeer :: (IsDBusAuthObserver a, MonadIO m) => a -> DBusAuthObserverAuthorizeAuthenticatedPeerCallback -> m SignalHandlerId
- wrap_DBusAuthObserverAuthorizeAuthenticatedPeerCallback :: DBusAuthObserverAuthorizeAuthenticatedPeerCallback -> C_DBusAuthObserverAuthorizeAuthenticatedPeerCallback
Exported types
newtype DBusAuthObserver Source #
Memory-managed wrapper type.
Constructors
| DBusAuthObserver (ManagedPtr DBusAuthObserver) |
Instances
| Eq DBusAuthObserver Source # | |
Defined in GI.Gio.Objects.DBusAuthObserver Methods (==) :: DBusAuthObserver -> DBusAuthObserver -> Bool # (/=) :: DBusAuthObserver -> DBusAuthObserver -> Bool # | |
| GObject DBusAuthObserver Source # | |
Defined in GI.Gio.Objects.DBusAuthObserver Methods gobjectType :: IO GType # | |
| IsGValue DBusAuthObserver Source # | Convert |
Defined in GI.Gio.Objects.DBusAuthObserver | |
| HasParentTypes DBusAuthObserver Source # | |
Defined in GI.Gio.Objects.DBusAuthObserver | |
| type ParentTypes DBusAuthObserver Source # | |
Defined in GI.Gio.Objects.DBusAuthObserver | |
class (GObject o, IsDescendantOf DBusAuthObserver o) => IsDBusAuthObserver o Source #
Type class for types which can be safely cast to DBusAuthObserver, for instance with toDBusAuthObserver.
Instances
| (GObject o, IsDescendantOf DBusAuthObserver o) => IsDBusAuthObserver o Source # | |
Defined in GI.Gio.Objects.DBusAuthObserver | |
toDBusAuthObserver :: (MonadIO m, IsDBusAuthObserver o) => o -> m DBusAuthObserver Source #
Cast to DBusAuthObserver, for types for which this is known to be safe. For general casts, use castTo.
noDBusAuthObserver :: Maybe DBusAuthObserver Source #
A convenience alias for Nothing :: Maybe DBusAuthObserver.
Methods
Overloaded methods
allowMechanism
dBusAuthObserverAllowMechanism Source #
Arguments
| :: (HasCallStack, MonadIO m, IsDBusAuthObserver a) | |
| => a |
|
| -> Text |
|
| -> m Bool | Returns: |
Emits the allowMechanism signal on observer.
Since: 2.34
authorizeAuthenticatedPeer
dBusAuthObserverAuthorizeAuthenticatedPeer Source #
Arguments
| :: (HasCallStack, MonadIO m, IsDBusAuthObserver a, IsIOStream b, IsCredentials c) | |
| => a |
|
| -> b |
|
| -> Maybe c |
|
| -> m Bool |
Emits the authorizeAuthenticatedPeer signal on observer.
Since: 2.26
new
Arguments
| :: (HasCallStack, MonadIO m) | |
| => m DBusAuthObserver | Returns: A |
Creates a new DBusAuthObserver object.
Since: 2.26
Signals
allowMechanism
type C_DBusAuthObserverAllowMechanismCallback = Ptr () -> CString -> Ptr () -> IO CInt Source #
Type for the callback on the (unwrapped) C side.
type DBusAuthObserverAllowMechanismCallback Source #
Arguments
| = Text |
|
| -> IO Bool | Returns: |
Emitted to check if mechanism is allowed to be used.
Since: 2.34
afterDBusAuthObserverAllowMechanism :: (IsDBusAuthObserver a, MonadIO m) => a -> DBusAuthObserverAllowMechanismCallback -> m SignalHandlerId Source #
Connect a signal handler for the allowMechanism signal, to be run after the default handler. When overloading is enabled, this is equivalent to
after dBusAuthObserver #allowMechanism callback
genClosure_DBusAuthObserverAllowMechanism :: MonadIO m => DBusAuthObserverAllowMechanismCallback -> m (GClosure C_DBusAuthObserverAllowMechanismCallback) Source #
Wrap the callback into a GClosure.
mk_DBusAuthObserverAllowMechanismCallback :: C_DBusAuthObserverAllowMechanismCallback -> IO (FunPtr C_DBusAuthObserverAllowMechanismCallback) Source #
Generate a function pointer callable from C code, from a C_DBusAuthObserverAllowMechanismCallback.
noDBusAuthObserverAllowMechanismCallback :: Maybe DBusAuthObserverAllowMechanismCallback Source #
A convenience synonym for .Nothing :: Maybe DBusAuthObserverAllowMechanismCallback
onDBusAuthObserverAllowMechanism :: (IsDBusAuthObserver a, MonadIO m) => a -> DBusAuthObserverAllowMechanismCallback -> m SignalHandlerId Source #
Connect a signal handler for the allowMechanism signal, to be run before the default handler. When overloading is enabled, this is equivalent to
on dBusAuthObserver #allowMechanism callback
wrap_DBusAuthObserverAllowMechanismCallback :: DBusAuthObserverAllowMechanismCallback -> C_DBusAuthObserverAllowMechanismCallback Source #
authorizeAuthenticatedPeer
type C_DBusAuthObserverAuthorizeAuthenticatedPeerCallback = Ptr () -> Ptr IOStream -> Ptr Credentials -> Ptr () -> IO CInt Source #
Type for the callback on the (unwrapped) C side.
type DBusAuthObserverAuthorizeAuthenticatedPeerCallback Source #
Arguments
| = IOStream |
|
| -> Maybe Credentials |
|
| -> IO Bool |
Emitted to check if a peer that is successfully authenticated is authorized.
Since: 2.26
afterDBusAuthObserverAuthorizeAuthenticatedPeer :: (IsDBusAuthObserver a, MonadIO m) => a -> DBusAuthObserverAuthorizeAuthenticatedPeerCallback -> m SignalHandlerId Source #
Connect a signal handler for the authorizeAuthenticatedPeer signal, to be run after the default handler. When overloading is enabled, this is equivalent to
after dBusAuthObserver #authorizeAuthenticatedPeer callback
genClosure_DBusAuthObserverAuthorizeAuthenticatedPeer :: MonadIO m => DBusAuthObserverAuthorizeAuthenticatedPeerCallback -> m (GClosure C_DBusAuthObserverAuthorizeAuthenticatedPeerCallback) Source #
Wrap the callback into a GClosure.
mk_DBusAuthObserverAuthorizeAuthenticatedPeerCallback :: C_DBusAuthObserverAuthorizeAuthenticatedPeerCallback -> IO (FunPtr C_DBusAuthObserverAuthorizeAuthenticatedPeerCallback) Source #
Generate a function pointer callable from C code, from a C_DBusAuthObserverAuthorizeAuthenticatedPeerCallback.
noDBusAuthObserverAuthorizeAuthenticatedPeerCallback :: Maybe DBusAuthObserverAuthorizeAuthenticatedPeerCallback Source #
A convenience synonym for .Nothing :: Maybe DBusAuthObserverAuthorizeAuthenticatedPeerCallback
onDBusAuthObserverAuthorizeAuthenticatedPeer :: (IsDBusAuthObserver a, MonadIO m) => a -> DBusAuthObserverAuthorizeAuthenticatedPeerCallback -> m SignalHandlerId Source #
Connect a signal handler for the authorizeAuthenticatedPeer signal, to be run before the default handler. When overloading is enabled, this is equivalent to
on dBusAuthObserver #authorizeAuthenticatedPeer callback