glibmm 2.66.5
Public Member Functions | Static Public Member Functions | Protected Member Functions | Related Functions | List of all members
Gio::TlsInteraction Class Reference

TlsInteraction - Interaction with the user during TLS operations. More...

#include <giomm/tlsinteraction.h>

Inheritance diagram for Gio::TlsInteraction:
Inheritance graph
[legend]

Public Member Functions

 TlsInteraction (TlsInteraction && src) noexcept
 
TlsInteractionoperator= (TlsInteraction && src) noexcept
 
 ~TlsInteraction () noexcept override
 
GTlsInteraction * gobj ()
 Provides access to the underlying C GObject. More...
 
const GTlsInteraction * gobj () const
 Provides access to the underlying C GObject. More...
 
GTlsInteraction * gobj_copy ()
 Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. More...
 
TlsInteractionResult ask_password (const Glib::RefPtr< TlsPassword > & password, const Glib::RefPtr< Cancellable > & cancellable)
 Run synchronous interaction to ask the user for a password. More...
 
TlsInteractionResult ask_password (const Glib::RefPtr< TlsPassword > & password)
 A ask_password() convenience overload. More...
 
void ask_password_async (const Glib::RefPtr< TlsPassword > & password, const SlotAsyncReady & slot, const Glib::RefPtr< Cancellable > & cancellable)
 Run asynchronous interaction to ask the user for a password. More...
 
void ask_password_async (const Glib::RefPtr< TlsPassword > & password, const SlotAsyncReady & slot)
 A ask_password_async() convenience overload. More...
 
void ask_password_async (const Glib::RefPtr< TlsPassword > & password, const Glib::RefPtr< Cancellable > & cancellable)
 A ask_password_async() convenience overload. More...
 
void ask_password_async (const Glib::RefPtr< TlsPassword > & password)
 A ask_password_async() convenience overload. More...
 
TlsInteractionResult ask_password_finish (const Glib::RefPtr< AsyncResult > & result)
 Complete an ask password user interaction request. More...
 
TlsInteractionResult invoke_ask_password (const Glib::RefPtr< TlsPassword > & password, const Glib::RefPtr< Cancellable > & cancellable)
 Invoke the interaction to ask the user for a password. More...
 
TlsInteractionResult invoke_ask_password (const Glib::RefPtr< TlsPassword > & password)
 A invoke_ask_password() convenience overload. More...
 
TlsInteractionResult invoke_request_certificate (const Glib::RefPtr< TlsConnection > & connection, TlsCertificateRequestFlags flags, const Glib::RefPtr< Cancellable > & cancellable)
 Invoke the interaction to ask the user to choose a certificate to use with the connection. More...
 
TlsInteractionResult invoke_request_certificate (const Glib::RefPtr< TlsConnection > & connection, TlsCertificateRequestFlags flags)
 A invoke_request_certificate() convenience overload. More...
 
TlsInteractionResult request_certificate (const Glib::RefPtr< TlsConnection > & connection, TlsCertificateRequestFlags flags, const Glib::RefPtr< Cancellable > & cancellable)
 Run synchronous interaction to ask the user to choose a certificate to use with the connection. More...
 
TlsInteractionResult request_certificate (const Glib::RefPtr< TlsConnection > & connection, TlsCertificateRequestFlags flags)
 A request_certificate() convenience overload. More...
 
void request_certificate_async (const Glib::RefPtr< TlsConnection > & connection, TlsCertificateRequestFlags flags, const SlotAsyncReady & slot, const Glib::RefPtr< Cancellable > & cancellable)
 Run asynchronous interaction to ask the user for a certificate to use with the connection. More...
 
void request_certificate_async (const Glib::RefPtr< TlsConnection > & connection, TlsCertificateRequestFlags flags, const SlotAsyncReady & slot)
 A request_certificate_async() convenience overload. More...
 
