gi-gio-2.0.35: Gio bindings

Copyright | Will Thompson and Iñaki García Etxebarria
License | LGPL-2.1
Maintainer | Iñaki García Etxebarria
Safe Haskell | Safe-Inferred
Language | Haskell2010

GI.Gio.Objects.TlsInteraction

Contents

- Exported types
- Methods
  - askPassword
  - askPasswordAsync
  - askPasswordFinish
  - invokeAskPassword
  - invokeRequestCertificate
  - requestCertificate
  - requestCertificateAsync
  - requestCertificateFinish

Description

`GTlsInteraction` provides a mechanism for the TLS connection and database code to interact with the user. It can be used to ask the user for passwords.

To use a `GTlsInteraction` with a TLS connection use `tlsConnectionSetInteraction`.

Callers should instantiate a derived class that implements the various interaction methods to show the required dialogs.

Callers should use the 'invoke' functions like `tlsInteractionInvokeAskPassword` to run interaction methods. These functions make sure that the interaction is invoked in the main loop and not in the current thread, if the current thread is not running the main loop.

Derived classes can choose to implement whichever interactions methods they’d like to support by overriding those virtual methods in their class initialization function. Any interactions not implemented will return `G_TLS_INTERACTION_UNHANDLED`. If a derived class implements an async method, it must also implement the corresponding finish method.

Since: 2.30

Synopsis

- newtype TlsInteraction = TlsInteraction (ManagedPtr TlsInteraction)
- class (GObject o, IsDescendantOf TlsInteraction o) => IsTlsInteraction o
- toTlsInteraction :: (MonadIO m, IsTlsInteraction o) => o -> m TlsInteraction
- tlsInteractionAskPassword :: (HasCallStack, MonadIO m, IsTlsInteraction a, IsTlsPassword b, IsCancellable c) => a -> b -> Maybe c -> m TlsInteractionResult
- tlsInteractionAskPasswordAsync :: (HasCallStack, MonadIO m, IsTlsInteraction a, IsTlsPassword b, IsCancellable c) => a -> b -> Maybe c -> Maybe AsyncReadyCallback -> m ()
- tlsInteractionAskPasswordFinish :: (HasCallStack, MonadIO m, IsTlsInteraction a, IsAsyncResult b) => a -> b -> m TlsInteractionResult
- tlsInteractionInvokeAskPassword :: (HasCallStack, MonadIO m, IsTlsInteraction a, IsTlsPassword b, IsCancellable c) => a -> b -> Maybe c -> m TlsInteractionResult
- tlsInteractionInvokeRequestCertificate :: (HasCallStack, MonadIO m, IsTlsInteraction a, IsTlsConnection b, IsCancellable c) => a -> b -> TlsCertificateRequestFlags -> Maybe c -> m TlsInteractionResult
- tlsInteractionRequestCertificate :: (HasCallStack, MonadIO m, IsTlsInteraction a, IsTlsConnection b, IsCancellable c) => a -> b -> TlsCertificateRequestFlags -> Maybe c -> m TlsInteractionResult
- tlsInteractionRequestCertificateAsync :: (HasCallStack, MonadIO m, IsTlsInteraction a, IsTlsConnection b, IsCancellable c) => a -> b -> TlsCertificateRequestFlags -> Maybe c -> Maybe AsyncReadyCallback -> m ()
- tlsInteractionRequestCertificateFinish :: (HasCallStack, MonadIO m, IsTlsInteraction a, IsAsyncResult b) => a -> b -> m TlsInteractionResult

# Exported types

newtype TlsInteraction Source #

Memory-managed wrapper type.

Constructors

TlsInteraction (ManagedPtr TlsInteraction) |

#### Instances

Instances details

Eq TlsInteraction Source # |
Instance details Defined in GI.Gio.Objects.TlsInteraction Methods (==) :: TlsInteraction -> TlsInteraction -> Bool Source # (/=) :: TlsInteraction -> TlsInteraction -> Bool Source #
GObject TlsInteraction Source # |
Instance details Defined in GI.Gio.Objects.TlsInteraction
ManagedPtrNewtype TlsInteraction Source # |
Instance details Defined in GI.Gio.Objects.TlsInteraction Methods toManagedPtr :: TlsInteraction -> ManagedPtr TlsInteraction Source #
TypedObject TlsInteraction Source # |
Instance details Defined in GI.Gio.Objects.TlsInteraction Methods glibType :: IO GType Source #
HasParentTypes TlsInteraction Source # |
Instance details Defined in GI.Gio.Objects.TlsInteraction
IsGValue (Maybe TlsInteraction) Source # | Convert `TlsInteraction` to and from `GValue`. See `toGValue` and `fromGValue`.
Instance details Defined in GI.Gio.Objects.TlsInteraction Methods gvalueGType_ :: IO GType Source # gvalueSet_ :: Ptr GValue -> Maybe TlsInteraction -> IO () Source # gvalueGet_ :: Ptr GValue -> IO (Maybe TlsInteraction) Source #
type ParentTypes TlsInteraction Source # |
Instance details Defined in GI.Gio.Objects.TlsInteraction type ParentTypes TlsInteraction = '[Object]

