Infinity.SaslContext¶
Fields¶
None
Methods¶
class |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Details¶
- class Infinity.SaslContext¶
Infinity.SaslContext
is an opaque data type. You should only access it via the public API functions.- classmethod new()¶
- Raises:
- Returns:
A new
Infinity.SaslContext
, orNone
on error. Free withInfinity.SaslContext.unref
() when no longer needed.- Return type:
Creates a new
Infinity.SaslContext
with a reference count of 1. If the function fails it returnsNone
and error is set.
- client_list_mechanisms()¶
- Raises:
- Returns:
A newly allocated string. Free with
GLib.free
() when no longer in use.- Return type:
Returns a newly allocated space-separated string containing SASL mechanisms that self supports for client sessions.
- client_start_session(io, mech, session_data)¶
- Parameters:
io (
Infinity.Io
) – TheInfinity.Io
main loop to which to dispatch callbacks.mech (
str
) – The mechanism to use for the session.session_data (
object
orNone
) – Session-specific data to provide to theInfinity.SaslContextCallbackFunc
.
- Raises:
- Returns:
- Return type:
Starts a new client-side SASL session using mech for authentication. When the session finished, that is either when an error occurred or the authentication finished successfully, use
Infinity.SaslContext.stop_session
().The callback function will be called in the thread that io runs in.
- client_suggest_mechanism(mechanisms)¶
- Parameters:
mechanisms (
str
) – Space-separated list of SASL mechanism names.- Returns:
The name of the suggested mechanism.
- Return type:
Given a list of SASL mechanisms this function suggests the which is the “best” one to be used.
- client_supports_mechanism(mech)¶
- Parameters:
mech (
str
) – The name of the mechanism to be tested.- Returns:
- Return type:
Checks whether self supports the mechanism with name mech for client sessions.
- ref()¶
- Returns:
The passed in pointer, self.
- Return type:
Increases the reference count of self by one.
- server_list_mechanisms()¶
- Raises:
- Returns:
A newly allocated string. Free with
GLib.free
() when no longer in use.- Return type:
Returns a newly allocated space-separated string containing SASL mechanisms that self supports for server sessions.
- server_start_session(io, mech, session_data)¶
- Parameters:
io (
Infinity.Io
) – TheInfinity.Io
main loop to which to dispatch callbacks.mech (
str
) – The mechanism to use for the session.session_data (
object
orNone
) – Session-specific data to provide to theInfinity.SaslContextCallbackFunc
.
- Raises:
- Returns:
- Return type:
Starts a new server-side SASL session using mech for authentication. When the session finished, that is either when an error occurred or the authentication finished successfully, use
Infinity.SaslContext.stop_session
().The callback function will be called in the thread that io runs in.
- server_supports_mechanism(mech)¶
- Parameters:
mech (
str
) – The name of the mechanism to be tested.- Returns:
- Return type:
Checks whether self supports the mechanism with name mech for server sessions.
- set_callback(callback, *user_data)¶
- Parameters:
callback (
Infinity.SaslContextCallbackFunc
) – A function to call to query properties for authentication.user_data (
object
orNone
) – Additional context to pass to callback.
Sets the callback to call when, during authentication, a certain properties needs to be provided, such as a username or a password. The callback function is expected to set the requested property using
Infinity.SaslContextSession.set_property
() and then callInfinity.SaslContextSession.continue_
() with retval being GSASL_OK. If it cannot provide the property then it should only callInfinity.SaslContextSession.continue_
() with retval indicating the problem.The callback function does not need to provide the property immediately. It is also allowed return and call
Infinity.SaslContextSession.continue_
() later.
- stop_session(session)¶
- Parameters:
session (
Infinity.SaslContextSession
) – AInfinity.SaslContextSession
created with self.
Finishes session and frees all resources allocated to it. This can be used to cancel an authentication session, or to free it after it finished (either successfully or not).
session should no longer be used after this function was called.
- unref()¶
Decreases the reference count of sasl by one. When the reference count reaches zero then the object is freed and may no longer be used. If that happens then also all sessions created with
Infinity.SaslContext.client_start_session
() orInfinity.SaslContext.server_start_session
() are stopped automatically.