void request_certificate_async (const Glib::RefPtr< TlsConnection > & connection, TlsCertificateRequestFlags flags, const Glib::RefPtr< Cancellable > & cancellable)
 A request_certificate_async() convenience overload. More...
 
void request_certificate_async (const Glib::RefPtr< TlsConnection > & connection, TlsCertificateRequestFlags flags)
 A request_certificate_async() convenience overload. More...
 
TlsInteractionResult request_certificate_finish (const Glib::RefPtr< AsyncResult > & result)
 Complete a request certificate user interaction request. More...
 
virtual TlsInteractionResult ask_password_vfunc (const Glib::RefPtr< TlsPassword > & password, const Glib::RefPtr< Cancellable > & cancellable)
 
virtual void ask_password_async_vfunc (const Glib::RefPtr< TlsPassword > & password, const SlotAsyncReady & slot, const Glib::RefPtr< Cancellable > & cancellable)
 
virtual TlsInteractionResult ask_password_finish_vfunc (const Glib::RefPtr< AsyncResult > & result)
 
- Public Member Functions inherited from Glib::Object
 Object (const Object &)=delete
 
Objectoperator= (const Object &)=delete
 
 Object (Object && src) noexcept
 
Objectoperator= (Object && src) noexcept
 
void * get_data (const QueryQuark & key)
 
void set_data (const Quark & key, void *data)
 
void set_data (const Quark & key, void *data, DestroyNotify notify)
 
void remove_data (const QueryQuark & quark)
 
void * steal_data (const QueryQuark & quark)
 
- Public Member Functions inherited from Glib::ObjectBase
 ObjectBase (const ObjectBase &)=delete
 
ObjectBaseoperator= (const ObjectBase &)=delete
 
void set_property_value (const Glib::ustring & property_name, const Glib::ValueBase & value)
 You probably want to use a specific property_*() accessor method instead. More...
 
void get_property_value (const Glib::ustring & property_name, Glib::ValueBase & value) const
 You probably want to use a specific property_*() accessor method instead. More...
 
template<class PropertyType >
void set_property (const Glib::ustring & property_name, const PropertyType & value)
 You probably want to use a specific property_*() accessor method instead. More...
 
template<class PropertyType >
void get_property (const Glib::ustring & property_name, PropertyType & value) const
 You probably want to use a specific property_*() accessor method instead. More...
 
void connect_property_changed (const Glib::ustring & property_name, const sigc::slot< void > & slot)
 You can use the signal_changed() signal of the property proxy instead. More...
 
void connect_property_changed (const Glib::ustring & property_name, sigc::slot< void > && slot)
 You can use the signal_changed() signal of the property proxy instead. More...
 
sigc::connection connect_property_changed_with_return (const Glib::ustring & property_name, const sigc::slot< void > & slot)
 You can use the signal_changed() signal of the property proxy instead. More...
 
sigc::connection connect_property_changed_with_return (const Glib::ustring & property_name, sigc::slot< void > && slot)
 You can use the signal_changed() signal of the property proxy instead. More...
 
void freeze_notify ()
 Increases the freeze count on object. More...
 
void thaw_notify ()
 Reverts the effect of a previous call to freeze_notify(). More...
 
virtual void reference () const
 Increment the reference count for this object. More...
 
virtual void unreference () const
 Decrement the reference count for this object. More...
 
GObject * gobj ()
 Provides access to the underlying C GObject. More...
 
const GObject * gobj () const
 Provides access to the underlying C GObject. More...
 
GObject * gobj_copy () const
 Give a ref-ed copy to someone. Use for direct struct access. More...
 

Static Public Member Functions

static GType get_type ()
 Get the GType for this class, for use with the underlying GObject type system. More...
 

Protected Member Functions

 TlsInteraction ()
 
- Protected Member Functions inherited from Glib::Object
 Object ()
 
 Object (const Glib::ConstructParams & construct_params)
 
 Object (GObject * castitem)
 
 ~Object () noexcept override
 