class (GObject o, IsDescendantOf TlsInteraction o) => IsTlsInteraction o Source #

Type class for types which can be safely cast to `TlsInteraction`, for instance with `toTlsInteraction`.

#### Instances

Instances details

(GObject o, IsDescendantOf TlsInteraction o) => IsTlsInteraction o Source # |
Instance details Defined in GI.Gio.Objects.TlsInteraction

toTlsInteraction :: (MonadIO m, IsTlsInteraction o) => o -> m TlsInteraction Source #

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

# Methods

### Click to display all available methods, including inherited ones

Expand

#### Methods

askPassword, askPasswordAsync, askPasswordFinish, bindProperty, bindPropertyFull, forceFloating, freezeNotify, getv, invokeAskPassword, invokeRequestCertificate, isFloating, notify, notifyByPspec, ref, refSink, requestCertificate, requestCertificateAsync, requestCertificateFinish, runDispose, stealData, stealQdata, thawNotify, unref, watchClosure.

#### Getters

getData, getProperty, getQdata.

#### Setters

setData, setDataFull, setProperty.

## askPassword

tlsInteractionAskPassword Source #

Arguments

:: (HasCallStack, MonadIO m, IsTlsInteraction a, IsTlsPassword b, IsCancellable c) |
=> a | `interaction`: a `TlsInteraction` object
-> b | `password`: a `TlsPassword` object
-> Maybe c | `cancellable`: an optional `Cancellable` cancellation object
-> m TlsInteractionResult | Returns: The status of the ask password interaction. (Can throw `GError`)

Run synchronous interaction to ask the user for a password. In general, `tlsInteractionInvokeAskPassword` should be used instead of this function.

Derived subclasses usually implement a password prompt, although they may also choose to provide a password from elsewhere. The `password` value will be filled in and then `callback` will be called. Alternatively the user may abort this password request, which will usually abort the TLS connection.

If the interaction is cancelled by the cancellation object, or by the user then `TlsInteractionResultFailed` will be returned with an error that contains a `IOErrorEnumCancelled` error code. Certain implementations may not support immediate cancellation.

Since: 2.30

## askPasswordAsync

tlsInteractionAskPasswordAsync Source #

Arguments

:: (HasCallStack, MonadIO m, IsTlsInteraction a, IsTlsPassword b, IsCancellable c) |
=> a | `interaction`: a `TlsInteraction` object
-> b | `password`: a `TlsPassword` object
-> Maybe c | `cancellable`: an optional `Cancellable` cancellation object
-> Maybe AsyncReadyCallback | `callback`: will be called when the interaction completes
-> m () |

Run asynchronous interaction to ask the user for a password. In general, `tlsInteractionInvokeAskPassword` should be used instead of this function.

Derived subclasses usually implement a password prompt, although they may also choose to provide a password from elsewhere. The `password` value will be filled in and then `callback` will be called. Alternatively the user may abort this password request, which will usually abort the TLS connection.

If the interaction is cancelled by the cancellation object, or by the user then `TlsInteractionResultFailed` will be returned with an error that contains a `IOErrorEnumCancelled` error code. Certain implementations may not support immediate cancellation.

Certain implementations may not support immediate cancellation.

Since: 2.30

## askPasswordFinish

tlsInteractionAskPasswordFinish Source #

Arguments

:: (HasCallStack, MonadIO m, IsTlsInteraction a, IsAsyncResult b) |
=> a | `interaction`: a `TlsInteraction` object
-> b | `result`: the result passed to the callback
-> m TlsInteractionResult | Returns: The status of the ask password interaction. (Can throw `GError`)

Complete an ask password user interaction request. This should be once the `tlsInteractionAskPasswordAsync` completion callback is called.

If `TlsInteractionResultHandled` is returned, then the `TlsPassword` passed to `tlsInteractionAskPassword` will have its password filled in.

If the interaction is cancelled by the cancellation object, or by the user then `TlsInteractionResultFailed` will be returned with an error that contains a `IOErrorEnumCancelled` error code.

Since: 2.30

## invokeAskPassword

tlsInteractionInvokeAskPassword Source #

Arguments

:: (HasCallStack, MonadIO m, IsTlsInteraction a, IsTlsPassword b, IsCancellable c) |
=> a | `interaction`: a `TlsInteraction` object
-> b | `password`: a `TlsPassword` object
-> Maybe c | `cancellable`: an optional `Cancellable` cancellation object
-> m TlsInteractionResult | Returns: The status of the ask password interaction. (Can throw `GError`)

Invoke the interaction to ask the user for a password. It invokes this interaction in the main loop, specifically the `MainContext` returned by `mainContextGetThreadDefault` when the interaction is created. This is called by called by `TlsConnection` or `TlsDatabase` to ask the user for a password.

