Bläddra i källkod

auth: docs - extended example for auth_algorithm()

(cherry picked from commit 38544a774d92c86065709888d07c5b4f5bd013c5)
Daniel-Constantin Mierla 6 månader sedan
förälder
incheckning
83e0e5ea61
1 ändrade filer med 13 tillägg och 4 borttagningar
  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.
 		</para>
 		<example>
-		<title>auth_get_www_authenticate</title>
+		<title>auth_get_www_authenticate usage</title>
 		<programlisting format="linespecific">
 ...
 if (auth_get_www_authenticate("$fd", "0", "$var(wauth)")) {
@@ -417,13 +417,22 @@ if (auth_get_www_authenticate("$fd", "0", "$var(wauth)")) {
 	<para>
 	  Set hash algorithm used for digest authentication thus overriding
       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>
 	<example>
-	    <title>auth_algorithm  example</title>
+	    <title>auth_algorithm example</title>
 	    <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>
 	</example>