- Protected Member Functions inherited from Glib::ObjectBase
 ObjectBase ()
 This default constructor is called implicitly from the constructor of user-derived classes, even if, for instance, Gtk::Button calls a different ObjectBase constructor. More...
 
 ObjectBase (const char * custom_type_name)
 A derived constructor always overrides this choice. More...
 
 ObjectBase (const std::type_info & custom_type_info)
 This constructor is a special feature to allow creation of derived types on the fly, without having to use g_object_new() manually. More...
 
 ObjectBase (ObjectBase && src) noexcept
 
ObjectBaseoperator= (ObjectBase && src) noexcept
 
virtual ~ObjectBase () noexcept=0
 
void initialize (GObject * castitem)
 
void initialize_move (GObject * castitem, Glib::ObjectBase * previous_wrapper)
 

Related Functions

(Note that these are not member functions.)

Glib::RefPtr< Gio::TlsInteractionwrap (GTlsInteraction * object, bool take_copy=false)
 A Glib::wrap() method for this object. More...
 

Additional Inherited Members

- Public Types inherited from Glib::Object
using DestroyNotify = void(*)(gpointer data)
 

Detailed Description

TlsInteraction - Interaction with the user during TLS operations.

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 Gio::TlsConnection::set_interaction().

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

Callers should use the 'invoke' functions like invoke_ask_password() 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. Any interactions not implemented will return Gio::TLS_INTERACTION_UNHANDLED. If a derived class implements an async method, it must also implement the corresponding finish method.

Since glibmm 2.36:

Constructor & Destructor Documentation

◆ TlsInteraction() [1/2]

Gio::TlsInteraction::TlsInteraction ( TlsInteraction &&  src)
noexcept

◆ ~TlsInteraction()

Gio::TlsInteraction::~TlsInteraction ( )
overridenoexcept

◆ TlsInteraction() [2/2]

Gio::TlsInteraction::TlsInteraction ( )
protected

Member Function Documentation

◆ ask_password() [1/2]

TlsInteractionResult Gio::TlsInteraction::ask_password ( const Glib::RefPtr< TlsPassword > &  password)

A ask_password() convenience overload.

◆ ask_password() [2/2]

TlsInteractionResult Gio::TlsInteraction::ask_password ( const Glib::RefPtr< TlsPassword > &  password,
const Glib::RefPtr< Cancellable > &  cancellable 
)

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 TLS_INTERACTION_FAILED will be returned with an error that contains a IO_ERROR_CANCELLED error code. Certain implementations may not support immediate cancellation.

Since glibmm 2.30:
Parameters
passwordA TlsPassword object.
cancellableAn optional Cancellable cancellation object.
Returns
The status of the ask password interaction.
Exceptions
Glib::Error

◆ ask_password_async() [1/4]

void Gio::TlsInteraction::ask_password_async ( const Glib::RefPtr< TlsPassword > &  password)

A ask_password_async() convenience overload.

◆ ask_password_async() [2/4]

void Gio::TlsInteraction::ask_password_async ( const Glib::RefPtr< TlsPassword > &  password,
const Glib::RefPtr< Cancellable > &  cancellable 
)

A ask_password_async() convenience overload.

◆ ask_password_async() [3/4]

void Gio::TlsInteraction::ask_password_async ( const Glib::RefPtr< TlsPassword > &  password,
const SlotAsyncReady &  slot 
)

A ask_password_async() convenience overload.

◆ ask_password_async() [4/4]

void Gio::TlsInteraction::ask_password_async ( const Glib::RefPtr< TlsPassword > &  password,
const SlotAsyncReady &  slot,
const Glib::RefPtr< Cancellable > &  cancellable 
)

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 slot 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 TLS_INTERACTION_FAILED will be returned with an error that contains a IO_ERROR_CANCELLED error code. Certain implementations may not support immediate cancellation.

