File: functions.xml

package info (click to toggle)
kamailio 4.2.0-2%2Bdeb8u3
  • links: PTS, VCS
  • area: main
  • in suites: jessie
  • size: 56,276 kB
  • sloc: ansic: 552,836; xml: 166,484; sh: 8,659; makefile: 7,676; sql: 6,235; perl: 3,487; yacc: 3,428; python: 1,457; cpp: 1,219; php: 1,047; java: 449; pascal: 194; cs: 40; awk: 27
file content (106 lines) | stat: -rw-r--r-- 3,577 bytes parent folder | download | duplicates (7)
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
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE section PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" 
   "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">

<section id="auth_db.functions" xmlns:xi="http://www.w3.org/2001/XInclude">
    <sectioninfo>
    </sectioninfo>

    <title>Functions</title>

    <section id="www_authorize">
	<title><function>www_authorize(realm, table)</function></title>
	<para>
	    The function verifies credentials according to RFC2617. If the
	    credentials are verified successfully then the function will
	    succeed and mark the credentials as authorized (marked credentials
	    can be later used by some other functions). If the function was
	    unable to verify the credentials for some reason then it will fail
	    and the script should call <function>www_challenge</function> which
	    will challenge the user again.
	</para>
	<para>Meaning of the parameters is as follows:</para>
	<itemizedlist>
	    <listitem>
		<formalpara>
		    <title>realm</title>
		    <para>
			Realm is a opaque string that the user agent should
			present to the user so he can decide what username and
			password to use. Usually this is domain of the host the
			server is running on. If an empty string "" is used
			then the server will generate it from the request. In
			case of REGISTER requests To header field domain will
			be used (because this header field represents a user
			being registered), for all other messages From header
			field domain will be used.
		    </para>
		</formalpara>
	    </listitem>
	    <listitem>
		<formalpara>
		    <title>table</title>
		    <para>
			Table to be used to lookup usernames and passwords
			(usually subscribers table).
		    </para>
		</formalpara>
	    </listitem>
	</itemizedlist>
	<example>
	    <title><function moreinfo="none">www_authorize</function> usage</title>
	    <programlisting>
...
if (www_authorize("iptel.org", "subscriber")) {
    www_challenge("iptel.org", "1");
};
...
	    </programlisting>
	</example>
    </section>
    
    <section id="proxy_authorize">
	<title><function>proxy_authorize(realm, table)</function></title>
	<para>
	    The function verifies credentials according to RFC2617. If the
	    credentials are verified successfully then the function will
	    succeed and mark the credentials as authorized (marked credentials
	    can be later used by some other functions). If the function was
	    unable to verify the credentials for some reason then it will fail
	    and the script should call <function>proxy_challenge</function>
	    which will challenge the user again.
	</para>
	<para>Meaning of the parameters is as follows:</para>
	<itemizedlist>
	    <listitem>
		<para>
		    <emphasis>realm</emphasis> - Realm is a opaque string that
		    the user agent should present to the user so he can decide
		    what username and password to use. Usually this is domain
		    of the host the server is running on.
		</para>
		<para>
		    If an empty string "" is used then the server will generate
		    it from the request. From header field domain will be used
		    as realm.
		</para>
	    </listitem>
	    <listitem>
		<para>
		    <emphasis>table</emphasis> - Table to be used to lookup
		    usernames and passwords (usually subscribers table).
		</para>
	    </listitem>
	</itemizedlist>
	<example>
	    <title>proxy_authorize usage</title>
	    <programlisting>
...
if (!proxy_authorize("", "subscriber)) {
    proxy_challenge("", "1");  # Realm will be autogenerated
};
...
	    </programlisting>
	</example>
    </section>
</section>