[sr-dev] git:master:8d33363b: jwt: docs for jwt_verify_key(...)

Daniel-Constantin Mierla miconda at gmail.com
Wed Nov 23 10:39:47 CET 2022


Module: kamailio
Branch: master
Commit: 8d33363b5ec93ebd0068f270af23be9095950775
URL: https://github.com/kamailio/kamailio/commit/8d33363b5ec93ebd0068f270af23be9095950775

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2022-11-23T10:39:18+01:00

jwt: docs for jwt_verify_key(...)

---

Modified: src/modules/jwt/doc/jwt_admin.xml

---

Diff:  https://github.com/kamailio/kamailio/commit/8d33363b5ec93ebd0068f270af23be9095950775.diff
Patch: https://github.com/kamailio/kamailio/commit/8d33363b5ec93ebd0068f270af23be9095950775.patch

---

diff --git a/src/modules/jwt/doc/jwt_admin.xml b/src/modules/jwt/doc/jwt_admin.xml
index a72c518efe6..f247b43b46d 100644
--- a/src/modules/jwt/doc/jwt_admin.xml
+++ b/src/modules/jwt/doc/jwt_admin.xml
@@ -142,7 +142,7 @@ modparam("jwt", "key_mode", 1)
 
 	<section id="jwt.f.jwt_verify">
 	    <title>
-		<function moreinfo="none">jwt_verify(pubkey, alg, claims, jwtval)</function>
+		<function moreinfo="none">jwt_verify(pubkeypath, alg, claims, jwtval)</function>
 	    </title>
 	    <para>
 	    Verify the JWT.
@@ -153,7 +153,7 @@ modparam("jwt", "key_mode", 1)
 		<itemizedlist>
 			<listitem>
 			<para>
-			pubkey - path to public key
+			pubkeypath - path to public key file
 			</para>
 			</listitem>
 			<listitem>
@@ -188,6 +188,58 @@ modparam("jwt", "key_mode", 1)
     xwarn("failed to verify jwt\n");
   }
 ...
+</programlisting>
+	    </example>
+	</section>
+
+	<section id="jwt.f.jwt_verify_key">
+	    <title>
+		<function moreinfo="none">jwt_verify_key(pubkeyval, alg, claims, jwtval)</function>
+	    </title>
+	    <para>
+	    Verify the JWT.
+		</para>
+		<para>
+		The parameters are:
+		</para>
+		<itemizedlist>
+			<listitem>
+			<para>
+			pubkeyval - public key value
+			</para>
+			</listitem>
+			<listitem>
+			<para>
+			alg - the algoritm to build the signature, as supported by the
+			libjwt (e.g., RS256, HS256, ES256, ...)
+			</para>
+			</listitem>
+			<listitem>
+			<para>
+			claims - the list of claims to be checked they are in the JWT, in the format
+			"name1=value1;name2=value2;..." (same as the SIP parameters format,
+			see also the description of claims parameter for jwt_generate()).
+			</para>
+			</listitem>
+			<listitem>
+			<para>
+			jwtval - the value of the JWT to verify
+			</para>
+			</listitem>
+		</itemizedlist>
+		<para>
+		This function can be used from ANY_ROUTE.
+		</para>
+		<example>
+		<title><function>jwt_verify_key</function> usage</title>
+		<programlisting format="linespecific">
+...
+  if(!jwt_verify_key("...", "RS256",
+         "caller='$fU';callee='$tU';callid='$ci';index=100",
+        "$var(jwt)") {
+    xwarn("failed to verify jwt\n");
+  }
+...
 </programlisting>
 	    </example>
 	</section>




More information about the sr-dev mailing list