Trait gio::prelude::TlsInteractionExt
source · pub trait TlsInteractionExt: IsA<TlsInteraction> + Sealed + 'static {
// Provided methods
fn ask_password(
&self,
password: &impl IsA<TlsPassword>,
cancellable: Option<&impl IsA<Cancellable>>
) -> Result<TlsInteractionResult, Error> { ... }
fn ask_password_async<P: FnOnce(Result<TlsInteractionResult, Error>) + 'static>(
&self,
password: &impl IsA<TlsPassword>,
cancellable: Option<&impl IsA<Cancellable>>,
callback: P
) { ... }
fn ask_password_future(
&self,
password: &(impl IsA<TlsPassword> + Clone + 'static)
) -> Pin<Box_<dyn Future<Output = Result<TlsInteractionResult, Error>> + 'static>> { ... }
fn invoke_ask_password(
&self,
password: &impl IsA<TlsPassword>,
cancellable: Option<&impl IsA<Cancellable>>
) -> Result<TlsInteractionResult, Error> { ... }
fn invoke_request_certificate(
&self,
connection: &impl IsA<TlsConnection>,
flags: TlsCertificateRequestFlags,
cancellable: Option<&impl IsA<Cancellable>>
) -> Result<TlsInteractionResult, Error> { ... }
fn request_certificate(
&self,
connection: &impl IsA<TlsConnection>,
flags: TlsCertificateRequestFlags,
cancellable: Option<&impl IsA<Cancellable>>
) -> Result<TlsInteractionResult, Error> { ... }
fn request_certificate_async<P: FnOnce(Result<TlsInteractionResult, Error>) + 'static>(
&self,
connection: &impl IsA<TlsConnection>,
flags: TlsCertificateRequestFlags,
cancellable: Option<&impl IsA<Cancellable>>,
callback: P
) { ... }
fn request_certificate_future(
&self,
connection: &(impl IsA<TlsConnection> + Clone + 'static),
flags: TlsCertificateRequestFlags
) -> Pin<Box_<dyn Future<Output = Result<TlsInteractionResult, Error>> + 'static>> { ... }
}
Expand description
Provided Methods§
sourcefn ask_password(
&self,
password: &impl IsA<TlsPassword>,
cancellable: Option<&impl IsA<Cancellable>>
) -> Result<TlsInteractionResult, Error>
fn ask_password( &self, password: &impl IsA<TlsPassword>, cancellable: Option<&impl IsA<Cancellable>> ) -> Result<TlsInteractionResult, Error>
Run synchronous interaction to ask the user for a password. In general,
invoke_ask_password()
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 TlsInteractionResult::Failed
will be returned with an error that
contains a IOErrorEnum::Cancelled
error code. Certain implementations may
not support immediate cancellation.
password
a TlsPassword
object
cancellable
an optional Cancellable
cancellation object
Returns
The status of the ask password interaction.
sourcefn ask_password_async<P: FnOnce(Result<TlsInteractionResult, Error>) + 'static>(
&self,
password: &impl IsA<TlsPassword>,
cancellable: Option<&impl IsA<Cancellable>>,
callback: P
)
fn ask_password_async<P: FnOnce(Result<TlsInteractionResult, Error>) + 'static>( &self, password: &impl IsA<TlsPassword>, cancellable: Option<&impl IsA<Cancellable>>, callback: P )
Run asynchronous interaction to ask the user for a password. In general,
invoke_ask_password()
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 TlsInteractionResult::Failed
will be returned with an error that
contains a IOErrorEnum::Cancelled
error code. Certain implementations may
not support immediate cancellation.
Certain implementations may not support immediate cancellation.
password
a TlsPassword
object
cancellable
an optional Cancellable
cancellation object
callback
will be called when the interaction completes
fn ask_password_future( &self, password: &(impl IsA<TlsPassword> + Clone + 'static) ) -> Pin<Box_<dyn Future<Output = Result<TlsInteractionResult, Error>> + 'static>>
sourcefn invoke_ask_password(
&self,
password: &impl IsA<TlsPassword>,
cancellable: Option<&impl IsA<Cancellable>>
) -> Result<TlsInteractionResult, Error>
fn invoke_ask_password( &self, password: &impl IsA<TlsPassword>, cancellable: Option<&impl IsA<Cancellable>> ) -> Result<TlsInteractionResult, Error>
Invoke the interaction to ask the user for a password. It invokes this
interaction in the main loop, specifically the glib::MainContext
returned by
glib::MainContext::thread_default()
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 TlsInteractionResult::Failed
will be returned with an error that
contains a IOErrorEnum::Cancelled
error code. Certain implementations may
not support immediate cancellation.
password
a TlsPassword
object
cancellable
an optional Cancellable
cancellation object
Returns
The status of the ask password interaction.
sourcefn invoke_request_certificate(
&self,
connection: &impl IsA<TlsConnection>,
flags: TlsCertificateRequestFlags,
cancellable: Option<&impl IsA<Cancellable>>
) -> Result<TlsInteractionResult, Error>
fn invoke_request_certificate( &self, connection: &impl IsA<TlsConnection>, flags: TlsCertificateRequestFlags, cancellable: Option<&impl IsA<Cancellable>> ) -> Result<TlsInteractionResult, Error>
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 glib::MainContext
returned by
glib::MainContext::thread_default()
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 TlsInteractionResult::Failed
will be returned with an error that
contains a IOErrorEnum::Cancelled
error code. Certain implementations may
not support immediate cancellation.
connection
a TlsConnection
object
flags
flags providing more information about the request
cancellable
an optional Cancellable
cancellation object
Returns
The status of the certificate request interaction.
sourcefn request_certificate(
&self,
connection: &impl IsA<TlsConnection>,
flags: TlsCertificateRequestFlags,
cancellable: Option<&impl IsA<Cancellable>>
) -> Result<TlsInteractionResult, Error>
fn request_certificate( &self, connection: &impl IsA<TlsConnection>, flags: TlsCertificateRequestFlags, cancellable: Option<&impl IsA<Cancellable>> ) -> Result<TlsInteractionResult, Error>
Run synchronous interaction to ask the user to choose a certificate to use
with the connection. In general, invoke_request_certificate()
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 TlsInteractionResult::Handled
is returned, then the TlsConnection
passed to request_certificate()
will have had its
certificate
filled in.
If the interaction is cancelled by the cancellation object, or by the
user then TlsInteractionResult::Failed
will be returned with an error that
contains a IOErrorEnum::Cancelled
error code. Certain implementations may
not support immediate cancellation.
connection
a TlsConnection
object
flags
flags providing more information about the request
cancellable
an optional Cancellable
cancellation object
Returns
The status of the request certificate interaction.
sourcefn request_certificate_async<P: FnOnce(Result<TlsInteractionResult, Error>) + 'static>(
&self,
connection: &impl IsA<TlsConnection>,
flags: TlsCertificateRequestFlags,
cancellable: Option<&impl IsA<Cancellable>>,
callback: P
)
fn request_certificate_async<P: FnOnce(Result<TlsInteractionResult, Error>) + 'static>( &self, connection: &impl IsA<TlsConnection>, flags: TlsCertificateRequestFlags, cancellable: Option<&impl IsA<Cancellable>>, callback: P )
Run asynchronous interaction to ask the user for a certificate to use with
the connection. In general, invoke_request_certificate()
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.
connection
a TlsConnection
object
flags
flags providing more information about the request
cancellable
an optional Cancellable
cancellation object
callback
will be called when the interaction completes