Browse code

jwt: docs for jwt_verify_key(...)

Daniel-Constantin Mierla authored on 23/11/2022 09:39:18
Showing 1 changed files
... ...
@@ -142,7 +142,7 @@ modparam("jwt", "key_mode", 1)
142 142
 
143 143
 	<section id="jwt.f.jwt_verify">
144 144
 	    <title>
145
-		<function moreinfo="none">jwt_verify(pubkey, alg, claims, jwtval)</function>
145
+		<function moreinfo="none">jwt_verify(pubkeypath, alg, claims, jwtval)</function>
146 146
 	    </title>
147 147
 	    <para>
148 148
 	    Verify the JWT.
... ...
@@ -153,7 +153,7 @@ modparam("jwt", "key_mode", 1)
153 153
 		<itemizedlist>
154 154
 			<listitem>
155 155
 			<para>
156
-			pubkey - path to public key
156
+			pubkeypath - path to public key file
157 157
 			</para>
158 158
 			</listitem>
159 159
 			<listitem>
... ...
@@ -188,6 +188,58 @@ modparam("jwt", "key_mode", 1)
188 188
     xwarn("failed to verify jwt\n");
189 189
   }
190 190
 ...
191
+</programlisting>
192
+	    </example>
193
+	</section>
194
+
195
+	<section id="jwt.f.jwt_verify_key">
196
+	    <title>
197
+		<function moreinfo="none">jwt_verify_key(pubkeyval, alg, claims, jwtval)</function>
198
+	    </title>
199
+	    <para>
200
+	    Verify the JWT.
201
+		</para>
202
+		<para>
203
+		The parameters are:
204
+		</para>
205
+		<itemizedlist>
206
+			<listitem>
207
+			<para>
208
+			pubkeyval - public key value
209
+			</para>
210
+			</listitem>
211
+			<listitem>
212
+			<para>
213
+			alg - the algoritm to build the signature, as supported by the
214
+			libjwt (e.g., RS256, HS256, ES256, ...)
215
+			</para>
216
+			</listitem>
217
+			<listitem>
218
+			<para>
219
+			claims - the list of claims to be checked they are in the JWT, in the format
220
+			"name1=value1;name2=value2;..." (same as the SIP parameters format,
221
+			see also the description of claims parameter for jwt_generate()).
222
+			</para>
223
+			</listitem>
224
+			<listitem>
225
+			<para>
226
+			jwtval - the value of the JWT to verify
227
+			</para>
228
+			</listitem>
229
+		</itemizedlist>
230
+		<para>
231
+		This function can be used from ANY_ROUTE.
232
+		</para>
233
+		<example>
234
+		<title><function>jwt_verify_key</function> usage</title>
235
+		<programlisting format="linespecific">
236
+...
237
+  if(!jwt_verify_key("...", "RS256",
238
+         "caller='$fU';callee='$tU';callid='$ci';index=100",
239
+        "$var(jwt)") {
240
+    xwarn("failed to verify jwt\n");
241
+  }
242
+...
191 243
 </programlisting>
192 244
 	    </example>
193 245
 	</section>