summaryrefslogtreecommitdiff
path: root/tests/wocky-test-sasl-handler.c
blob: 3305aa35c845a4130c95f646d1103e55f4fb0731 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51

#include "wocky-test-sasl-handler.h"

#include <wocky/wocky-auth-handler.h>

static void
auth_handler_iface_init (gpointer g_iface);

G_DEFINE_TYPE_WITH_CODE (WockyTestSaslHandler, wocky_test_sasl_handler,
    G_TYPE_OBJECT,
    G_IMPLEMENT_INTERFACE (WOCKY_TYPE_AUTH_HANDLER, auth_handler_iface_init))

static void
wocky_test_sasl_handler_class_init (WockyTestSaslHandlerClass *klass)
{
}

static void
wocky_test_sasl_handler_init (WockyTestSaslHandler *self)
{
}

static gboolean
test_initial_response (WockyAuthHandler *handler,
    GString **initial_data,
    GError **error);

static void
auth_handler_iface_init (gpointer g_iface)
{
  WockyAuthHandlerIface *iface = g_iface;

  iface->mechanism = "X-TEST";
  iface->plain = FALSE;
  iface->initial_response_func = test_initial_response;
}

WockyTestSaslHandler *
wocky_test_sasl_handler_new (void)
{
  return g_object_new (WOCKY_TYPE_TEST_SASL_HANDLER, NULL);
}

static gboolean
test_initial_response (WockyAuthHandler *handler,
    GString **initial_data,
    GError **error)
{
  *initial_data = g_string_new ("open sesame");
  return TRUE;
}