Derived subclasses usually implement a password prompt, although they may also choose to provide a password from elsewhere. The `password` value will be filled in and then `callback` will be called. Alternatively the user may abort this password request, which will usually abort the TLS connection.

The implementation can either be a synchronous (eg: modal dialog) or an asynchronous one (eg: modeless dialog). This function will take care of calling which ever one correctly.

If the interaction is cancelled by the cancellation object, or by the user then `TlsInteractionResultFailed` will be returned with an error that contains a `IOErrorEnumCancelled` error code. Certain implementations may not support immediate cancellation.

Since: 2.30

## invokeRequestCertificate

tlsInteractionInvokeRequestCertificate Source #

Arguments

:: (HasCallStack, MonadIO m, IsTlsInteraction a, IsTlsConnection b, IsCancellable c) |
=> a | `interaction`: a `TlsInteraction` object
-> b | `connection`: a `TlsConnection` object
-> TlsCertificateRequestFlags | `flags`: flags providing more information about the request
-> Maybe c | `cancellable`: an optional `Cancellable` cancellation object
-> m TlsInteractionResult | Returns: The status of the certificate request interaction. (Can throw `GError`)

Invoke the interaction to ask the user to choose a certificate to use with the connection. It invokes this interaction in the main loop, specifically the `MainContext` returned by `mainContextGetThreadDefault` when the interaction is created. This is called by called by `TlsConnection` when the peer requests a certificate during the handshake.

Derived subclasses usually implement a certificate selector, although they may also choose to provide a certificate from elsewhere. Alternatively the user may abort this certificate request, which may or may not abort the TLS connection.

The implementation can either be a synchronous (eg: modal dialog) or an asynchronous one (eg: modeless dialog). This function will take care of calling which ever one correctly.

If the interaction is cancelled by the cancellation object, or by the user then `TlsInteractionResultFailed` will be returned with an error that contains a `IOErrorEnumCancelled` error code. Certain implementations may not support immediate cancellation.

Since: 2.40

## requestCertificate

tlsInteractionRequestCertificate Source #

Arguments

:: (HasCallStack, MonadIO m, IsTlsInteraction a, IsTlsConnection b, IsCancellable c) |
=> a | `interaction`: a `TlsInteraction` object
-> b | `connection`: a `TlsConnection` object
-> TlsCertificateRequestFlags | `flags`: flags providing more information about the request
-> Maybe c | `cancellable`: an optional `Cancellable` cancellation object
-> m TlsInteractionResult | Returns: The status of the request certificate interaction. (Can throw `GError`)

Run synchronous interaction to ask the user to choose a certificate to use with the connection. In general, `tlsInteractionInvokeRequestCertificate` should be used instead of this function.

Derived subclasses usually implement a certificate selector, although they may also choose to provide a certificate from elsewhere. Alternatively the user may abort this certificate request, which will usually abort the TLS connection.

If `TlsInteractionResultHandled` is returned, then the `TlsConnection` passed to `tlsInteractionRequestCertificate` will have had its TlsConnection:certificate filled in.

If the interaction is cancelled by the cancellation object, or by the user then `TlsInteractionResultFailed` will be returned with an error that contains a `IOErrorEnumCancelled` error code. Certain implementations may not support immediate cancellation.

Since: 2.40

## requestCertificateAsync

tlsInteractionRequestCertificateAsync Source #

Arguments

:: (HasCallStack, MonadIO m, IsTlsInteraction a, IsTlsConnection b, IsCancellable c) |
=> a | `interaction`: a `TlsInteraction` object
-> b | `connection`: a `TlsConnection` object
-> TlsCertificateRequestFlags | `flags`: flags providing more information about the request
-> Maybe c | `cancellable`: an optional `Cancellable` cancellation object
-> Maybe AsyncReadyCallback | `callback`: will be called when the interaction completes
-> m () |

Run asynchronous interaction to ask the user for a certificate to use with the connection. In general, `tlsInteractionInvokeRequestCertificate` should be used instead of this function.

Derived subclasses usually implement a certificate selector, although they may also choose to provide a certificate from elsewhere. `callback` will be called when the operation completes. Alternatively the user may abort this certificate request, which will usually abort the TLS connection.

Since: 2.40

## requestCertificateFinish

tlsInteractionRequestCertificateFinish Source #

Arguments

:: (HasCallStack, MonadIO m, IsTlsInteraction a, IsAsyncResult b) |
=> a | `interaction`: a `TlsInteraction` object
-> b | `result`: the result passed to the callback
-> m TlsInteractionResult | Returns: The status of the request certificate interaction. (Can throw `GError`)

Complete a request certificate user interaction request. This should be once the `tlsInteractionRequestCertificateAsync` completion callback is called.

If `TlsInteractionResultHandled` is returned, then the `TlsConnection` passed to `tlsInteractionRequestCertificateAsync` will have had its TlsConnection:certificate filled in.

If the interaction is cancelled by the cancellation object, or by the user then `TlsInteractionResultFailed` will be returned with an error that contains a `IOErrorEnumCancelled` error code.

Since: 2.40