Certain implementations may not support immediate cancellation.

Since glibmm 2.30:
Parameters
passwordA TlsPassword object.
cancellableAn optional Cancellable cancellation object.
slotWill be called when the interaction completes.

◆ ask_password_async_vfunc()

virtual void Gio::TlsInteraction::ask_password_async_vfunc ( const Glib::RefPtr< TlsPassword > &  password,
const SlotAsyncReady &  slot,
const Glib::RefPtr< Cancellable > &  cancellable 
)
virtual

◆ ask_password_finish()

TlsInteractionResult Gio::TlsInteraction::ask_password_finish ( const Glib::RefPtr< AsyncResult > &  result)

Complete an ask password user interaction request.

This should be once the g_tls_interaction_ask_password_async() completion callback is called.

If TLS_INTERACTION_HANDLED is returned, then the TlsPassword 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 TLS_INTERACTION_FAILED will be returned with an error that contains a IO_ERROR_CANCELLED error code.

Since glibmm 2.30:
Parameters
resultThe result passed to the callback.
Returns
The status of the ask password interaction.
Exceptions
Glib::Error

◆ ask_password_finish_vfunc()

virtual TlsInteractionResult Gio::TlsInteraction::ask_password_finish_vfunc ( const Glib::RefPtr< AsyncResult > &  result)
virtual
Exceptions
Glib::Error.

◆ ask_password_vfunc()

virtual TlsInteractionResult Gio::TlsInteraction::ask_password_vfunc ( const Glib::RefPtr< TlsPassword > &  password,
const Glib::RefPtr< Cancellable > &  cancellable 
)
virtual
Exceptions
Glib::Error.

◆ get_type()

static GType Gio::TlsInteraction::get_type ( )
static

Get the GType for this class, for use with the underlying GObject type system.

◆ gobj() [1/2]

GTlsInteraction * Gio::TlsInteraction::gobj ( )
inline

Provides access to the underlying C GObject.

◆ gobj() [2/2]

const GTlsInteraction * Gio::TlsInteraction::gobj ( ) const
inline

Provides access to the underlying C GObject.

◆ gobj_copy()

GTlsInteraction * Gio::TlsInteraction::gobj_copy ( )

Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.

◆ invoke_ask_password() [1/2]

TlsInteractionResult Gio::TlsInteraction::invoke_ask_password ( const Glib::RefPtr< TlsPassword > &  password)

A invoke_ask_password() convenience overload.

◆ invoke_ask_password() [2/2]

TlsInteractionResult Gio::TlsInteraction::invoke_ask_password ( const Glib::RefPtr< TlsPassword > &  password,
const Glib::RefPtr< Cancellable > &  cancellable 
)

Invoke the interaction to ask the user for a password.

It invokes this interaction in the main loop, specifically the MainContext returned by Glib::main_context_get_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 TLS_INTERACTION_FAILED will be returned with an error that contains a IO_ERROR_CANCELLED error code. Certain implementations may not support immediate cancellation.

Since glibmm 2.30:
Parameters
passwordA TlsPassword object.
cancellableAn optional Cancellable cancellation object.
Returns
The status of the ask password interaction.
Exceptions
Glib::Error

◆ invoke_request_certificate() [1/2]

TlsInteractionResult Gio::TlsInteraction::invoke_request_certificate ( const Glib::RefPtr< TlsConnection > &  connection,
TlsCertificateRequestFlags  flags 
)

A invoke_request_certificate() convenience overload.

◆ invoke_request_certificate() [2/2]

TlsInteractionResult Gio::TlsInteraction::invoke_request_certificate ( const Glib::RefPtr< TlsConnection > &  connection,
TlsCertificateRequestFlags  flags,
const Glib::RefPtr< Cancellable > &  cancellable 
)

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 Glib::main_context_get_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 TLS_INTERACTION_FAILED will be returned with an error that contains a IO_ERROR_CANCELLED error code. Certain implementations may not support immediate cancellation.

