Commit 9bd44704 authored by Jussi Laako's avatar Jussi Laako

Update example and documentation

parent 0a0124ce
......@@ -22,8 +22,10 @@
#include <gsignond/gsignond-session-data.h>
#include <gsignond/gsignond-plugin-interface.h>
#include <gsignond/gsignond-error.h>
#include <gsignond/gsignond-utils.h>
#include "gsignond-sasl-plugin.h"
static const gchar* allowed_realms[] = { "megahostname", NULL };
//this callback prints the received final response
//the final response should also be sent to the server
......@@ -115,6 +117,8 @@ static void digest_md5_authorization(gpointer plugin)
//fill in necessary data
gsignond_dictionary_set_string(data, "Service", "megaservice");
gsignond_dictionary_set_string(data, "Hostname", "megahostname");
gsignond_session_data_set_allowed_realms(data,
gsignond_copy_array_to_sequence(allowed_realms));
gsignond_session_data_set_username(data, "megauser@example.com");
gsignond_session_data_set_secret(data, "megapassword");
//initial server challenge, for simplicty it's hardcoded
......
......@@ -113,6 +113,7 @@
* - "ChallengeBase64" Initial server challenge, encoded in base64.
* - gsignond_session_data_set_username() Authentication identity.
* - gsignond_session_data_set_secret() The password of the authentication identity.
* - gsignond_session_data_set_allowed_realms() List of allowed realms/domains, must exist when either "Hostname" or "Realm" is also supplied.
* - "Authzid" The authorization identity.
* - "AnonymousToken" An anonymous token (for example an email address).
* - "Service" The registered service name of the application service, e.g. “imap”.
......@@ -140,14 +141,14 @@
* <refsect1><title>How to use CRAM-MD5 mechanism</title></refsect1>
* Issue gsignond_plugin_request_initial() with @mechanism set to "CRAM-MD5"
* and @session_data containing authentication identity, password, and initial
* server challenge.
* server challenge.
* The plugin will return the final response string immediately via
* #GSignondPlugin::response-final signal.
*
* <refsect1><title>How to use DIGEST-MD5 mechanism</title></refsect1>
* Issue gsignond_plugin_request_initial() with @mechanism set to "DIGEST-MD5"
* and @session_data containing authentication identity, password, service,
* hostname and initial server challenge.
* hostname, allowed realms list and initial server challenge.
* Optionally, it can also include realm, QOP and authorization identity.
*
* The plugin will return a response for the server immediately via
......@@ -416,8 +417,8 @@ static void gsignond_sasl_plugin_request_initial (
host_ok = TRUE;
}
}
g_sequence_free (allowed_realms);
}
g_sequence_free (allowed_realms);
if (realm && !realm_ok) {
GError *error = g_error_new (GSIGNOND_ERROR,
GSIGNOND_ERROR_NOT_AUTHORIZED,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment