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 52
|
<?xml version="1.0"?>
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
"http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
]>
<refentry id="authenticatecb">
<refmeta>
<refentrytitle>Authenticate Callback</refentrytitle>
<manvolnum>3</manvolnum>
<refmiscinfo>Libdmapsharing</refmiscinfo>
</refmeta>
<refnamediv>
<refname>Authenticate Callback</refname>
<refpurpose>
Defining an Authenticate Callback
</refpurpose>
</refnamediv>
<refsect1>
<title>Authenticate Callback</title>
<para>
The "authenticate" callback allows a program to prompt for an authentication token
after receiving an indication from a DMAP server that authentication is required.
Once it receives the authentication token, the callback should call
dmap_connection_authenticate_message.
</para>
<para>
The following is a simple "authenticate" callback:
</para>
<screen>
static void
authenticate_cb(DmapConnection *connection,
const char *name,
SoupSession *session,
SoupMessage *msg,
SoupAuth *auth,
gboolean retrying,
gpointer user_data)
{
char *username, password[BUFSIZ + 1];
g_object_get (connection, "username", &username, NULL);
fgets (password, BUFSIZ, stdin);
password[strlen(password) - 1] = 0x00; /* Remove newline. */
dmap_connection_authenticate_message(connection, session, msg, auth, password);
g_free(username);
}
</screen>
</refsect1>
</refentry>
|