Browse code

jwt: more details about claims parameter format

Daniel-Constantin Mierla authored on 02/05/2021 19:42:48
Showing 1 changed files
... ...
@@ -109,6 +109,10 @@ modparam("jwt", "key_mode", 1)
109 109
 			<para>
110 110
 			claims - the list of claims to be added to JWT, in the format
111 111
 			"name1=value1;name2=value2;..." (same as the SIP parameters format).
112
+			The string values can be enclosed in single or double quotes. If a
113
+			value is not eclosed in between quotes, it is added as numeric
114
+			value if it is successfully converted to a long value, otherwise is
115
+			added as string value.
112 116
 			</para>
113 117
 			</listitem>
114 118
 		</itemizedlist>
... ...
@@ -120,7 +124,7 @@ modparam("jwt", "key_mode", 1)
120 124
 		<programlisting format="linespecific">
121 125
 ...
122 126
   jwt_generate("/path/to/prvkey.pem", "RS256",
123
-        "caller=$fU;callee=$tU;callid=$ci");
127
+        "caller='$fU';callee='$tU';callid='$ci';index=100");
124 128
 ...
125 129
 </programlisting>
126 130
 	    </example>
... ...
@@ -151,7 +155,8 @@ modparam("jwt", "key_mode", 1)
151 155
 			<listitem>
152 156
 			<para>
153 157
 			claims - the list of claims to be checked they are in the JWT, in the format
154
-			"name1=value1;name2=value2;..." (same as the SIP parameters format).
158
+			"name1=value1;name2=value2;..." (same as the SIP parameters format,
159
+			see also the description of claims parameter for jwt_generate()).
155 160
 			</para>
156 161
 			</listitem>
157 162
 			<listitem>
... ...
@@ -168,7 +173,7 @@ modparam("jwt", "key_mode", 1)
168 173
 		<programlisting format="linespecific">
169 174
 ...
170 175
   if(!jwt_verify("/path/to/pubkey.pem", "RS256",
171
-         "caller=$fU;callee=$tU;callid=$ci",
176
+         "caller='$fU';callee='$tU';callid='$ci';index=100",
172 177
         "$var(jwt)") {
173 178
     xwarn("failed to verify jwt\n");
174 179
   }
... ...
@@ -206,7 +211,7 @@ modparam("jwt", "key_mode", 1)
206 211
 		<programlisting format="linespecific">
207 212
 ...
208 213
   jwt_generate("/path/to/prvkey.pem", "RS256",
209
-        "caller=$fU;callee=$tU;callid=$ci");
214
+        "caller='$fU';callee='$tU';callid='$ci';index=100");
210 215
   xinfo("jwt is: $jwt(val)");
211 216
 ...
212 217
 </programlisting>