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 |
TlsInteraction
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 TlsInteraction
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
TlsInteractionResultUnhandled
. If a derived class implements an async method,
it must also implement the corresponding finish method.
- newtype TlsInteraction = TlsInteraction (ManagedPtr TlsInteraction)
- class GObject o => IsTlsInteraction o
- toTlsInteraction :: IsTlsInteraction o => o -> IO TlsInteraction
- noTlsInteraction :: Maybe TlsInteraction
- data TlsInteractionAskPasswordMethodInfo
- tlsInteractionAskPassword :: (HasCallStack, MonadIO m, IsTlsInteraction a, IsTlsPassword b, IsCancellable c) => a -> b -> Maybe c -> m TlsInteractionResult
- data TlsInteractionAskPasswordAsyncMethodInfo
- tlsInteractionAskPasswordAsync :: (HasCallStack, MonadIO m, IsTlsInteraction a, IsTlsPassword b, IsCancellable c) => a -> b -> Maybe c -> Maybe AsyncReadyCallback -> m ()
- data TlsInteractionAskPasswordFinishMethodInfo
- tlsInteractionAskPasswordFinish :: (HasCallStack, MonadIO m, IsTlsInteraction a, IsAsyncResult b) => a -> b -> m TlsInteractionResult
- data TlsInteractionInvokeAskPasswordMethodInfo
- tlsInteractionInvokeAskPassword :: (HasCallStack, MonadIO m, IsTlsInteraction a, IsTlsPassword b, IsCancellable c) => a -> b -> Maybe c -> m TlsInteractionResult
- data TlsInteractionInvokeRequestCertificateMethodInfo
- tlsInteractionInvokeRequestCertificate :: (HasCallStack, MonadIO m, IsTlsInteraction a, IsTlsConnection b, IsCancellable c) => a -> b -> TlsCertificateRequestFlags -> Maybe c -> m TlsInteractionResult
- data TlsInteractionRequestCertificateMethodInfo
- tlsInteractionRequestCertificate :: (HasCallStack, MonadIO m, IsTlsInteraction a, IsTlsConnection b, IsCancellable c) => a -> b -> TlsCertificateRequestFlags -> Maybe c -> m TlsInteractionResult
- data TlsInteractionRequestCertificateAsyncMethodInfo
- tlsInteractionRequestCertificateAsync :: (HasCallStack, MonadIO m, IsTlsInteraction a, IsTlsConnection b, IsCancellable c) => a -> b -> TlsCertificateRequestFlags -> Maybe c -> Maybe AsyncReadyCallback -> m ()
- data TlsInteractionRequestCertificateFinishMethodInfo
- tlsInteractionRequestCertificateFinish :: (HasCallStack, MonadIO m, IsTlsInteraction a, IsAsyncResult b) => a -> b -> m TlsInteractionResult
Exported types
newtype TlsInteraction Source #
GObject TlsInteraction Source # | |
IsObject TlsInteraction Source # | |
IsTlsInteraction TlsInteraction Source # | |
((~) * info (ResolveTlsInteractionMethod t TlsInteraction), MethodInfo * info TlsInteraction p) => IsLabel t (TlsInteraction -> p) Source # | |
((~) * info (ResolveTlsInteractionMethod t TlsInteraction), MethodInfo * info TlsInteraction p) => IsLabelProxy t (TlsInteraction -> p) Source # | |
HasAttributeList * TlsInteraction Source # | |
type AttributeList TlsInteraction Source # | |
type SignalList TlsInteraction Source # | |
class GObject o => IsTlsInteraction o Source #
toTlsInteraction :: IsTlsInteraction o => o -> IO TlsInteraction Source #
Methods
askPassword
data TlsInteractionAskPasswordMethodInfo Source #
((~) * signature (b -> Maybe c -> m TlsInteractionResult), MonadIO m, IsTlsInteraction a, IsTlsPassword b, IsCancellable c) => MethodInfo * TlsInteractionAskPasswordMethodInfo a signature Source # | |
tlsInteractionAskPassword Source #
:: (HasCallStack, MonadIO m, IsTlsInteraction a, IsTlsPassword b, IsCancellable c) | |
=> a |
|
-> b |
|
-> Maybe c |
|
-> m TlsInteractionResult | Returns: The status of the ask password interaction. (Can throw |
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
data TlsInteractionAskPasswordAsyncMethodInfo Source #
((~) * signature (b -> Maybe c -> Maybe AsyncReadyCallback -> m ()), MonadIO m, IsTlsInteraction a, IsTlsPassword b, IsCancellable c) => MethodInfo * TlsInteractionAskPasswordAsyncMethodInfo a signature Source # | |
tlsInteractionAskPasswordAsync Source #
:: (HasCallStack, MonadIO m, IsTlsInteraction a, IsTlsPassword b, IsCancellable c) | |
=> a |
|
-> b |
|
-> Maybe c |
|
-> Maybe AsyncReadyCallback |
|
-> 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
data TlsInteractionAskPasswordFinishMethodInfo Source #
((~) * signature (b -> m TlsInteractionResult), MonadIO m, IsTlsInteraction a, IsAsyncResult b) => MethodInfo * TlsInteractionAskPasswordFinishMethodInfo a signature Source # | |
tlsInteractionAskPasswordFinish Source #
:: (HasCallStack, MonadIO m, IsTlsInteraction a, IsAsyncResult b) | |
=> a |
|
-> b |
|
-> m TlsInteractionResult | Returns: The status of the ask password interaction. (Can throw |
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
data TlsInteractionInvokeAskPasswordMethodInfo Source #
((~) * signature (b -> Maybe c -> m TlsInteractionResult), MonadIO m, IsTlsInteraction a, IsTlsPassword b, IsCancellable c) => MethodInfo * TlsInteractionInvokeAskPasswordMethodInfo a signature Source # | |
tlsInteractionInvokeAskPassword Source #
:: (HasCallStack, MonadIO m, IsTlsInteraction a, IsTlsPassword b, IsCancellable c) | |
=> a |
|
-> b |
|
-> Maybe c |
|
-> m TlsInteractionResult | Returns: The status of the ask password interaction. (Can throw |
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
data TlsInteractionInvokeRequestCertificateMethodInfo Source #
((~) * signature (b -> TlsCertificateRequestFlags -> Maybe c -> m TlsInteractionResult), MonadIO m, IsTlsInteraction a, IsTlsConnection b, IsCancellable c) => MethodInfo * TlsInteractionInvokeRequestCertificateMethodInfo a signature Source # | |
tlsInteractionInvokeRequestCertificate Source #
:: (HasCallStack, MonadIO m, IsTlsInteraction a, IsTlsConnection b, IsCancellable c) | |
=> a |
|
-> b |
|
-> TlsCertificateRequestFlags |
|
-> Maybe c |
|
-> m TlsInteractionResult | Returns: The status of the certificate request interaction. (Can throw |
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
data TlsInteractionRequestCertificateMethodInfo Source #
((~) * signature (b -> TlsCertificateRequestFlags -> Maybe c -> m TlsInteractionResult), MonadIO m, IsTlsInteraction a, IsTlsConnection b, IsCancellable c) => MethodInfo * TlsInteractionRequestCertificateMethodInfo a signature Source # | |
tlsInteractionRequestCertificate Source #
:: (HasCallStack, MonadIO m, IsTlsInteraction a, IsTlsConnection b, IsCancellable c) | |
=> a |
|
-> b |
|
-> TlsCertificateRequestFlags |
|
-> Maybe c |
|
-> m TlsInteractionResult | Returns: The status of the request certificate interaction. (Can throw |
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
data TlsInteractionRequestCertificateAsyncMethodInfo Source #
((~) * signature (b -> TlsCertificateRequestFlags -> Maybe c -> Maybe AsyncReadyCallback -> m ()), MonadIO m, IsTlsInteraction a, IsTlsConnection b, IsCancellable c) => MethodInfo * TlsInteractionRequestCertificateAsyncMethodInfo a signature Source # | |
tlsInteractionRequestCertificateAsync Source #
:: (HasCallStack, MonadIO m, IsTlsInteraction a, IsTlsConnection b, IsCancellable c) | |
=> a |
|
-> b |
|
-> TlsCertificateRequestFlags |
|
-> Maybe c |
|
-> Maybe AsyncReadyCallback |
|
-> 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
data TlsInteractionRequestCertificateFinishMethodInfo Source #
((~) * signature (b -> m TlsInteractionResult), MonadIO m, IsTlsInteraction a, IsAsyncResult b) => MethodInfo * TlsInteractionRequestCertificateFinishMethodInfo a signature Source # | |
tlsInteractionRequestCertificateFinish Source #
:: (HasCallStack, MonadIO m, IsTlsInteraction a, IsAsyncResult b) | |
=> a |
|
-> b |
|
-> m TlsInteractionResult | Returns: The status of the request certificate interaction. (Can throw |
Complete an 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