Ver Fonte

auth: docs - extended example for auth_algorithm()

Daniel-Constantin Mierla há 6 meses atrás
pai
commit
38544a774d
1 ficheiros alterados com 13 adições e 4 exclusões
  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>