Class: Gio::TlsInteraction

Inherits:
Object
  • Object
show all
Defined in:
(unknown)

Overview

The class for GTls::Interaction. Derived classes implement the various virtual interaction methods to handle TLS interactions.

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

The synchronous interaction methods should implement to display modal dialogs, and the asynchronous methods to display modeless dialogs.

If the user cancels an interaction, then the result should be %G_TLS_INTERACTION_FAILED and the error should be set with a domain of %G_IO_ERROR and code of %G_IO_ERROR_CANCELLED.

Instance Method Summary collapse

Instance Method Details

#ask_password(password, cancellable) ⇒ Gio::TlsInteractionResult

Run synchronous interaction to ask the user for a password. In general, g_tls_interaction_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 %G_TLS_INTERACTION_FAILED will be returned with an error that contains a %G_IO_ERROR_CANCELLED error code. Certain implementations may not support immediate cancellation.

Parameters:

Returns:

#ask_password_async(password, cancellable, callback, user_data) ⇒ nil

Run asynchronous interaction to ask the user for a password. In general, g_tls_interaction_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 %G_TLS_INTERACTION_FAILED will be returned with an error that contains a %G_IO_ERROR_CANCELLED error code. Certain implementations may not support immediate cancellation.

Certain implementations may not support immediate cancellation.

Parameters:

  • password (Gio::TlsPassword)

    a GTls::Password object

  • cancellable (Gio::Cancellable)

    an optional #GCancellable cancellation object

  • callback (Gio::AsyncReadyCallback)

    will be called when the interaction completes

  • user_data (GObject)

    data to pass to the callback

Returns:

  • (nil)

#ask_password_finish(result) ⇒ Gio::TlsInteractionResult

Complete an ask password user interaction request. This should be once the g_tls_interaction_ask_password_async() completion callback is called.

If %G_TLS_INTERACTION_HANDLED is returned, then the GTls::Password passed to g_tls_interaction_ask_password() will have its password filled in.

If the interaction is cancelled by the cancellation object, or by the user then %G_TLS_INTERACTION_FAILED will be returned with an error that contains a %G_IO_ERROR_CANCELLED error code.

Parameters:

Returns:

#invoke_ask_password(password, cancellable) ⇒ Gio::TlsInteractionResult

Invoke the interaction to ask the user for a password. It invokes this interaction in the main loop, specifically the GMain::Context returned by g_main_context_get_thread_default() when the interaction is created. This is called by called by GTls::Connection or #GTlsDatabase 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 %G_TLS_INTERACTION_FAILED will be returned with an error that contains a %G_IO_ERROR_CANCELLED error code. Certain implementations may not support immediate cancellation.

Parameters:

Returns:

#invoke_request_certificate(connection, flags, cancellable) ⇒ Gio::TlsInteractionResult

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 GMain::Context returned by g_main_context_get_thread_default() when the interaction is created. This is called by called by GTls::Connection 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 %G_TLS_INTERACTION_FAILED will be returned with an error that contains a %G_IO_ERROR_CANCELLED error code. Certain implementations may not support immediate cancellation.

Parameters:

Returns:

#request_certificate(connection, flags, cancellable) ⇒ Gio::TlsInteractionResult

Run synchronous interaction to ask the user to choose a certificate to use with the connection. In general, g_tls_interaction_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 %G_TLS_INTERACTION_HANDLED is returned, then the GTls::Connection passed to g_tls_interaction_request_certificate() will have had its GTls::Connection:certificate filled in.

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

Parameters:

Returns:

#request_certificate_async(connection, flags, cancellable, callback, user_data) ⇒ nil

Run asynchronous interaction to ask the user for a certificate to use with the connection. In general, g_tls_interaction_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.

Parameters:

  • connection (Gio::TlsConnection)

    a GTls::Connection object

  • flags (Gio::TlsCertificateRequestFlags)

    flags providing more information about the request

  • cancellable (Gio::Cancellable)

    an optional #GCancellable cancellation object

  • callback (Gio::AsyncReadyCallback)

    will be called when the interaction completes

  • user_data (GObject)

    data to pass to the callback

Returns:

  • (nil)

#request_certificate_finish(result) ⇒ Gio::TlsInteractionResult

Complete a request certificate user interaction request. This should be once the g_tls_interaction_request_certificate_async() completion callback is called.

If %G_TLS_INTERACTION_HANDLED is returned, then the GTls::Connection passed to g_tls_interaction_request_certificate_async() will have had its GTls::Connection:certificate filled in.

If the interaction is cancelled by the cancellation object, or by the user then %G_TLS_INTERACTION_FAILED will be returned with an error that contains a %G_IO_ERROR_CANCELLED error code.

Parameters:

Returns: