| Wocky Reference Manual | ||||
|---|---|---|---|---|
| Top | Description | Object Hierarchy | ||||
#define WOCKY_AUTH_ERROR #define WOCKY_AUTH_MECH_JABBER_DIGEST #define WOCKY_AUTH_MECH_JABBER_PASSWORD #define WOCKY_AUTH_MECH_SASL_DIGEST_MD5 #define WOCKY_AUTH_MECH_SASL_PLAIN #define WOCKY_AUTH_MECH_SASL_SCRAM_SHA_1 enum WockyAuthError; struct WockyAuthRegistry; void (*WockyAuthRegistryChallengeAsyncFunc) (WockyAuthRegistry *self,const GString *challenge_data,GAsyncReadyCallback callback,gpointer user_data); gboolean (*WockyAuthRegistryChallengeFinishFunc) (WockyAuthRegistry *self,GAsyncResult *result,GString **response,GError **error); struct WockyAuthRegistryClass; void (*WockyAuthRegistryFailureFunc) (WockyAuthRegistry *self,GError *error); void (*WockyAuthRegistryStartAuthAsyncFunc) (WockyAuthRegistry *self,const GSList *mechanisms,gboolean allow_plain,gboolean is_secure_channel,const gchar *username,const gchar *password,const gchar *server,const gchar *session_id,GAsyncReadyCallback callback,gpointer user_data); gboolean (*WockyAuthRegistryStartAuthFinishFunc) (WockyAuthRegistry *self,GAsyncResult *result,WockyAuthRegistryStartData **start_data,GError **error); WockyAuthRegistryStartData; void (*WockyAuthRegistrySuccessAsyncFunc) (WockyAuthRegistry *self,GAsyncReadyCallback callback,gpointer user_data); gboolean (*WockyAuthRegistrySuccessFinishFunc) (WockyAuthRegistry *self,GAsyncResult *result,GError **error); GQuark wocky_auth_error_quark (void); void wocky_auth_registry_add_handler (WockyAuthRegistry *self,WockyAuthHandler *handler); void wocky_auth_registry_challenge_async (WockyAuthRegistry *self,const GString *challenge_data,GAsyncReadyCallback callback,gpointer user_data); gboolean wocky_auth_registry_challenge_finish (WockyAuthRegistry *self,GAsyncResult *res,GString **response,GError **error); void wocky_auth_registry_failure (WockyAuthRegistry *self,GError *error); WockyAuthRegistry * wocky_auth_registry_new (void); void wocky_auth_registry_start_auth_async (WockyAuthRegistry *self,const GSList *mechanisms,gboolean allow_plain,gboolean is_secure_channel,const gchar *username,const gchar *password,const gchar *server,const gchar *session_id,GAsyncReadyCallback callback,gpointer user_data); gboolean wocky_auth_registry_start_auth_finish (WockyAuthRegistry *self,GAsyncResult *result,WockyAuthRegistryStartData **start_data,GError **error); WockyAuthRegistryStartData * wocky_auth_registry_start_data_dup (WockyAuthRegistryStartData *start_data); void wocky_auth_registry_start_data_free (WockyAuthRegistryStartData *start_data); WockyAuthRegistryStartData * wocky_auth_registry_start_data_new (const gchar *mechanism,const GString *initial_response); void wocky_auth_registry_success_async (WockyAuthRegistry *self,GAsyncReadyCallback callback,gpointer user_data); gboolean wocky_auth_registry_success_finish (WockyAuthRegistry *self,GAsyncResult *res,GError **error); gboolean wocky_auth_registry_supports_one_of (WockyAuthRegistry *self,const GSList *mechanisms,gboolean allow_plain);
typedef enum {
WOCKY_AUTH_ERROR_INIT_FAILED,
WOCKY_AUTH_ERROR_NOT_SUPPORTED,
WOCKY_AUTH_ERROR_NO_SUPPORTED_MECHANISMS,
WOCKY_AUTH_ERROR_NETWORK,
WOCKY_AUTH_ERROR_INVALID_REPLY,
WOCKY_AUTH_ERROR_NO_CREDENTIALS,
WOCKY_AUTH_ERROR_FAILURE,
WOCKY_AUTH_ERROR_CONNRESET,
WOCKY_AUTH_ERROR_STREAM,
WOCKY_AUTH_ERROR_RESOURCE_CONFLICT,
WOCKY_AUTH_ERROR_NOT_AUTHORIZED,
} WockyAuthError;
WockyAuthRegistry specific errors.
| Failed to initialize our auth support | |
| Server doesn't support this authentication method | |
| Server doesn't support any mechanisms that we support | |
| Couldn't send our stanzas to the server | |
| Server sent an invalid reply | |
| Failure to provide user credentials | |
| Server sent a failure | |
| disconnected | |
| XMPP stream error while authing | |
| Resource conflict (relevant in in jabber auth) | |
| Provided credentials are not valid |
void (*WockyAuthRegistryChallengeAsyncFunc) (WockyAuthRegistry *self,const GString *challenge_data,GAsyncReadyCallback callback,gpointer user_data);
Recieves a challenge and asynchronously provides a reply. By default the challenge is passed on to the chosen WockyAuthHandler.
|
a WockyAuthRegistry object |
|
the challenge data string |
|
a callback to call when finished |
|
data to pass to callback
|
gboolean (*WockyAuthRegistryChallengeFinishFunc) (WockyAuthRegistry *self,GAsyncResult *result,GString **response,GError **error);
Finishes a GAsyncResult from WockyAuthRegistryChallengeAsyncFunc. By default it extracts a GString response from the given GSimpleAsyncResult and copies it to the out param.
|
a WockyAuthRegistry object |
|
a GAsyncResult object |
|
a location to be filled with the response string |
|
a location to fill with a GError if an error is hit, or NULL
|
Returns : |
TRUE on success, otherwise FALSE
|
struct WockyAuthRegistryClass {
WockyAuthRegistryStartAuthAsyncFunc start_auth_async_func;
WockyAuthRegistryStartAuthFinishFunc start_auth_finish_func;
WockyAuthRegistryChallengeAsyncFunc challenge_async_func;
WockyAuthRegistryChallengeFinishFunc challenge_finish_func;
WockyAuthRegistrySuccessAsyncFunc success_async_func;
WockyAuthRegistrySuccessFinishFunc success_finish_func;
WockyAuthRegistryFailureFunc failure_func;
};
The class of a WockyAuthRegistry.
WockyAuthRegistryStartAuthAsyncFunc |
a function to call to start an asynchronous
start auth operation; see wocky_auth_registry_start_auth_async() for
more details. |
WockyAuthRegistryStartAuthFinishFunc |
a function to call to finish an
asynchronous start auth operation; see
wocky_auth_registry_start_auth_finish() for more details. |
WockyAuthRegistryChallengeAsyncFunc |
a function to call to start an asynchronous
challenge operation; see wocky_auth_registry_challenge_async() for
more details. |
WockyAuthRegistryChallengeFinishFunc |
a function to call to finish an asynchronous
challenge operation; see wocky_auth_registry_challenge_finish() for
more details. |
WockyAuthRegistrySuccessAsyncFunc |
a function to call to start an asynchronous
success operation; see wocky_auth_registry_success_async() for
more details. |
WockyAuthRegistrySuccessFinishFunc |
a function to call to finish an asynchronous
success operation; see wocky_auth_registry_success_finish() for
more details. |
WockyAuthRegistryFailureFunc |
a function to call on failure; see
wocky_auth_registry_failure() for more details. |
void (*WockyAuthRegistryFailureFunc) (WockyAuthRegistry *self,GError *error);
Notifies the client of a server-side error. By default this is not implemented.
|
a WockyAuthRegistry object |
|
a GError describing the failure |
void (*WockyAuthRegistryStartAuthAsyncFunc) (WockyAuthRegistry *self,const GSList *mechanisms,gboolean allow_plain,gboolean is_secure_channel,const gchar *username,const gchar *password,const gchar *server,const gchar *session_id,GAsyncReadyCallback callback,gpointer user_data);
Starts a async authentication: chooses mechanism and gets initial data. The default function chooses a WockyAuthHandler by which mechanism it supports and gets the initial data from the chosen handler.
|
a WockyAuthRegistry object |
|
a list of avahilable mechanisms |
|
TRUE if PLAIN is allowed, otherwise FALSE
|
|
TRUE if channel is secure, otherwise FALSE
|
|
the username |
|
the password |
|
the server |
|
the session ID |
|
a callback to be called when finished |
|
data to pass to callback
|
gboolean (*WockyAuthRegistryStartAuthFinishFunc) (WockyAuthRegistry *self,GAsyncResult *result,WockyAuthRegistryStartData **start_data,GError **error);
Called to finish the GAsyncResult task for authentication start. By default, it extracts a WockyAuthRegistryStartData pointer from a given GSimpleAsyncResult and copies it to the out param.
|
a WockyAuthRegistry object |
|
a GAsyncResult object |
|
a location to fill with a WockyAuthRegistryStartData structure |
|
a location to fill with a GError if an error is hit, or NULL
|
Returns : |
TRUE on success, otherwise FALSE
|
typedef struct {
gchar *mechanism;
GString *initial_response;
} WockyAuthRegistryStartData;
A structure to hold the mechanism and response data.
void (*WockyAuthRegistrySuccessAsyncFunc) (WockyAuthRegistry *self,GAsyncReadyCallback callback,gpointer user_data);
Notifies the registry of authentication success, and allows a last ditch attempt at aborting the authentication at the client's discretion.
|
a WockyAuthRegistry object |
|
a callback to be called when finished |
|
data to pass to callback
|
gboolean (*WockyAuthRegistrySuccessFinishFunc) (WockyAuthRegistry *self,GAsyncResult *result,GError **error);
Finishes a GAsyncResult from
WockyAuthRegistrySuccessAsyncFunc. It checks for any errors set on
the given GSimpleAsyncResult, copies the GError to an out param
and returns FALSE if there was an error.
|
a WockyAuthRegistry object |
|
a GAsyncResult object |
|
a location to fill with a GError if an error is hit, or NULL
|
Returns : |
TRUE on success, otherwise FALSE
|
void wocky_auth_registry_add_handler (WockyAuthRegistry *self,WockyAuthHandler *handler);
void wocky_auth_registry_challenge_async (WockyAuthRegistry *self,const GString *challenge_data,GAsyncReadyCallback callback,gpointer user_data);
gboolean wocky_auth_registry_challenge_finish (WockyAuthRegistry *self,GAsyncResult *res,GString **response,GError **error);
void wocky_auth_registry_failure (WockyAuthRegistry *self,GError *error);
void wocky_auth_registry_start_auth_async (WockyAuthRegistry *self,const GSList *mechanisms,gboolean allow_plain,gboolean is_secure_channel,const gchar *username,const gchar *password,const gchar *server,const gchar *session_id,GAsyncReadyCallback callback,gpointer user_data);
gboolean wocky_auth_registry_start_auth_finish (WockyAuthRegistry *self,GAsyncResult *result,WockyAuthRegistryStartData **start_data,GError **error);
WockyAuthRegistryStartData * wocky_auth_registry_start_data_dup
(WockyAuthRegistryStartData *start_data);
void wocky_auth_registry_start_data_free (WockyAuthRegistryStartData *start_data);
WockyAuthRegistryStartData * wocky_auth_registry_start_data_new (const gchar *mechanism,const GString *initial_response);
void wocky_auth_registry_success_async (WockyAuthRegistry *self,GAsyncReadyCallback callback,gpointer user_data);
gboolean wocky_auth_registry_success_finish (WockyAuthRegistry *self,GAsyncResult *res,GError **error);
gboolean wocky_auth_registry_supports_one_of (WockyAuthRegistry *self,const GSList *mechanisms,gboolean allow_plain);
Checks whether at least one of mechanisms is supported by Wocky. At present,
Wocky itself only implements password-based authentication mechanisms.
|
a WockyAuthRegistry |
|
a GSList of gchar* of auth mechanisms |
|
Whether auth in plain text is allowed |
Returns : |
TRUE if one of the mechanisms is supported by wocky,
FALSE otherwise. |