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 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257
|
<?xml version="1.0"?>
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
"http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd">
<refentry id="SoupAuth">
<refmeta>
<refentrytitle role="top_of_page">SoupAuth</refentrytitle>
<manvolnum>3</manvolnum>
<refmiscinfo>LIBSOUP Library</refmiscinfo>
</refmeta>
<refnamediv>
<refname>SoupAuth</refname>
<refpurpose>HTTP Authentication support</refpurpose>
<!--[<xref linkend="desc" endterm="desc.title"/>]-->
</refnamediv>
<refsynopsisdiv role="synopsis">
<title role="synopsis.title">Synopsis</title>
<anchor id="SoupAuthBasic"/><anchor id="SoupAuthDigest"/>
<synopsis>
<link linkend="SoupAuth-struct">SoupAuth</link>;
<link linkend="SoupAuthBasic-struct">SoupAuthBasic</link>;
<link linkend="SoupAuthDigest-struct">SoupAuthDigest</link>;
<link linkend="SoupAuth">SoupAuth</link>* <link linkend="soup-auth-new-from-header-list">soup_auth_new_from_header_list</link> (const <link linkend="GSList">GSList</link> *vals);
const <link linkend="char">char</link>* <link linkend="soup-auth-get-scheme-name">soup_auth_get_scheme_name</link> (<link linkend="SoupAuth">SoupAuth</link> *auth);
const <link linkend="char">char</link>* <link linkend="soup-auth-get-realm">soup_auth_get_realm</link> (<link linkend="SoupAuth">SoupAuth</link> *auth);
<link linkend="void">void</link> <link linkend="soup-auth-authenticate">soup_auth_authenticate</link> (<link linkend="SoupAuth">SoupAuth</link> *auth,
const <link linkend="char">char</link> *username,
const <link linkend="char">char</link> *password);
<link linkend="gboolean">gboolean</link> <link linkend="soup-auth-is-authenticated">soup_auth_is_authenticated</link> (<link linkend="SoupAuth">SoupAuth</link> *auth);
<link linkend="char">char</link>* <link linkend="soup-auth-get-authorization">soup_auth_get_authorization</link> (<link linkend="SoupAuth">SoupAuth</link> *auth,
<link linkend="SoupMessage">SoupMessage</link> *msg);
<link linkend="GSList">GSList</link>* <link linkend="soup-auth-get-protection-space">soup_auth_get_protection_space</link> (<link linkend="SoupAuth">SoupAuth</link> *auth,
const <link linkend="SoupUri">SoupUri</link> *source_uri);
<link linkend="void">void</link> <link linkend="soup-auth-free-protection-space">soup_auth_free_protection_space</link> (<link linkend="SoupAuth">SoupAuth</link> *auth,
<link linkend="GSList">GSList</link> *space);
</synopsis>
</refsynopsisdiv>
<refsect1 role="object_hierarchy">
<title role="object_hierarchy.title">Object Hierarchy</title>
<synopsis>
<link linkend="GObject">GObject</link>
+----SoupAuth
+----<link linkend="SoupAuthBasic">SoupAuthBasic</link>
+----<link linkend="SoupAuthDigest">SoupAuthDigest</link>
</synopsis>
<synopsis>
<link linkend="GObject">GObject</link>
+----<link linkend="SoupAuth">SoupAuth</link>
+----SoupAuthBasic
</synopsis>
<synopsis>
<link linkend="GObject">GObject</link>
+----<link linkend="SoupAuth">SoupAuth</link>
+----SoupAuthDigest
</synopsis>
</refsect1>
<refsect1 role="desc">
<title role="desc.title">Description</title>
<para>
<link linkend="SoupAuth"><type>SoupAuth</type></link> objects store the authentication data associated with a
given bit of webspace. They are created and maintained automatically
by <link linkend="SoupSession"><type>SoupSession</type></link>.
</para>
</refsect1>
<refsect1 role="details">
<title role="details.title">Details</title>
<refsect2>
<title><anchor id="SoupAuth-struct" role="struct"/>SoupAuth</title>
<indexterm><primary>SoupAuth</primary></indexterm><programlisting>typedef struct _SoupAuth SoupAuth;</programlisting>
<para>
The abstract base class for handling authentication. Specific HTTP
Authentication mechanisms are implemented by its subclasses. (NTLM
authentication, which works quite differently from normal HTTP
authentication, is handled by <link linkend="SoupConnectionNTLM"><type>SoupConnectionNTLM</type></link>.)
</para></refsect2>
<refsect2>
<title><anchor id="SoupAuthBasic-struct" role="struct"/>SoupAuthBasic</title>
<indexterm><primary>SoupAuthBasic</primary></indexterm><programlisting>typedef struct _SoupAuthBasic SoupAuthBasic;</programlisting>
<para>
An object representing Basic HTTP authentication.
</para></refsect2>
<refsect2>
<title><anchor id="SoupAuthDigest-struct" role="struct"/>SoupAuthDigest</title>
<indexterm><primary>SoupAuthDigest</primary></indexterm><programlisting>typedef struct _SoupAuthDigest SoupAuthDigest;</programlisting>
<para>
An object representing Digest HTTP authentication.
</para></refsect2>
<refsect2>
<title><anchor id="soup-auth-new-from-header-list" role="function"/>soup_auth_new_from_header_list ()</title>
<indexterm><primary>soup_auth_new_from_header_list</primary></indexterm><programlisting><link linkend="SoupAuth">SoupAuth</link>* soup_auth_new_from_header_list (const <link linkend="GSList">GSList</link> *vals);</programlisting>
<para>
Creates a <link linkend="SoupAuth"><type>SoupAuth</type></link> value based on the strongest available
supported auth type in <parameter>vals</parameter>.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>vals</parameter> :</term>
<listitem><simpara> a list of WWW-Authenticate headers from a server response
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara> the new <link linkend="SoupAuth"><type>SoupAuth</type></link>, or <link linkend="NULL:CAPS"><literal>NULL</literal></link> if none could be created.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="soup-auth-get-scheme-name" role="function"/>soup_auth_get_scheme_name ()</title>
<indexterm><primary>soup_auth_get_scheme_name</primary></indexterm><programlisting>const <link linkend="char">char</link>* soup_auth_get_scheme_name (<link linkend="SoupAuth">SoupAuth</link> *auth);</programlisting>
<para>
Returns <parameter>auth</parameter>'s scheme name. (Eg, "Basic")</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>auth</parameter> :</term>
<listitem><simpara> a <link linkend="SoupAuth"><type>SoupAuth</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara> the scheme name
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="soup-auth-get-realm" role="function"/>soup_auth_get_realm ()</title>
<indexterm><primary>soup_auth_get_realm</primary></indexterm><programlisting>const <link linkend="char">char</link>* soup_auth_get_realm (<link linkend="SoupAuth">SoupAuth</link> *auth);</programlisting>
<para>
Returns <parameter>auth</parameter>'s realm.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>auth</parameter> :</term>
<listitem><simpara> a <link linkend="SoupAuth"><type>SoupAuth</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara> the realm name
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="soup-auth-authenticate" role="function"/>soup_auth_authenticate ()</title>
<indexterm><primary>soup_auth_authenticate</primary></indexterm><programlisting><link linkend="void">void</link> soup_auth_authenticate (<link linkend="SoupAuth">SoupAuth</link> *auth,
const <link linkend="char">char</link> *username,
const <link linkend="char">char</link> *password);</programlisting>
<para>
This is called by the session after requesting a username and
password from the application. <parameter>auth</parameter> will take the information
and do whatever scheme-specific processing is needed.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>auth</parameter> :</term>
<listitem><simpara> a <link linkend="SoupAuth"><type>SoupAuth</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>username</parameter> :</term>
<listitem><simpara> the username provided by the user or client
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>password</parameter> :</term>
<listitem><simpara> the password provided by the user or client
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="soup-auth-is-authenticated" role="function"/>soup_auth_is_authenticated ()</title>
<indexterm><primary>soup_auth_is_authenticated</primary></indexterm><programlisting><link linkend="gboolean">gboolean</link> soup_auth_is_authenticated (<link linkend="SoupAuth">SoupAuth</link> *auth);</programlisting>
<para>
Tests if <parameter>auth</parameter> has been given a username and password</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>auth</parameter> :</term>
<listitem><simpara> a <link linkend="SoupAuth"><type>SoupAuth</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara> <link linkend="TRUE:CAPS"><literal>TRUE</literal></link> if <parameter>auth</parameter> has been given a username and password
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="soup-auth-get-authorization" role="function"/>soup_auth_get_authorization ()</title>
<indexterm><primary>soup_auth_get_authorization</primary></indexterm><programlisting><link linkend="char">char</link>* soup_auth_get_authorization (<link linkend="SoupAuth">SoupAuth</link> *auth,
<link linkend="SoupMessage">SoupMessage</link> *msg);</programlisting>
<para>
Generates an appropriate "Authorization" header for <parameter>msg</parameter>. (The
session will only call this if <link linkend="soup-auth-is-authenticated"><function>soup_auth_is_authenticated()</function></link>
returned <link linkend="TRUE:CAPS"><literal>TRUE</literal></link>.)</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>auth</parameter> :</term>
<listitem><simpara> a <link linkend="SoupAuth"><type>SoupAuth</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>msg</parameter> :</term>
<listitem><simpara> the <link linkend="SoupMessage"><type>SoupMessage</type></link> to be authorized
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara> the "Authorization" header, which must be freed.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="soup-auth-get-protection-space" role="function"/>soup_auth_get_protection_space ()</title>
<indexterm><primary>soup_auth_get_protection_space</primary></indexterm><programlisting><link linkend="GSList">GSList</link>* soup_auth_get_protection_space (<link linkend="SoupAuth">SoupAuth</link> *auth,
const <link linkend="SoupUri">SoupUri</link> *source_uri);</programlisting>
<para>
Returns a list of paths on the server which <parameter>auth</parameter> extends over.
(All subdirectories of these paths are also assumed to be part
of <parameter>auth</parameter>'s protection space, unless otherwise discovered not to
be.)</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>auth</parameter> :</term>
<listitem><simpara> a <link linkend="SoupAuth"><type>SoupAuth</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>source_uri</parameter> :</term>
<listitem><simpara> the URI of the request that <parameter>auth</parameter> was generated in
response to.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara> the list of paths, which must be freed with
<link linkend="soup-auth-free-protection-space"><function>soup_auth_free_protection_space()</function></link>.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="soup-auth-free-protection-space" role="function"/>soup_auth_free_protection_space ()</title>
<indexterm><primary>soup_auth_free_protection_space</primary></indexterm><programlisting><link linkend="void">void</link> soup_auth_free_protection_space (<link linkend="SoupAuth">SoupAuth</link> *auth,
<link linkend="GSList">GSList</link> *space);</programlisting>
<para>
Frees <parameter>space</parameter>.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>auth</parameter> :</term>
<listitem><simpara> a <link linkend="SoupAuth"><type>SoupAuth</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>space</parameter> :</term>
<listitem><simpara> the return value from <link linkend="soup-auth-get-protection-space"><function>soup_auth_get_protection_space()</function></link>
</simpara></listitem></varlistentry>
</variablelist></refsect2>
</refsect1>
<refsect1>
<title>See Also</title>
<para>
<link linkend="SoupSession"><type>SoupSession</type></link>, <link linkend="SoupConnectionNTLM"><type>SoupConnectionNTLM</type></link>
</para>
</refsect1>
</refentry>
|