Since glibmm 2.40:
Parameters
connectionA TlsConnection object.
flagsFlags providing more information about the request.
cancellableAn optional Cancellable cancellation object.
Returns
The status of the certificate request interaction.
Exceptions
Glib::Error

◆ operator=()

TlsInteraction & Gio::TlsInteraction::operator= ( TlsInteraction &&  src)
noexcept

◆ request_certificate() [1/2]

TlsInteractionResult Gio::TlsInteraction::request_certificate ( const Glib::RefPtr< TlsConnection > &  connection,
TlsCertificateRequestFlags  flags 
)

A request_certificate() convenience overload.

◆ request_certificate() [2/2]

TlsInteractionResult Gio::TlsInteraction::request_certificate ( const Glib::RefPtr< TlsConnection > &  connection,
TlsCertificateRequestFlags  flags,
const Glib::RefPtr< Cancellable > &  cancellable 
)

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 TLS_INTERACTION_HANDLED is returned, then the TlsConnection passed to g_tls_interaction_request_certificate() will have had its TlsConnection::property_certificate() filled in.

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

Since glibmm 2.40:
Parameters
connectionA TlsConnection object.
flagsFlags providing more information about the request.
cancellableAn optional Cancellable cancellation object.
Returns
The status of the request certificate interaction.
Exceptions
Glib::Error

◆ request_certificate_async() [1/4]

void Gio::TlsInteraction::request_certificate_async ( const Glib::RefPtr< TlsConnection > &  connection,
TlsCertificateRequestFlags  flags 
)

A request_certificate_async() convenience overload.

◆ request_certificate_async() [2/4]

void Gio::TlsInteraction::request_certificate_async ( const Glib::RefPtr< TlsConnection > &  connection,
TlsCertificateRequestFlags  flags,
const Glib::RefPtr< Cancellable > &  cancellable 
)

A request_certificate_async() convenience overload.

◆ request_certificate_async() [3/4]

void Gio::TlsInteraction::request_certificate_async ( const Glib::RefPtr< TlsConnection > &  connection,
TlsCertificateRequestFlags  flags,
const SlotAsyncReady &  slot 
)

A request_certificate_async() convenience overload.

◆ request_certificate_async() [4/4]

void Gio::TlsInteraction::request_certificate_async ( const Glib::RefPtr< TlsConnection > &  connection,
TlsCertificateRequestFlags  flags,
const SlotAsyncReady &  slot,
const Glib::RefPtr< Cancellable > &  cancellable 
)

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. slot will be called when the operation completes. Alternatively the user may abort this certificate request, which will usually abort the TLS connection.

Since glibmm 2.40:
Parameters
connectionA TlsConnection object.
flagsFlags providing more information about the request.
cancellableAn optional Cancellable cancellation object.
slotWill be called when the interaction completes.

◆ request_certificate_finish()

TlsInteractionResult Gio::TlsInteraction::request_certificate_finish ( const Glib::RefPtr< AsyncResult > &  result)

Complete a request certificate user interaction request.

This should be once the g_tls_interaction_request_certificate_async() completion callback is called.

If TLS_INTERACTION_HANDLED is returned, then the TlsConnection passed to g_tls_interaction_request_certificate_async() will have had its TlsConnection::property_certificate() filled in.

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

Since glibmm 2.40:
Parameters
resultThe result passed to the callback.
Returns
The status of the request certificate interaction.
Exceptions
Glib::Error

Friends And Related Function Documentation

◆ wrap()

Glib::RefPtr< Gio::TlsInteraction > wrap ( GTlsInteraction *  object,
bool  take_copy = false 
)
related

A Glib::wrap() method for this object.

Parameters
objectThe C instance.
take_copyFalse if the result should take ownership of the C instance. True if it should take a new copy or ref.
Returns
A C++ instance that wraps this C instance.