浏览代码

auth: docs - extended example for auth_algorithm()

(cherry picked from commit 38544a774d92c86065709888d07c5b4f5bd013c5)
Daniel-Constantin Mierla 6 月之前
父节点
当前提交
83e0e5ea61
共有 1 个文件被更改,包括 13 次插入4 次删除
  1. 13 4
      src/modules/auth/doc/auth_functions.xml

+ 13 - 4
src/modules/auth/doc/auth_functions.xml

@@ -402,7 +402,7 @@ if (!pv_auth_check("$fd", "$avp(password)", "0", "1")) {
 		This function can be used from ANY_ROUTE.
 		This function can be used from ANY_ROUTE.
 		</para>
 		</para>
 		<example>
 		<example>
-		<title>auth_get_www_authenticate</title>
+		<title>auth_get_www_authenticate usage</title>
 		<programlisting format="linespecific">
 		<programlisting format="linespecific">
 ...
 ...
 if (auth_get_www_authenticate("$fd", "0", "$var(wauth)")) {
 if (auth_get_www_authenticate("$fd", "0", "$var(wauth)")) {
@@ -417,13 +417,22 @@ if (auth_get_www_authenticate("$fd", "0", "$var(wauth)")) {
 	<para>
 	<para>
 	  Set hash algorithm used for digest authentication thus overriding
 	  Set hash algorithm used for digest authentication thus overriding
       algorithm parameter. Possible values are the same as those of
       algorithm parameter. Possible values are the same as those of
-      algorithm parameter.  The parameter may be a pseudo variable.
+      algorithm parameter. The parameter may be a pseudo variable.
 	</para>
 	</para>
 	<example>
 	<example>
-	    <title>auth_algorithm  example</title>
+	    <title>auth_algorithm example</title>
 	    <programlisting>
 	    <programlisting>
 ...
 ...
-auth_algorithm("$alg");
+if($fU == "alice") {
+    $var(alg) = "SHA-256";
+} else {
+    $var(alg) = "MD5";
+}
+auth_algorithm("$var(alg)");
+if (!auth_check("$fd", "subscriber", "1")) {
+    auth_challenge("$fd", "1");
+    exit;
+}
 ...
 ...
 	    </programlisting>
 	    </programlisting>
 	</example>
 	</example>